casein 5.1.1.5 → 5.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +23 -34
  3. data/app/assets/javascripts/casein/casein.js +1 -1
  4. data/app/assets/stylesheets/casein/{casein-bootstrap-overrides.css.scss → casein-bootstrap-overrides.scss} +0 -0
  5. data/app/assets/stylesheets/casein/{casein.css.scss → casein.scss} +0 -0
  6. data/app/assets/stylesheets/casein/login.scss +74 -0
  7. data/app/controllers/casein/admin_user_sessions_controller.rb +10 -6
  8. data/app/controllers/casein/admin_users_controller.rb +9 -9
  9. data/app/controllers/casein/casein_controller.rb +7 -5
  10. data/app/controllers/casein/password_resets_controller.rb +4 -4
  11. data/app/helpers/casein/casein_helper.rb +8 -8
  12. data/app/mailers/casein/casein_notification.rb +3 -3
  13. data/app/models/casein/admin_user.rb +2 -2
  14. data/app/views/casein/admin_user_sessions/new.html.erb +6 -6
  15. data/app/views/casein/admin_users/index.html.erb +1 -1
  16. data/app/views/casein/admin_users/new.html.erb +7 -7
  17. data/app/views/casein/admin_users/show.html.erb +14 -14
  18. data/app/views/casein/password_resets/edit.html.erb +4 -4
  19. data/app/views/layouts/casein_auth.html.erb +12 -6
  20. data/app/views/layouts/casein_main.html.erb +4 -4
  21. data/config/initializers/will_paginate.rb +4 -4
  22. data/config/routes.rb +5 -5
  23. data/lib/casein.rb +2 -2
  24. data/lib/casein/engine.rb +1 -1
  25. data/lib/casein/version.rb +1 -1
  26. data/lib/generators/casein/install/install_generator.rb +4 -2
  27. data/lib/generators/casein/install/templates/app/assets/javascripts/casein/auth_custom.js +2 -0
  28. data/lib/generators/casein/install/templates/app/assets/stylesheets/casein/auth_custom.scss +2 -0
  29. data/lib/generators/casein/install/templates/app/assets/stylesheets/casein/{custom.css.scss → custom.scss} +0 -0
  30. data/lib/generators/casein/install/templates/app/helpers/casein/config_helper.rb +11 -1
  31. data/lib/generators/casein/install/templates/app/views/casein/layouts/_top_navigation.html.erb +2 -2
  32. data/lib/generators/casein/install/templates/db/migrate/casein_create_admin_users.rb +6 -6
  33. data/lib/generators/casein/scaffold/scaffold_generator.rb +22 -22
  34. data/lib/generators/casein/scaffold/templates/controller.rb +25 -27
  35. data/lib/generators/casein/scaffold/templates/migration.rb +2 -2
  36. data/lib/generators/casein/scaffold/templates/model.rb +1 -2
  37. data/lib/generators/casein/scaffold/templates/views/_form.html.erb +7 -7
  38. data/lib/generators/casein/scaffold/templates/views/_table.html.erb +16 -16
  39. data/lib/generators/casein/scaffold/templates/views/index.html.erb +4 -4
  40. data/lib/generators/casein/scaffold/templates/views/new.html.erb +10 -10
  41. data/lib/generators/casein/scaffold/templates/views/show.html.erb +9 -9
  42. data/lib/railties/tasks.rake +2 -1
  43. metadata +19 -17
  44. data/app/assets/stylesheets/casein/login.css.scss +0 -74
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9c056fc8726b1cae9e895561887d19fb2f28d12
4
- data.tar.gz: 2ac86be0149be73abc718bcba22b57716834dd8a
3
+ metadata.gz: 5d4b37234ce457806986bdfafc8297cec5a044a0
4
+ data.tar.gz: 7eaffb7741b722eae3ee27912f71660afe1c90ba
5
5
  SHA512:
