openstax_utilities 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +8 -8
  2. data/Rakefile +4 -3
  3. data/app/handlers/openstax/utilities/abstract_keyword_search_handler.rb +92 -0
  4. data/app/routines/openstax/utilities/abstract_keyword_search_routine.rb +149 -0
  5. data/lib/openstax/utilities/delegate_access_control.rb +5 -0
  6. data/lib/openstax/utilities/engine.rb +4 -8
  7. data/lib/openstax/utilities/helpers/datetime.rb +4 -4
  8. data/{app/helpers → lib}/openstax/utilities/osu_helper.rb +9 -1
  9. data/lib/openstax/utilities/version.rb +1 -1
  10. data/lib/openstax_utilities.rb +1 -7
  11. data/spec/dummy/README.md +1 -1
  12. data/spec/dummy/Rakefile +1 -2
  13. data/spec/dummy/app/assets/javascripts/application.js +3 -5
  14. data/spec/dummy/app/assets/stylesheets/application.css +5 -3
  15. data/spec/dummy/app/controllers/application_controller.rb +3 -3
  16. data/spec/dummy/app/handlers/users_search.rb +11 -0
  17. data/spec/dummy/app/routines/search_users.rb +22 -0
  18. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  19. data/spec/dummy/bin/bundle +3 -0
  20. data/spec/dummy/bin/rails +4 -0
  21. data/spec/dummy/bin/rake +4 -0
  22. data/spec/dummy/config.ru +1 -1
  23. data/spec/dummy/config/application.rb +1 -37
  24. data/spec/dummy/config/boot.rb +4 -9
  25. data/spec/dummy/config/database.yml +8 -8
  26. data/spec/dummy/config/environment.rb +3 -3
  27. data/spec/dummy/config/environments/development.rb +19 -19
  28. data/spec/dummy/config/environments/production.rb +41 -30
  29. data/spec/dummy/config/environments/test.rb +17 -15
  30. data/spec/dummy/config/initializers/assets.rb +8 -0
  31. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  32. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  33. data/spec/dummy/config/initializers/inflections.rb +6 -5
  34. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  35. data/spec/dummy/config/initializers/session_store.rb +1 -6
  36. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  37. data/spec/dummy/config/locales/en.yml +20 -2
  38. data/spec/dummy/config/routes.rb +0 -3
  39. data/spec/dummy/config/secrets.yml +22 -0
  40. data/spec/dummy/db/migrate/0_create_users.rb +8 -2
  41. data/spec/dummy/db/schema.rb +13 -7
  42. data/spec/dummy/public/404.html +54 -13
  43. data/spec/dummy/public/422.html +54 -13
  44. data/spec/dummy/public/500.html +53 -12
  45. data/spec/factories/user.rb +8 -0
  46. data/spec/handlers/openstax/utilities/abstract_keyword_search_handler_spec.rb +93 -0
  47. data/spec/lib/openstax/utilities/access_policy_spec.rb +2 -2
  48. data/spec/rails_helper.rb +54 -0
  49. data/spec/routines/openstax/utilities/abstract_keyword_search_routine_spec.rb +114 -0
  50. data/spec/spec_helper.rb +80 -11
  51. metadata +102 -24
  52. data/app/assets/javascripts/openstax_utilities.js +0 -0
  53. data/app/assets/stylesheets/openstax_utilities.css +0 -4
  54. data/spec/dummy/app/assets/stylesheets/scaffold.css +0 -56
  55. data/spec/dummy/app/controllers/users_controller.rb +0 -87
  56. data/spec/dummy/app/views/users/_form.html.erb +0 -17
  57. data/spec/dummy/app/views/users/edit.html.erb +0 -6
  58. data/spec/dummy/app/views/users/index.html.erb +0 -21
  59. data/spec/dummy/app/views/users/new.html.erb +0 -5
  60. data/spec/dummy/app/views/users/show.html.erb +0 -5
  61. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  62. data/spec/dummy/script/rails +0 -6
