active_scaffold 3.1.9 → 3.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -165,7 +165,7 @@ module ActiveScaffold::Actions
165
165
  params = params[:record] || {} unless params[model.inheritance_column] # in create action must be inside record key
166
166
  model = params.delete(model.inheritance_column).camelize.constantize if params[model.inheritance_column]
167
167
  end
168
- model.new(build_options || {})
168
+ model.respond_to?(:build) ? model.build(build_options || {}) : model.new
169
169
  end
170
170
 
171
171
  private
@@ -33,29 +33,25 @@ module ActiveScaffold::Bridges
33
33
 
34
34
  def self.date_options(locale)
35
35
  begin
36
- date_options = I18n.translate! 'date', :locale => locale
37
36
  date_picker_options = { :closeText => as_(:close),
38
37
  :prevText => as_(:previous),
39
38
  :nextText => as_(:next),
40
39
  :currentText => as_(:today),
41
- :monthNames => date_options[:month_names][1, (date_options[:month_names].length - 1)],
42
- :monthNamesShort => date_options[:abbr_month_names][1, (date_options[:abbr_month_names].length - 1)],
43
- :dayNames => date_options[:day_names],
44
- :dayNamesShort => date_options[:abbr_day_names],
45
- :dayNamesMin => date_options[:abbr_day_names],
40
+ :monthNames => I18n.translate!('date.month_names', :locale => locale)[1..-1],
41
+ :monthNamesShort => I18n.translate!('date.abbr_month_names', :locale => locale)[1..-1],
42
+ :dayNames => I18n.translate!('date.day_names', :locale => locale),
43
+ :dayNamesShort => I18n.translate!('date.abbr_day_names', :locale => locale),
44
+ :dayNamesMin => I18n.translate!('date.abbr_day_names', :locale => locale),
46
45
  :changeYear => true,
47
46
  :changeMonth => true,
48
47
  }
49
48
 
50
- begin
51
- as_date_picker_options = I18n.translate! 'active_scaffold.date_picker_options'
52
- date_picker_options.merge!(as_date_picker_options) if as_date_picker_options.is_a? Hash
53
- rescue
54
- Rails.logger.warn "ActiveScaffold: Missing date picker localization for your locale: #{locale}"
55
- end
49
+ as_date_picker_options = I18n.translate! :date_picker_options, :scope => :active_scaffold, :locale => locale, :default => ''
50
+ date_picker_options.merge!(as_date_picker_options) if as_date_picker_options.is_a? Hash
51
+ Rails.logger.warn "ActiveScaffold: Missing date picker localization for your locale: #{locale}" if as_date_picker_options.blank?
56
52
 
57
- js_format = self.to_datepicker_format(date_options[:formats][:default])
58
- date_picker_options[:dateFormat] = js_format unless js_format.nil?
53
+ js_format = self.to_datepicker_format(I18n.translate!('date.formats.default', :locale => locale, :default => ''))
54
+ date_picker_options[:dateFormat] = js_format unless js_format.blank?
59
55
  date_picker_options
60
56
  rescue
61
57
  raise if locale == I18n.locale
@@ -76,19 +72,15 @@ module ActiveScaffold::Bridges
76
72
  def self.datetime_options(locale)
77
73
  begin
78
74
  rails_time_format = I18n.translate! 'time.formats.picker', :locale => locale
79
- datetime_options = I18n.translate! 'datetime.prompts', :locale => locale
80
75
  datetime_picker_options = {:ampm => false,
81
- :hourText => datetime_options[:hour],
82
- :minuteText => datetime_options[:minute],
83
- :secondText => datetime_options[:second],
76
+ :hourText => I18n.translate!('datetime.prompts.hour', :locale => locale),
77
+ :minuteText => I18n.translate!('datetime.prompts.minute', :locale => locale),
78
+ :secondText => I18n.translate!('datetime.prompts.second', :locale => locale)
84
79
  }
85
80
 