6
- metadata.gz: 090dad924de5925152a286b03bb5342ccf47667d28197351283544c3047d691e154a1efa1f74ec2e0308a33464acb52b40e3b61ffe7b95577ccc03a5934a89a3
7
- data.tar.gz: 5685c038441e5b816fef21259556d012ebecdb64a9ffdf6a97b1d26802d510d4a8ddd728a4a24532da9a91fd8ce0a3e0d5bed4d9182cdd4e05120673836b1e92
6
+ metadata.gz: d40b856a88a4dffb826baaba75214e5b202c47b3f49c5e13af564e57f6770235199b36d929866a1e58c3b679c8cda9ac59a61c3faf9c3b9f7b0832db4c18ae6d
7
+ data.tar.gz: e83824b71af4253db9fada75768ff80c1685fb27b9ccb92a48e571395800bf822f2e0845372164dd2f12688f758a495b5e03a3ced4e662b8f5de7541a414c1ee
@@ -1,8 +1,6 @@
1
1
  =Casein - a lightweight CMS toolkit for Ruby on Rails, based on Bootstrap
2
2
 
3
- ** ALL-NEW CASEIN 5.1.1 featuring new responsive UI based on Bootstrap 3.3! **
4
-
5
- Casein is a Rails 4.x gem that provides scaffolding generators and helper functions to quickly create a clean and minimal CRUD interface for your data.
3
+ Casein is a Rails 5.x gem that provides scaffolding generators and helper functions to quickly create a clean and minimal CRUD interface for your data.
6
4
 
7
5
  It comes with a pre-rolled user-authentication system, supports user-based timezones, and is mobile ready.
8
6
 
@@ -12,38 +10,21 @@ Screenshots at: http://www.caseincms.com
12
10
 
13
11
  ==Requirements
14
12
 
15
- This version of Casein is designed for Ruby on Rails 4.x and Ruby 2.x.
16
-
17
- ==What’s New in 5.1.1
18
-
19
- Casein 5.1.1 has the following updates:
20
-
21
- * Fixes for Rails 4.2 compatibility
22
- * Added new Casein helpers for HTML5 form helpers (see “Changing form elements” below)
23
- * First steps in building a test suite
24
- * Switched from Jeweler to Bundler for gem distribution
25
-
26
- Version 5.1.1 should be a drop-in replacement for 5.1.0
13
+ This version of Casein is designed for Ruby on Rails 5.x and Ruby 2.1.x.
27
14
 
28
- Thanks to @bunnymatic for this release.
15
+ Casein 5.1.1.5 was the last gem release compatible with Rails 4.x.
29
16
 
30
- ==What Was New in 5.1.0
17
+ ==What’s New in 5.2.0
31
18
 
32
- * Finally updated to Boostrap 3.3 (all bundled Bootstrap files removed in favor of bootstrap-sass gem)
33
- * Rake task to create admin user now takes an optional password
34
- * Authlogic version bumped to 3.4.3
35
- * UI tweaks
19
+ Casein 5.2.0 has the following updates:
36
20
 
37
- Version 5.1.0 should be a drop-in replacement for 5.0.0
21
+ * Compatible with Rails 5.x
22
+ * Added auth_custom.js and auth_custom.scss for customizing JavaScript and CSS in the authentication layout
23
+ * Deprecation updates and small improvements
38
24
 
39
- ==What Was New in 5.0.0
25
+ Version 5.2.0 should be a drop-in replacement for 5.1.1, but requires Rails 5.x and Ruby 2.1.x.
40
26
 
41
- * Now based on Bootstrap 3
42
- * Complete UI overhaul, now mobile-first
43
- * Support for strong parameters
44
- * Support for asset pipeline
45
- * Rails 4 compatibility fixes
46
- * Many other tweaks and improvements over Casein 3.x and 4.x
27
+ Thanks to @brchristian and @mkunkel for this release.
47
28
 
48
29
  ==Installation
49
30
 
@@ -51,7 +32,7 @@ Version 5.1.0 should be a drop-in replacement for 5.0.0
51
32
 
52
33
  — Add the Casein gem to your Gemfile:
53
34
 
54
- gem 'casein', '~>5.1.1'
35
+ gem 'casein', '~>5.2.0'
55
36
 
56
37
  — Then use bundler to install Casein and its dependencies:
57
38
 
