casein 5.1.0.0 → 5.1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ba7770489c1f7bb3656bb6bac034ce469ad6701
4
- data.tar.gz: 51f79ca93f5d7ceb85974e7d47a5b520679743a1
3
+ metadata.gz: 604d193d6504e2b46c79718077a12be4d8afd5b3
4
+ data.tar.gz: e287c45083b2dd34a47ec901aaf23032c75a9ff9
5
5
  SHA512:
6
- metadata.gz: 408ddcb64313158e13d030a34dc5f0e3f482fdeeffa5c28c4fe631dd9dd7c35ee6125ec114588f79b7dd8ba77aae261ec138add0fa2c5bc7413cdd4010121b01
7
- data.tar.gz: a4ae1d0e0f6ea91e4e06362c1ad9b45465ac54f24cf15f8c42cf87eed781bdbc1ae264094a0ed38a30dc3b245ca7423d99b3bfb6a09200ad514430f1e92e3635
6
+ metadata.gz: 063a2b29750d201e6e7ee646788c432dfc93e2a9491e18fe3530e8fba4f66f77b6291ed40510ac082daa62ec4a7a188e43d32e180520f37babf4135152216519
7
+ data.tar.gz: 7160d209b30073f248d5b0985f62037f13d9439b8b76322da7d32f62f9be7ff63454bdae2cd270f9356cb9891c87b2fa7e32404f657b4fa9c16c06d88264bba9
@@ -1,6 +1,6 @@
1
1
  =Casein - a lightweight CMS toolkit for Ruby on Rails, based on Bootstrap
2
2
 
3
- ** ALL-NEW CASEIN 5.1.0 — featuring new responsive UI based on Bootstrap 3.3! **
3
+ ** ALL-NEW CASEIN 5.1.1 — featuring new responsive UI based on Bootstrap 3.3! **
4
4
 
5
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.
6
6
 
@@ -14,25 +14,29 @@ Screenshots at: http://www.caseincms.com
14
14
 
15
15
  This version of Casein is designed for Ruby on Rails 4.x and Ruby 2.x.
16
16
 
17
- Legacy versions:
17
+ ==What’s New in 5.1.1
18
18
 
19
- Rails 3.x: http://github.com/spoiledmilk/casein3
20
- Rails 2.x: http://github.com/spoiledmilk/casein
19
+ Casein 5.1.1 has the following updates:
21
20
 
22
- ==What’s New in 5.1
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
23
25
 
24
- Casein 5.1 has the following updates:
26
+ Version 5.1.1 should be a drop-in replacement for 5.1.0
27
+
28
+ Thanks to @bunnymatic for this release.
29
+
30
+ ==What Was New in 5.1.0
25
31
 
26
32
  * Finally updated to Boostrap 3.3 (all bundled Bootstrap files removed in favor of bootstrap-sass gem)
27
33
  * Rake task to create admin user now takes an optional password
28
- * Authlogic version bumped to 3.4
34
+ * Authlogic version bumped to 3.4.3
29
35
  * UI tweaks
30
36
 
31
- Version 5.1 should be a drop-in replacement for 5.0.
37
+ Version 5.1.0 should be a drop-in replacement for 5.0.0
32
38
 
33
- Thanks to @bunnymatic for help with this release.
34
-
35
- ==What Was New in 5.0
39
+ ==What Was New in 5.0.0
36
40
 
37
41
  * Now based on Bootstrap 3
38
42
  * Complete UI overhaul, now mobile-first
@@ -47,12 +51,12 @@ Thanks to @bunnymatic for help with this release.
47
51
 
48
52
  — Add the Casein gem to your Gemfile:
49
53
 
50
- gem 'casein', '~>5.1.0'
54
+ gem 'casein', '~>5.1.1'
51
55
 
52
56
  — Then use bundler to install Casein and its dependencies:
53
57
 
54
58
  bundle install
55
-
59
+
56
60
  — If you have just created a new project — and don't want to use the default SQLite settings — then remember to add your database details to /config/database.yml at this point.