File without changes
@@ -1,4 +0,0 @@
1
- /*
2
- *= require_self
3
- *= require_tree .
4
- */
@@ -1,56 +0,0 @@
1
- body { background-color: #fff; color: #333; }
2
-
3
- body, p, ol, ul, td {
4
- font-family: verdana, arial, helvetica, sans-serif;
5
- font-size: 13px;
6
- line-height: 18px;
7
- }
8
-
9
- pre {
10
- background-color: #eee;
11
- padding: 10px;
12
- font-size: 11px;
13
- }
14
-
15
- a { color: #000; }
16
- a:visited { color: #666; }
17
- a:hover { color: #fff; background-color:#000; }
18
-
19
- div.field, div.actions {
20
- margin-bottom: 10px;
21
- }
22
-
23
- #notice {
24
- color: green;
25
- }
26
-
27
- .field_with_errors {
28
- padding: 2px;
29
- background-color: red;
30
- display: table;
31
- }
32
-
33
- #error_explanation {
34
- width: 450px;
35
- border: 2px solid red;
36
- padding: 7px;
37
- padding-bottom: 0;
38
- margin-bottom: 20px;
39
- background-color: #f0f0f0;
40
- }
41
-
42
- #error_explanation h2 {
43
- text-align: left;
44
- font-weight: bold;
45
- padding: 5px 5px 5px 15px;
46
- font-size: 12px;
47
- margin: -7px;
48
- margin-bottom: 0px;
49
- background-color: #c00;
50
- color: #fff;
51
- }
52
-
53
- #error_explanation ul li {
54
- font-size: 12px;
55
- list-style: square;
56
- }
@@ -1,87 +0,0 @@
1
- class UsersController < ApplicationController
2
- # GET /users
3
- # GET /users.json
4
- def index
5
- @users = User.all
6
-
7
- respond_to do |format|
8
- format.html # index.html.erb
9
- format.json { render json: @users }
10
- end
11
- end
12
-
13
- # GET /users/1
14
- # GET /users/1.json
15
- def show
16
- @user = User.find(params[:id])
17
-
18
- respond_to do |format|
19
- format.html # show.html.erb
20
- format.json { render json: @user }
21
- end
22
- end
23
-
24
- # GET /users/new
25
- # GET /users/new.json
26
- def new
27
- @user = User.new
28
-
29
- respond_to do |format|
30
- format.html # new.html.erb
31
- format.json { render json: @user }
32
- end
33
- end
34
-
35
- # GET /users/1/edit
36
- def edit
37
- @user = User.find(params[:id])
38
- end
39
-
40
- # POST /users
41
- # POST /users.json
42
- def create
43
- @user = User.new
44
- @user.username = params[:user][:username]
45
- @user.password_hash = SecureRandom.hex(32)
46
-
47
- respond_to do |format|
48
- if @user.save
49
- format.html { redirect_to @user, notice: 'User was successfully created.' }
50
- format.json { render json: @user, status: :created, location: @user }
51
- else
52
- format.html { render action: "new" }
53
- format.json { render json: @user.errors, status: :unprocessable_entity }
54
- end
55
- end
56
- end
57
-
58
- # PUT /users/1
59
- # PUT /users/1.json
60
- def update
61
- @user = User.find(params[:id])
62
- @user.username = params[:user][:username]
63
- @user.password_hash = SecureRandom.hex(32)
64
-
65
- respond_to do |format|
66
- if @user.save
67
- format.html { redirect_to @user, notice: 'User was successfully updated.' }
68
- format.json { head :no_content }
69
- else
70
- format.html { render action: "edit" }
71
- format.json { render json: @user.errors, status: :unprocessable_entity }
72
- end
73
- end
74
- end
75
-
76
- # DELETE /users/1
77
- # DELETE /users/1.json
78
- def destroy
79
- @user = User.find(params[:id])
80
- @user.destroy
81
-
82
- respond_to do |format|
83
- format.html { redirect_to users_url }
84
- format.json { head :no_content }
85
- end
86
- end
87
- end
@@ -1,17 +0,0 @@
1
- <%= form_for(@user) do |f| %>
2
- <% if @user.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
-
6
- <ul>
7
- <% @user.errors.full_messages.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="actions">
15
- <%= f.submit %>
16
- </div>
17
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing user</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @user %> |
6
- <%= link_to 'Back', users_path %>
@@ -1,21 +0,0 @@
1
- <h1>Listing users</h1>
2
-
3
- <table>
4
- <tr>
5
- <th></th>
6
- <th></th>
7
- <th></th>
8
- </tr>
9
-
10
- <% @users.each do |user| %>
11
- <tr>
12
- <td><%= link_to 'Show', user %></td>
13
- <td><%= link_to 'Edit', edit_user_path(user) %></td>
14
- <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
15
- </tr>
16
- <% end %>
17
- </table>
18
-
19
- <br />
20
-
21
- <%= link_to 'New User', new_user_path %>
@@ -1,5 +0,0 @@
1
- <h1>New user</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Back', users_path %>
@@ -1,5 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
-
4
- <%= link_to 'Edit', edit_user_path(@user) %> |
5
- <%= link_to 'Back', users_path %>
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = 'c9f8077cbd8d929057bcaa2071e46ec27ed5b775756277b4d93fabab7a38f0618f1e60b95fb159a6c8320f84c53dfd27583f697a2d05b500dd90efe8214363e3'
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'