86
- begin
87
- as_datetime_picker_options = I18n.translate! 'active_scaffold.datetime_picker_options'
88
- datetime_picker_options.merge!(as_datetime_picker_options) if as_datetime_picker_options.is_a? Hash
89
- rescue
90
- Rails.logger.warn "ActiveScaffold: Missing datetime picker localization for your locale: #{locale}"
91
- end
81
+ as_datetime_picker_options = I18n.translate! :datetime_picker_options, :scope => :active_scaffold, :locale => locale, :default => ''
82
+ datetime_picker_options.merge!(as_datetime_picker_options) if as_datetime_picker_options.is_a? Hash
83
+ Rails.logger.warn "ActiveScaffold: Missing datetime picker localization for your locale: #{locale}" if as_datetime_picker_options.blank?
92
84
 
93
85
  date_format, time_format = self.split_datetime_format(self.to_datepicker_format(rails_time_format))
94
86
  datetime_picker_options[:dateFormat] = date_format unless date_format.nil?
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- PATCH = 9
5
+ PATCH = 10
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 9
10
- version: 3.1.9
9
+ - 10
10
+ version: 3.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-14 00:00:00 Z
18
+ date: 2011-11-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -100,8 +100,8 @@ files:
100
100
  - app/assets/javascripts/active_scaffold.js.erb
101
101
  - app/assets/javascripts/jquery/active_scaffold.js
102
102
  - app/assets/javascripts/jquery/date_picker_bridge.js.erb
103
- - app/assets/javascripts/jquery/jquery.editinplace.js
104
103
  - app/assets/javascripts/jquery/draggable_lists.js
104
+ - app/assets/javascripts/jquery/jquery.editinplace.js
105
105
  - app/assets/javascripts/jquery/active_scaffold.js~
106
106
  - app/assets/javascripts/jquery/draggable_lists.js~
107
107
  - app/assets/javascripts/prototype/active_scaffold.js
@@ -159,7 +159,7 @@ files:
159
159
  - frontends/default/views/add_existing_form.html.erb
160
160
  - frontends/default/views/create.html.erb
161
161
  - frontends/default/views/_human_conditions.html.erb
162
- - frontends/default/views/_horizontal_subform_footer.html.erb
162
+ - frontends/default/views/_list_with_header.html.erb
163
163
  - frontends/default/views/field_search.html.erb
164
164
  - frontends/default/views/_render_field.js.erb
165
165
  - frontends/default/views/search.html.erb
@@ -168,10 +168,10 @@ files:
168
168
  - frontends/default/views/_list_pagination.html.erb
169
169
  - frontends/default/views/_list_record_columns.html.erb
170
170
  - frontends/default/views/show.html.erb
171
- - frontends/default/views/_list_with_header.html.erb
171
+ - frontends/default/views/destroy.js.erb
172
172
  - frontends/default/views/_search_attribute.html.erb
173
173
  - frontends/default/views/action_confirmation.html.erb
174
- - frontends/default/views/destroy.js.erb
174
+ - frontends/default/views/_horizontal_subform_footer.html.erb
175
175
  - frontends/default/views/edit_associated.js.erb
176
176
  - frontends/default/views/form_messages.js.erb
177
177
  - frontends/default/views/mark.js.rjs
@@ -181,8 +181,8 @@ files:
181
181
  - frontends/default/views/on_update.js.erb
182
182
  - frontends/default/views/render_field.js.erb
183
183
  - frontends/default/views/update_column.js.erb
184
- - frontends/default/views/update_row.js.erb
185
184
  - frontends/default/views/_base_form.html.erb~
185
+ - frontends/default/views/update_row.js.erb
186
186
  - frontends/default/views/_form.html.erb~
187
187
  - frontends/default/views/_row.html.erb~
188
188
  - frontends/default/views/render_field.js.erb~
@@ -375,8 +375,8 @@ files:
375
375
  - vendor/assets/images/ui-icons_ef8c08_256x240.png
376
376
  - vendor/assets/images/ui-icons_ffd27a_256x240.png
377
377
  - vendor/assets/images/ui-icons_ffffff_256x240.png
378
- - vendor/assets/stylesheets/jquery-ui.css
379
378
  - vendor/assets/javascripts/jquery-ui-timepicker-addon.js
379
+ - vendor/assets/stylesheets/jquery-ui.css
380
380
  - MIT-LICENSE
381
381
  - CHANGELOG
382
382
  - README