57
61
 
58
62
  — To enable Casein notification emails (used for new users and forgotten passwords) then add your SMTP server information to your initializers. For development, you can use something cool like MailCatcher (http://mailcatcher.me)
@@ -60,12 +64,12 @@ Thanks to @bunnymatic for help with this release.
60
64
  — Install Casein configuration files into your project. This should not be run more than once without backing up or merging the generated files, as your customisations will be overwritten:
61
65
 
62
66
  rails g casein:install
63
-
67
+
64
68
  — Perform a database migration to create the Casein users table:
65
-
69
+
66
70
  rake db:create (if needed)
67
71
  rake db:migrate
68
-
72
+
69
73
  — Run the following Rake task to set up an initial user. The default username and a random password will be displayed once the task has completed. You should specify your email address and password. (Or omit the password parameter to have a random password assigned.) If you've set up an SMTP server in your Rails environment then you’ll also receive an email notification about the new account.
70
74
 
71
75
  rake casein:users:create_admin email=you@yourdomain.com [password=your_password]
@@ -158,7 +162,7 @@ Once you have the Casein core installed and configured, and have added support f
158
162
  The sidebar in Casein should be used for view specific actions, e.g. "Add user" for users/index, or "Back to list", "Delete user" for users/show.
159
163
 
160
164
  To specify the contents of the sidebar, you must add a 'content_for :sidebar' block in the relevant view file (index, show, etc.) e.g.:
161
-
165
+
162
166
  <%= content_for :sidebar do %>
163
167
  <li><%= link_to "#{casein_show_icon('th-list')}Back to list".html_safe, casein_admin_users_path %></li>
164
168
  <% end %>
@@ -169,7 +173,8 @@ The casein_show_icon function will display any icon from the Glyphicon collectio
169
173
 
170
174
  There are several Casein helper functions that are automatically available in any of your Casein extension views.
171
175
 
172
- <i>TODO: These will be documented later. For now, just browse the casein_helper.rb file to see what’s available.</i>
176
+ <i>NOTE: Not all are documented here. Please browse the casein_helper.rb file to see what’s available that is not listed below.</i>
177
+
173
178
 
174
179
  <b>Casein version</b>
175
180
 
@@ -216,11 +221,25 @@ All of the standard Rails form helpers are available, but the Casein versions ar
216
221
  casein_file_field form, obj, object_name, attribute, options = {}
217
222
  casein_hidden_field form, obj, attribute, options = {}
218
223
  casein_custom_field form, obj, attribute, custom_contents, options = {}
224
+ casein_color_field form, obj, attribute, options = nil
225
+ casein_search_field form, obj, attribute, options = nil
226
+ casein_telephone_field form, obj, attribute, options = nil
227
+ casein_url_field form, obj, attribute, options = nil
228
+ casein_email_field form, obj, attribute, options = nil
229
+ casein_date_field form, obj, attribute, options = nil
230
+ casein_datetime_field form, obj, attribute, options = nil
231
+ casein_datetime_local_field form, obj, attribute, options = nil
232
+ casein_month_field form, obj, attribute, options = nil
233
+ casein_week_field form, obj, attribute, options = nil
234
+ casein_time_field form, obj, attribute, options = nil
235
+ casein_number_field form, obj, attribute, range, step, options = nil
236
+ casein_range_field form, obj, attribute, range, options = nil
237
+
219
238
 
220
239
  For more information on each function, check the app/helpers/casein/casein_helper.rb file within the project. The method parameters are typically the same as the Rails form tag helpers. There are some extra Casein options that can be passed through as part of the options hash:
221
240
 
222
241
  :casein_label – by default the humanized version of the database field name is used as the label, but this will override it with a string of your choice.
223
- :casein_sublabel — add a smaller, clarrifying label to the right of the main label
242
+ :casein_sublabel — add a smaller, clarrifying label to the right of the main label
224
243
  :casein_button_label – available in casein_radio_button and casein_check_box. Used to give individual buttons their labels.
225
244
  :casein_truncate - may be passed into casein_table_cell_link along with a maximum length to automatically truncate strings and suffix with '...'
226
245
 
@@ -252,6 +271,15 @@ e.g.
252
271
 
253
272
  Every Casein user can set their own timezone via their profile. To change the default timezone for new users, set config.time_zone in your app.
254
273
 
274
+ ==Contributing
275
+
276
+ If you contribute, please help us flesh out the test suites. Do not include new methods that you cannot test.
277
+
278
+ To run tests:
279
+
280
+ rake app:db:migrate app:db:test:prepare
281
+ rake spec
282
+
255
283
  ==Disclaimer
256
284
 
257
285
  Casein was created and is maintained by Russell Quinn. http://www.russellquinn.com
data/Rakefile CHANGED
@@ -1,45 +1,33 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rdoc/task'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- desc 'Test the Casein gem.'
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.libs << 'test'
12
- t.pattern = 'test/**/*_test.rb'
13
- t.verbose = true
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
14
5
  end
15
6
 
7
+ require 'rdoc/task'
8
+
16
9
  desc 'Generate documentation for the Casein gem.'
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
10
+ RDoc::Task.new(:rdoc) do |rdoc|
18
11
  rdoc.rdoc_dir = 'rdoc'
19
12
  rdoc.title = 'Casein'
20
13
  rdoc.options << '--line-numbers' << '--inline-source'
21
- rdoc.rdoc_files.include('README')
14
+ rdoc.rdoc_files.include('README.rdoc')
22
15
  rdoc.rdoc_files.include('lib/**/*.rb')
23
16
  end
24
17
 
18
+ Bundler::GemHelper.install_tasks
19
+
25
20
  begin
26
- require "jeweler"
27
- Jeweler::Tasks.new do |gem|
28
- gem.name = "casein"
29
- gem.summary = "A lightweight CMS toolkit for Ruby on Rails, based on Bootstrap."
30
- gem.description = "A lightweight CMS toolkit for Ruby on Rails, based on Bootstrap."
31
- gem.files = Dir["Gemfile", "LICENSE", "Rakefile", "README.rdoc", "PUBLIC_VERSION.yml", "{lib}/**/*", "{app}/**/*", "{config}/**/*"]
32
- gem.email = "mail@russellquinn.com"
33
- gem.authors = ["Russell Quinn"]
34
- gem.license = "MIT"
35
- gem.homepage = "http://www.caseincms.com"
36
- gem.add_dependency("will_paginate", ["3.0.7"])
37
- gem.add_dependency("authlogic", ["3.4.3"])
38
- gem.add_dependency("scrypt", ["1.2.1"])
39
- gem.add_dependency("bootstrap-sass", ["3.3.1"])
40
- gem.add_dependency("sass-rails")
41
- gem.add_dependency("jquery-rails")
42
- end
43
- rescue
44
- puts "Jeweler or one of its dependencies is not installed."
45
- end
21
+ APP_RAKEFILE=File.expand_path('../spec/rails_test_app/Rakefile', __FILE__)
22
+ load 'rails/tasks/engine.rake'
23
+
24
+ Bundler::GemHelper.install_tasks
25
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each{|f| load f}
26
+ require 'rspec/core'
27
+ require 'rspec/core/rake_task'
28
+ RSpec::Core::RakeTask.new(:spec)
29
+ rescue LoadError => ex
30
+ puts "RSpec tasks were unavailable"
31
+ puts "*** #{ex}"
32
+ end
33
+
@@ -1,6 +1,6 @@
1
1
  module Casein
2
2
  module CaseinHelper
3
-
3
+
4
4
  def casein_get_footer_string include_version = false
5
5
  if include_version
6
6
  "Running on #{link_to 'Casein', 'http://www.github.com/russellquinn/casein'} #{casein_get_full_version_string}, an open-source project.".html_safe
@@ -9,40 +9,39 @@ module Casein
9
9
  end
10
10
  end
11
11
 
12
- def casein_get_version_info
13
- YAML::load_file File.join(File.dirname(__FILE__), '..', '..', '..', 'PUBLIC_VERSION.yml')
12
+ def casein_get_version_info
13
+ Casein::VERSION_HASH
14
14
  end
15
-
15
+
16
16
  def casein_get_full_version_string
17
- version_info = casein_get_version_info
18
- "v#{version_info['major']}.#{version_info['minor']}.#{version_info['patch']}.#{version_info['build']}"
17
+ "v#{Casein::VERSION}"
19
18
  end
20
-
19
+
21
20
  def casein_get_short_version_string
22
- version_info = casein_get_version_info
23
- "v#{version_info['major']}"
21
+ version_info = casein_get_version_info
22
+ "v#{version_info[:major]}"
24
23
  end
25
-
24
+
26
25
  def casein_generate_page_title
27
-
26
+
28
27
  if @casein_page_title.nil?
29
28
  return casein_config_website_name
30
29
  end
31
-
32
- casein_config_website_name + " > " + @casein_page_title
30
+
31
+ casein_config_website_name + " > " + @casein_page_title
33
32
  end
34
-
33
+
35
34
  def casein_get_access_level_text level
36
35
  case level
37
- when $CASEIN_USER_ACCESS_LEVEL_ADMIN
38
- return "Administrator"
39
- when $CASEIN_USER_ACCESS_LEVEL_USER
40
- return "User"
41
- else
42
- return "Unknown"
36
+ when $CASEIN_USER_ACCESS_LEVEL_ADMIN
37
+ return "Administrator"
38
+ when $CASEIN_USER_ACCESS_LEVEL_USER
39
+ return "User"
40
+ else
41
+ return "Unknown"
43
42
  end
44
43
  end
45
-
44
+
46
45
  def casein_get_access_level_array
47
46
  [["Administrator", $CASEIN_USER_ACCESS_LEVEL_ADMIN], ["User", $CASEIN_USER_ACCESS_LEVEL_USER]]
48
47
  end
@@ -50,33 +49,33 @@ module Casein
50
49
  def casein_pagination_details objs
51
50
  " <small class='pagination-details'>/ page #{objs.current_page} of #{objs.total_pages}</small>".html_safe if objs.current_page && objs.total_pages > 1
52
51
  end
53
-
52
+
54
53
  def casein_table_cell_link contents, link, options = {}
55
-
54
+
56
55
  if options.key? :casein_truncate
57
56
  contents = truncate(contents, :length => options[:casein_truncate], :omission => "...")
58
57
  end
59
-
58
+
60
59
  link_to "#{contents}".html_safe, link, options
61
60
  end
62
-
61
+
63
62
  def casein_table_cell_no_link contents, options = {}
64
-
63
+
65
64
  if options.key? :casein_truncate
66
65
  contents = truncate(contents, :length => options[:casein_truncate], :omission => "...")
67
66
  end
68
-
67
+
69
68
  "<div class='no-link'>#{contents}</div>".html_safe
70
69
  end
71
70
 
72
71
  def casein_span_icon icon_name
73
- "<span class='glyphicon glyphicon-#{icon_name}' title='#{icon_name.titleize}'></span>"
72
+ "<span class='glyphicon glyphicon-#{icon_name}' title='#{icon_name.titleize}'></span>"
74
73
  end
75
-
74
+
76
75
  def casein_show_icon icon_name
77
76
  "<div class='icon'>#{casein_span_icon icon_name}</div>".html_safe
78
77
  end
79
-
78
+
80
79
  def casein_show_row_icon icon_name
81
80
  "<div class='iconRow'>#{casein_span_icon icon_name}</div>".html_safe
82
81
  end
@@ -119,73 +118,73 @@ module Casein
119
118
  return "<span class='label label-success'>No</span>".html_safe
120
119
  end
121
120
  end
122
-
121
+
123
122
  # Styled form tag helpers
124
-
123
+
125
124
  def casein_text_field form, obj, attribute, options = {}
126
125
  casein_form_tag_wrapper(form.text_field(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'form-control'))), form, obj, attribute, options).html_safe