@@ -74,6 +55,8 @@ Version 5.1.0 should be a drop-in replacement for 5.0.0
74
55
 
75
56
  rake casein:users:create_admin email=you@yourdomain.com [password=your_password]
76
57
 
58
+ (square brackets indicate an optional parameter, do not include)
59
+
77
60
  — Run your app! (rebooting the web server if applicable)
78
61
 
79
62
  — You can access Casein at http://yourdomain.com/casein or http://yourdomain.com/admin
@@ -94,6 +77,8 @@ The command to run the scaffolding generator is:
94
77
 
95
78
  rails g casein:scaffold ModelName [field:type, field:type]
96
79
 
80
+ (square brackets indicate an optional parameter, do not include)
81
+
97
82
  Where:
98
83
 
99
84
  * ModelName – The *singular* name of your model, e.g. Customer
@@ -143,10 +128,14 @@ An ERB partial for the the left navigation tabs. Note that using the scaffolding
143
128
 
144
129
  An ERB partial for adding items to the top navigation.
145
130
 
146
- <b>/assets/javascripts/casein/custom.js & /assets/stylesheets/casein/custom.css.scss</b>
131
+ <b>/assets/javascripts/casein/custom.js & /assets/stylesheets/casein/custom.scss</b>
147
132
 
148
133
  These files are added to your app’s /assets directory. They allow you to add custom JavaScript or CSS to your Casein deployment.
149
134
 
135
+ <b>/assets/javascripts/casein/auth_custom.js & /assets/stylesheets/casein/auth_custom.scss</b>
136
+
137
+ These files are added to your app’s /assets directory. They allow you to add custom JavaScript or CSS to the authentication layout in your Casein deployment.
138
+
150
139
  ==Customising
151
140
 
152
141
  Once you have the Casein core installed and configured, and have added support for your models with the scaffolding generator, you’ll want to extend it so that it actually has some functionality for your project!
@@ -268,11 +257,11 @@ Help is set on a page by adding a content_for block to a view:
268
257
 
269
258
  ===Routes
270
259
 
271
- Casein adds the routes for the scaffolded models to the top of your application’s routes.rb file. It also adds default routes for basic Casein functionality <b>after</b> your application’s routes. If you have a catch-all style route defined, then these defaults won’t be run. You can solve this be using Rails’ constraint feature and the supplied Casein::RouteConstraint, which will stop your catch-all from matching if the request is for a Casein resource.
260
+ Casein adds the routes for the scaffolded models to the top of your application’s routes.rb file. It also adds default routes for basic Casein functionality <b>after</b> your application’s routes. If you have a catch-all style route defined, then these defaults won’t be run. You can solve this using Rails’ constraint feature and the supplied Casein::RouteConstraint, which will stop your catch-all from matching if the request is for a Casein resource.
272
261
 
273
262
  e.g.
274
263
 
275
- match ':controller(/:action(/:id(.:format)))', :constraints => Casein::RouteConstraint.new
264
+ match ':controller(/:action(/:id(.:format)))', constraints: Casein::RouteConstraint.new
276
265
 
277
266
  ===Default Timezone
278
267
 
@@ -291,4 +280,4 @@ To run tests:
291
280
 
292
281
  Casein was created and is maintained by Russell Quinn. http://www.russellquinn.com
293
282
 
294
- Casein is available to use under the terms of the MIT License. See the LICENSE file for more details.
283
+ Casein is available to use under the terms of the MIT License. See the LICENSE file for more details.
@@ -4,7 +4,7 @@
4
4
 