127
126
  end
128
-
127
+
129
128
  def casein_password_field form, obj, attribute, options = {}
130
129
  casein_form_tag_wrapper(form.password_field(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'form-control'))), form, obj, attribute, options).html_safe
131
130
  end
132
-
131
+
133
132
  def casein_text_area form, obj, attribute, options = {}
134
133
  casein_form_tag_wrapper(form.text_area(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'form-control'))), form, obj, attribute, options).html_safe
135
134
  end
136
-
135
+
137
136
  def casein_text_area_big form, obj, attribute, options = {}
138
- casein_form_tag_wrapper(form.text_area(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'form-control'))), form, obj, attribute, options).html_safe
137
+ casein_form_tag_wrapper(form.text_area(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'form-control'))), form, obj, attribute, options).html_safe
139
138
  end
140
-
139
+
141
140
  def casein_check_box form, obj, attribute, options = {}
142
141
  form_tag = "<div class='check-box'>#{form.check_box(attribute, strip_casein_options(options))}</div>".html_safe
143
142
  casein_form_tag_wrapper(form_tag, form, obj, attribute, options).html_safe
144
143
  end
145
-
144
+
146
145
  def casein_check_box_group form, obj, check_boxes = {}
147
146
  form_tags = ""
148
-
147
+
149
148
  for check_box in check_boxes
150
149
  form_tags += casein_check_box form, obj, check_box[0], check_box[1]
151
150
  end
152
-
151
+
153
152
  casein_form_tag_wrapper(form_tag, form, obj, attribute, options)
154
153
  end
155
-
154
+
156
155
  def casein_radio_button form, obj, attribute, tag_value, options = {}
157
156
  form_tag = form.radio_button(obj, attribute, tag_value, strip_casein_options(options))
158
-
157
+
159
158
  if options.key? :casein_button_label
160
159
  form_tag = "<div>" + form_tag + "<span class=\"rcText\">#{options[:casein_button_label]}</span></div>".html_safe
161
160
  end
162
-
161
+
163
162
  casein_form_tag_wrapper(form_tag, form, obj, attribute, options).html_safe
164
163
  end
165
-
164
+
166
165
  def casein_radio_button_group form, obj, radio_buttons = {}
167
166
  form_tags = ""
168
-
167
+
169
168
  for radio_button in radio_buttons
170
169
  form_tags += casein_radio_button form, obj, check_box[0], check_box[1], check_box[2]
171
170
  end
172
-
171
+
173
172
  casein_form_tag_wrapper(form_tag, form, obj, attribute, options).html_safe
174
173
  end
175
-
174
+
176
175
  def casein_select form, obj, attribute, option_tags, options = {}