5
5
  jQuery(document).ready(function() {
6
6
 
7
- if (current_controller) {
7
+ if ("current_controller" in window) {
8
8
  active_tab = $("#tab-" + current_controller);
9
9
  if (active_tab) {
10
10
  active_tab.addClass("active");
@@ -0,0 +1,74 @@
1
+ @import "bootstrap-sprockets";
2
+ @import "bootstrap";
3
+ @import "casein-bootstrap-overrides";
4
+
5
+ body.casein-login {
6
+ padding-top: 0px;
7
+ padding-bottom: 0px;
8
+
9
+ .container-narrow {
10
+ margin: 0 auto;
11
+ max-width: 400px;
12
+ }
13
+
14
+ .alert {
15
+ text-align: center;
16
+ }
17
+
18
+ .brand {
19
+ margin-top: 20px;
20
+ margin-bottom: 40px;
21
+ }
22
+
23
+ .form-group .checkbox-inline label {
24
+ margin-top: 5px;
25
+ margin-bottom: 20px;
26
+ font-weight: normal;
27
+ }
28
+
29
+ .form-group .checkbox-inline input[type="checkbox"] {
30
+ margin-top: 1px;
31
+ }
32
+
33
+ .form-group input {
34
+ text-align: center;
35
+ }
36
+
37
+ .jumbotron {
38
+ padding: 20px;
39
+ margin-bottom: 20px;
40
+ font-size: 14px;
41
+ line-height: 1;
42
+ background-color: #eeeeee;
43
+ text-align: center;
44
+ border-bottom: 1px solid #e5e5e5;
45
+ }
46
+
47
+ footer p {
48
+ font-size: 13px;
49
+ text-align: center;
50
+ color: #888;
51
+ }
52
+
53
+ footer p a {
54
+ color: #555;
55
+ }
56
+
57
+ footer p a:hover {
58
+ color: #000;
59
+ text-decoration: none;
60
+ }
61
+ }
62
+
63
+ @media screen and (min-width: 768px) {
64
+ body.casein-login {
65
+ padding-top: 40px;
66
+ padding-bottom: 20px;
67
+
68
+ .jumbotron {
69
+ border-bottom: 0;
70
+ padding: 20px;
71
+ border-radius: 6px;
72
+ }
73
+ }
74
+ }
@@ -1,8 +1,8 @@
1
1
  module Casein
2
2
  class AdminUserSessionsController < Casein::CaseinController
3
3
 
4
- skip_before_filter :authorise, :only => [:new, :create]
5
- before_filter :requires_no_session_user, :except => [:destroy]
4
+ skip_before_action :authorise, only: [:new, :create]
5
+ before_action :requires_no_session_user, except: [:destroy]
6
6
 
7
7
  layout 'casein_auth'
8
8
 
@@ -11,11 +11,11 @@ module Casein
11
11
  end
12
12
 
13
13
  def create
14
- @admin_user_session = Casein::AdminUserSession.new params[:casein_admin_user_session]
14
+ @admin_user_session = Casein::AdminUserSession.new casein_admin_user_session_params
15
15
  if @admin_user_session.save
16
- redirect_back_or_default :controller => :casein, :action => :index
16
+ redirect_back_or_default controller: :casein, action: :index
17
17
  else
18
- render :action => :new
18
+ render action: :new
19
19
  end
20
20
  end
21
21
 
@@ -28,9 +28,13 @@ module Casein
28
28
 
29
29
  def requires_no_session_user
30
30
  if current_user
31
- redirect_to :controller => :casein, :action => :index
31
+ redirect_to controller: :casein, action: :index
32
32
  end
33
33
  end
34
+
35
+ def casein_admin_user_session_params
36
+ params.require(:casein_admin_user_session).permit(:login, :password, :remember_me)
37
+ end
34
38
 
35
39
  end
36
40
  end
@@ -3,12 +3,12 @@ require 'securerandom'
3
3
  module Casein
4
4
  class AdminUsersController < Casein::CaseinController
5
5
 
6
- before_filter :needs_admin, :except => [:show, :destroy, :update, :update_password]
7
- before_filter :needs_admin_or_current_user, :only => [:show, :destroy, :update, :update_password]
6
+ before_action :needs_admin, except: [:show, :destroy, :update, :update_password]
7
+ before_action :needs_admin_or_current_user, only: [:show, :destroy, :update, :update_password]
8
8
 
9
9
  def index
10
10
  @casein_page_title = "Users"
11
- @users = Casein::AdminUser.order(sort_order(:login)).paginate :page => params[:page]
11
+ @users = Casein::AdminUser.order(sort_order(:login)).paginate page: params[:page]
12
12
  end
13
13
 
14
14
  def new
@@ -28,7 +28,7 @@ module Casein
28
28
  redirect_to casein_admin_users_path
29
29
  else
30
30
  flash.now[:warning] = "There were problems when trying to create a new user"
31
- render :action => :new
31
+ render action: :new
32
32
  end
33
33
  end
34
34
 
@@ -45,14 +45,14 @@ module Casein
45
45
  flash[:notice] = @casein_admin_user.name + " has been updated"
46
46
  else
47
47
  flash.now[:warning] = "There were problems when trying to update this user"
48
- render :action => :show
48
+ render action: :show
49
49
  return
50
50
  end
51
51
 
52
52
  if @session_user.is_admin?
53
53
  redirect_to casein_admin_users_path
54
54
  else
55
- redirect_to :controller => :casein, :action => :index
55
+ redirect_to controller: :casein, action: :index
56
56
  end
57
57
  end
58
58
 
@@ -72,7 +72,7 @@ module Casein
72
72
  flash[:warning] = "The current password is incorrect"
73
73
  end
74
74
 
75
- redirect_to :action => :show
75
+ redirect_to action: :show
76
76
  end
77
77
 
78
78
  def reset_password
@@ -96,7 +96,7 @@ module Casein
96
96
  end
97
97
  end
98
98
 
99
- redirect_to :action => :show
99
+ redirect_to action: :show
100
100
  end
101
101
 
102
102
  def destroy
@@ -113,7 +113,7 @@ module Casein
113
113
  def generate_random_password
114
114
  random_password = random_string = SecureRandom.hex
115
115
  params[:casein_admin_user] = Hash.new if params[:casein_admin_user].blank?
116
- params[:casein_admin_user].merge! ({:password => random_password, :password_confirmation => random_password})
116
+ params[:casein_admin_user].merge! ({ password: random_password, password_confirmation: random_password })
117
117
  end
118
118
 
119
119
  def casein_admin_user_params
@@ -12,8 +12,8 @@ module Casein
12
12
  layout 'casein_main'
13
13
 
14
14
  helper_method :current_admin_user_session, :current_user
15
- before_filter :authorise
16
- before_filter :set_time_zone
15
+ before_action :authorise
16
+ before_action :set_time_zone
17
17
 
18
18
  ActionView::Base.field_error_proc = proc { |input, instance| "#{input}".html_safe }
19
19
 
@@ -51,13 +51,13 @@ module Casein
51
51
 
52
52
  def needs_admin
53
53
  unless @session_user.is_admin?
54
- redirect_to :controller => :casein, :action => :index
54
+ redirect_to controller: :casein, action: :index
55
55
  end
56
56
  end
57
57
 
58
58
  def needs_admin_or_current_user
59
59
  unless @session_user.is_admin? || params[:id].to_i == @session_user.id
60
- redirect_to :controller => :casein, :action => :index
60
+ redirect_to controller: :casein, action: :index
61
61
  end
62
62
  end
63
63
 
@@ -67,7 +67,9 @@ module Casein
67
67
  end
68
68
 
69
69
  def sort_order(default)
70
- "#{(params[:c] || default.to_s).gsub(/[\s;'\"]/,'')} #{'ASC' if params[:d] == 'up'} #{'DESC' if params[:d] == 'down'}"
70
+ column = (params[:c] || default.to_s).gsub(/[\s;'\"]/,'')
71
+ direction = params[:d] == 'down' ? 'DESC' : 'ASC'
72
+ { column => direction }
71
73
  end
72
74
 
73
75
  end
@@ -1,13 +1,13 @@
1
1
  module Casein
2
2
  class PasswordResetsController < Casein::CaseinController
3
3
 
4
- skip_before_filter :authorise
5
- before_filter :load_user_using_perishable_token, :only => [:edit, :update]
4
+ skip_before_action :authorise
5
+ before_action :load_user_using_perishable_token, only: [:edit, :update]
6
6
 
7
7
  layout 'casein_auth'
8
8
 
9
9
  def create
10
- users = Casein::AdminUser.where(:email => params[:recover_email]).all
10
+ users = Casein::AdminUser.where(email: params[:recover_email]).all
11
11
 
12
12
  if users.length > 0
13
13
  users.each do |user|
@@ -46,7 +46,7 @@ module Casein
46
46
  end
47
47
  end
48
48
 
49
- render :action => :edit
49
+ render action: :edit
50
50
  end
51
51
 
52
52
  private
@@ -53,7 +53,7 @@ module Casein
53
53
  def casein_table_cell_link contents, link, options = {}
54
54
 
55
55
  if options.key? :casein_truncate
56
- contents = truncate(contents, :length => options[:casein_truncate], :omission => "...")
56
+ contents = truncate(contents, length: options[:casein_truncate], omission: "...")
57
57
  end
58
58
 
59
59
  link_to "#{contents}".html_safe, link, options
@@ -62,7 +62,7 @@ module Casein
62
62
  def casein_table_cell_no_link contents, options = {}
63
63
 
64
64
  if options.key? :casein_truncate
65
- contents = truncate(contents, :length => options[:casein_truncate], :omission => "...")
65
+ contents = truncate(contents, length: options[:casein_truncate], omission: "...")
66
66
  end
67
67
 
68
68
  "<div class='no-link'>#{contents}</div>".html_safe
@@ -100,7 +100,7 @@ module Casein
100
100
  icon_to_show_html = "<div class='table-header-icon glyphicon glyphicon-#{icon_to_show}'></div>".html_safe
101
101
  end
102
102
  sort_dir = params[:d] == 'down' ? 'up' : 'down'
103
- link_to_unless(condition, title, request.parameters.merge({:c => column, :d => sort_dir})) + icon_to_show_html
103
+ link_to_unless(condition, title, request.parameters.merge({ c: column, d: sort_dir })) + icon_to_show_html
104
104
  end
105
105
 
106
106
  def casein_yes_no_label value
@@ -180,7 +180,7 @@ module Casein
180
180
  casein_form_tag_wrapper(form.time_zone_select(attribute, option_tags, strip_casein_options(options), merged_class_hash(options, 'form-control')), form, obj, attribute, options).html_safe
181
181
  end
182
182
 
183
- #e.g. casein_collection_select f, f.object, :article, :author_id, Author.all, :id, :name, {:prompt => 'Select author'}
183
+ #e.g. casein_collection_select f, f.object, :article, :author_id, Author.all, :id, :name, { prompt: 'Select author' }
184
184
  def casein_collection_select form, obj, object_name, attribute, collection, value_method, text_method, options = {}
185
185
  casein_form_tag_wrapper(collection_select(object_name, attribute, collection, value_method, text_method, strip_casein_options(options), merged_class_hash(options, 'form-control')), form, obj, attribute, options).html_safe
186
186
  end
@@ -271,7 +271,7 @@ module Casein
271
271
  protected
272
272
 
273
273
  def strip_casein_options options
274
- options.reject {|key, value| key.to_s.include? "casein_" }
274
+ options.reject { |key, value| key.to_s.include? "casein_" }
275
275
  end
276
276
 
277
277
  def merged_class_hash options, new_class
@@ -279,7 +279,7 @@ module Casein
279
279
  new_class += " #{options[:class]}"
280
280
  end
281
281
 
282
- {:class => new_class}
282
+ { class: new_class }
283
283
  end
284
284
 
285
285
  def options_hash_with_merged_classes options, new_class
@@ -307,10 +307,10 @@ module Casein
307
307
 
308
308
  if obj && obj.errors[attribute].any?
309
309
  html += "<div class='form-group has-error'>"
310
- html += form.label(attribute, "#{human_attribute_name} #{obj.errors[attribute].first}".html_safe, :class => "control-label")
310
+ html += form.label(attribute, "#{human_attribute_name} #{obj.errors[attribute].first}".html_safe, class: "control-label")
311
311
  else
312
312
  html += "<div class='form-group'>"
313
- html += form.label(attribute, "#{human_attribute_name}#{sublabel}".html_safe, :class => "control-label")
313
+ html += form.label(attribute, "#{human_attribute_name}#{sublabel}".html_safe, class: "control-label")
314
314
  end
315
315
 
316
316
  html += "<div class='well'>#{form_tag}</div></div>"