177
176
  casein_form_tag_wrapper(form.select(attribute, option_tags, strip_casein_options(options), merged_class_hash(options, 'form-control')), form, obj, attribute, options).html_safe
178
177
  end
179
-
178
+
180
179
  def casein_time_zone_select form, obj, attribute, option_tags, options = {}
181
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
182
181
  end
183
-
182
+
184
183
  #e.g. casein_collection_select f, f.object, :article, :author_id, Author.all, :id, :name, {:prompt => 'Select author'}
185
184
  def casein_collection_select form, obj, object_name, attribute, collection, value_method, text_method, options = {}
186
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
187
186
  end
188
-
187
+
189
188
  def casein_date_select form, obj, attribute, options = {}
190
189
  casein_form_tag_wrapper("<div class='casein-date-select'>".html_safe + form.date_select(attribute, strip_casein_options(options), merged_class_hash(options, 'form-control')) + "</div>".html_safe, form, obj, attribute, options).html_safe
191
190
  end
@@ -193,14 +192,14 @@ module Casein
193
192
  def casein_time_select form, obj, attribute, options = {}
194
193
  casein_form_tag_wrapper("<div class='casein-time-select'>".html_safe + form.time_select(attribute, strip_casein_options(options), merged_class_hash(options, 'form-control')) + "</div>".html_safe, form, obj, attribute, options).html_safe
195
194
  end
196
-
195
+
197
196
  def casein_datetime_select form, obj, attribute, options = {}
198
197
  casein_form_tag_wrapper("<div class='casein-datetime-select'>".html_safe + form.datetime_select(attribute, strip_casein_options(options), merged_class_hash(options, 'form-control')) + "</div>".html_safe, form, obj, attribute, options).html_safe
199
198
  end
200
-
199
+
201
200
  def casein_file_field form, obj, object_name, attribute, options = {}
202
201
  class_hash = merged_class_hash(options, 'form-control')
203
- contents = "<div class='#{class_hash[:class]}'>" + file_field(object_name, attribute, strip_casein_options(options)) + '</div>'
202
+ contents = "<div class='#{class_hash[:class]}'>" + form.file_field(attribute, strip_casein_options(options)) + '</div>'
204
203
 
205
204
  if options.key? :casein_contents_preview
206
205
  contents = options[:casein_contents_preview].html_safe + contents.html_safe
@@ -208,7 +207,7 @@ module Casein
208
207
 
209
208
  casein_form_tag_wrapper(contents, form, obj, attribute, options).html_safe
210
209
  end
211
-
210
+
212
211
  def casein_hidden_field form, obj, attribute, options = {}
213
212
  form.hidden_field(attribute, strip_casein_options(options)).html_safe
214
213
  end
@@ -216,21 +215,95 @@ module Casein
216
215
  def casein_custom_field form, obj, attribute, custom_contents, options = {}
217
216
  casein_form_tag_wrapper(custom_contents, form, obj, attribute, options).html_safe
218
217
  end
219
-
220
- protected
218
+
219
+ def casein_color_field form, obj, attribute, options = nil
220
+ options ||= {}
221
+ casein_wrapped_field :color_field, form, obj, attribute, options
222
+ end
223
+
224
+ def casein_search_field form, obj, attribute, options = nil
225
+ options ||= {}
226
+ casein_wrapped_field :search_field, form, obj, attribute, options
227
+ end
228
+
229
+ def casein_telephone_field form, obj, attribute, options = nil
230
+ options ||= {}
231
+ casein_wrapped_field :telephone_field, form, obj, attribute, options
232
+ end
233
+
234
+ def casein_url_field form, obj, attribute, options = nil
235
+ options ||= {}
236
+ casein_wrapped_field :url_field, form, obj, attribute, options
237
+ end
238
+
239
+ def casein_email_field form, obj, attribute, options = nil
240
+ options ||= {}
241
+ casein_wrapped_field :email_field, form, obj, attribute, options
242
+ end
243
+
244
+ def casein_date_field form, obj, attribute, options = nil
245
+ options ||= {}
246
+ casein_wrapped_field :date_field, form, obj, attribute, options
247
+ end
248
+
249
+ def casein_datetime_field form, obj, attribute, options = nil
250
+ options ||= {}
251
+ casein_wrapped_field :datetime_field, form, obj, attribute, options
252
+ end
253
+
254
+ def casein_datetime_local_field form, obj, attribute, options = nil
255
+ options ||= {}
256
+ casein_wrapped_field :datetime_local_field, form, obj, attribute, options
257
+ end
258
+
259
+ def casein_month_field form, obj, attribute, options = nil
260
+ options ||= {}
261
+ casein_wrapped_field :month_field, form, obj, attribute, options
262
+ end
263
+
264
+ def casein_week_field form, obj, attribute, options = nil
265
+ options ||= {}
266
+ casein_wrapped_field :week_field, form, obj, attribute, options
267
+ end
268
+
269
+ def casein_time_field form, obj, attribute, options = nil
270
+ options ||= {}
271
+ casein_wrapped_field :time_field, form, obj, attribute, options
272
+ end
273
+
274
+ def casein_number_field form, obj, attribute, range, step, options = nil
275
+ options ||= {}
276
+ casein_wrapped_field :number_field, form, obj, attribute, {in: range, step: step}.merge(options)
277
+ end
278
+
279
+ def casein_range_field form, obj, attribute, range, options = nil
280
+ options ||= {}
281
+ casein_wrapped_field :range_field, form, obj, attribute, {in: range}.merge(options)
282
+ end
283
+
284
+
285
+ protected
286
+
287
+ def casein_wrapped_field field_helper_method, form, obj, attribute, options
288
+ clz = "casein-" + field_helper_method.to_s.gsub(/_field$/,'').gsub('_', '-')
289
+ contents = content_tag 'div', class: clz do
290
+ form.send(field_helper_method, attribute, strip_casein_options(options))
291
+ end
292
+ casein_form_tag_wrapper(contents.html_safe, form, obj, attribute, options).html_safe
293
+ end
221
294
 
222
295
  def strip_casein_options options
223
- options.reject {|key, value| key.to_s.include? "casein_" }
296
+ (options || {}).reject {|key, value| key.to_s.include? "casein_" }
224
297
  end
225
-
298
+
226
299
  def merged_class_hash options, new_class
227
300
  if options.key? :class
228
301
  new_class += " #{options[:class]}"
229
302
  end
230
-
303
+
231
304
  {:class => new_class}
232
305
  end
233
-
306
+
234
307
  def options_hash_with_merged_classes options, new_class
235
308
  if options.key? :class
236
309
  new_class += " #{options[:class]}"
@@ -239,30 +312,31 @@ module Casein
239
312
  options
240
313
  end
241
314
 
242
- def casein_form_tag_wrapper form_tag, form, obj, attribute, options = {}
243
- unless options.key? :casein_label
244
- human_attribute_name = attribute.to_s.humanize
245
- else
246
- human_attribute_name = options[:casein_label]
247
- end
315
+ def casein_form_tag_wrapper form_tag, form, obj, attribute, options = nil
316
+ options ||= {}
317
+ unless options.key? :casein_label
318
+ human_attribute_name = attribute.to_s.humanize
319
+ else
320
+ human_attribute_name = options[:casein_label]
321
+ end
248
322
 
249
- sublabel = ""
323
+ sublabel = ""
250
324
 
251
- if options.key? :casein_sublabel
252
- sublabel = " <small>#{options[:casein_sublabel]}</small>".html_safe
253
- end
325
+ if options.key? :casein_sublabel
326
+ sublabel = " <small>#{options[:casein_sublabel]}</small>".html_safe
327
+ end
254
328
 
255
- html = ""
329
+ html = ""
256
330
 
257
- if obj && obj.errors[attribute].any?
258
- html += "<div class='form-group has-error'>"
259
- html += form.label(attribute, "#{human_attribute_name} #{obj.errors[attribute].first}".html_safe, :class => "control-label")
260
- else
261
- html += "<div class='form-group'>"
262
- html += form.label(attribute, "#{human_attribute_name}#{sublabel}".html_safe, :class => "control-label")
263
- end
331
+ if obj && obj.errors[attribute].any?
332
+ html += "<div class='form-group has-error'>"
333
+ html += form.label(attribute, "#{human_attribute_name} #{obj.errors[attribute].first}".html_safe, :class => "control-label")
334
+ else
335
+ html += "<div class='form-group'>"
336
+ html += form.label(attribute, "#{human_attribute_name}#{sublabel}".html_safe, :class => "control-label")
337
+ end
264
338
 
265
- html += "<div class='well'>#{form_tag}</div></div>"
339
+ html += "<div class='well'>#{form_tag}</div></div>"
266
340
  end
267
341
  end
268
- end
342
+ end
@@ -0,0 +1,2 @@
1
+ module Casein
2
+ end
@@ -1,8 +1,9 @@
1
1
  module Casein
2
2
  class AdminUserSession < ::Authlogic::Session::Base
3
3
  include ActiveModel::Conversion
4
+ extend ActiveModel::Naming
4
5
  def persisted?
5
6
  false
6
7
  end
7
8
  end
8
- end
9
+ end
@@ -53,4 +53,4 @@
53
53
  <%= submit_tag "Reset password", :class => "btn btn-primary btn-lg btn-block" %>
54
54
  </div>
55
55
  </div>
56
- <% end %>
56
+ <% end %>
@@ -10,11 +10,11 @@ Rails.application.routes.draw do
10
10
  end
11
11
  end
12
12
 
13
- resource :admin_user_session
13
+ resource :admin_user_session, :only => [:new, :create, :destroy]
14
14
  resource :password_reset, :only => [:create, :edit, :update]
15
15
 
16
16
  match "/blank" => "casein#blank", :via => :get
17
17
  root :to => "casein#index"
18
18
  end
19
19
 
20
- end
20
+ end
@@ -12,7 +12,14 @@ module Casein
12
12
  rake_tasks do
13
13
  load "railties/tasks.rake"
14
14
  end
15
-
15
+
16
+ config.generators do |g|
17
+ g.test_framework :rspec, fixture: false
18
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
19
+ g.assets false
20
+ g.helper false
21
+ end
22
+
16
23
  end
17
24
 
18
25
  class RouteConstraint
@@ -24,4 +31,4 @@ module Casein
24
31
  end
25
32
 
26
33
  end
27
- end
34
+ end
@@ -0,0 +1,4 @@
1
+ module Casein
2
+ VERSION_HASH = { major: 5, minor: 1, patch: 1, build: 0 }
3
+ VERSION = VERSION_HASH.values.join(".")
4
+ end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casein
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0.0
4
+ version: 5.1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Quinn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: casein
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: will_paginate
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +30,14 @@ dependencies:
44
30
  requirements:
45
31
  - - '='
46
32
  - !ruby/object:Gem::Version
47
- version: 3.4.3
33
+ version: 3.4.4
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - '='
53
39
  - !ruby/object:Gem::Version
54
- version: 3.4.3
40
+ version: 3.4.4
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: scrypt
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,17 +94,72 @@ dependencies:
108
94
  - - ">="
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: capybara-rails
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: sqlite3
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
111
153
  description: A lightweight CMS toolkit for Ruby on Rails, based on Bootstrap.
112
- email: mail@russellquinn.com
154
+ email:
155
+ - mail@russellquinn.com
113
156
  executables: []
114
157
  extensions: []
115
158
  extra_rdoc_files:
116
159
  - LICENSE
117
160
  - README.rdoc
118
161
  files:
119
- - Gemfile
120
162
  - LICENSE
121
- - PUBLIC_VERSION.yml
122
163
  - README.rdoc
123
164
  - Rakefile
124
165
  - app/assets/images/casein/casein.png
@@ -133,6 +174,7 @@ files:
133
174
  - app/controllers/casein/password_resets_controller.rb
134
175
  - app/helpers/casein/casein_helper.rb
135
176
  - app/mailers/casein/casein_notification.rb
177
+ - app/models/casein.rb
136
178
  - app/models/casein/admin_user.rb
137
179
  - app/models/casein/admin_user_session.rb
138
180
  - app/views/casein/admin_user_sessions/new.html.erb
@@ -150,6 +192,7 @@ files:
150
192
  - config/routes.rb
151
193
  - lib/casein.rb
152
194
  - lib/casein/engine.rb
195
+ - lib/casein/version.rb
153
196
  - lib/generators/casein/install/USAGE
154
197
  - lib/generators/casein/install/install_generator.rb
155
198
  - lib/generators/casein/install/templates/app/assets/javascripts/casein/custom.js
@@ -170,7 +213,7 @@ files:
170
213
  - lib/generators/casein/scaffold/templates/views/new.html.erb
171
214
  - lib/generators/casein/scaffold/templates/views/show.html.erb
172
215
  - lib/railties/tasks.rake
173
- homepage: http://www.caseincms.com
216
+ homepage: http://www.caseincms.com/
174
217
  licenses:
175
218
  - MIT
176
219
  metadata: {}
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
@@ -1,4 +0,0 @@
1
- major: 5
2
- minor: 1
3
- patch: 0
4
- build: 0