Commit bcc67679ed824549a9b5ffb40a6c262aac4f0874
1 parent
9f3043a6
Exists in
theme-brasil-digital-from-staging
and in
2 other branches
Minor fix to current_date_or_nil variable
Showing
1 changed file
with
5 additions
and
6 deletions
Show diff stats
app/helpers/forms_helper.rb
@@ -50,14 +50,14 @@ module FormsHelper | @@ -50,14 +50,14 @@ module FormsHelper | ||
50 | 50 | ||
51 | def select_city( simple=false ) | 51 | def select_city( simple=false ) |
52 | states = State.find(:all, :order => 'name') | 52 | states = State.find(:all, :order => 'name') |
53 | - | 53 | + |
54 | state_id = 'state-' + FormsHelper.next_id_number | 54 | state_id = 'state-' + FormsHelper.next_id_number |
55 | city_id = 'city-' + FormsHelper.next_id_number | 55 | city_id = 'city-' + FormsHelper.next_id_number |
56 | 56 | ||
57 | if states.length < 1 | 57 | if states.length < 1 |
58 | return | 58 | return |
59 | end | 59 | end |
60 | - | 60 | + |
61 | if simple | 61 | if simple |
62 | states = [State.new(:name => _('Select the State'))] + states | 62 | states = [State.new(:name => _('Select the State'))] + states |
63 | cities = [City.new(:name => _('Select the City'))] | 63 | cities = [City.new(:name => _('Select the City'))] |
@@ -81,7 +81,7 @@ module FormsHelper | @@ -81,7 +81,7 @@ module FormsHelper | ||
81 | states = [State.new(:name => '---')] + states | 81 | states = [State.new(:name => '---')] + states |
82 | cities = [City.new(:name => '---')] | 82 | cities = [City.new(:name => '---')] |
83 | 83 | ||
84 | - html = | 84 | + html = |
85 | content_tag( 'div', | 85 | content_tag( 'div', |
86 | labelled_select( _('State:'), 'state', :id, :name, nil, states, :id => state_id ), | 86 | labelled_select( _('State:'), 'state', :id, :name, nil, states, :id => state_id ), |
87 | :class => 'select_state_for_origin' ) + | 87 | :class => 'select_state_for_origin' ) + |
@@ -89,7 +89,7 @@ module FormsHelper | @@ -89,7 +89,7 @@ module FormsHelper | ||
89 | labelled_select( _('City:'), 'city', :id, :name, nil, cities, :id => city_id ), | 89 | labelled_select( _('City:'), 'city', :id, :name, nil, cities, :id => city_id ), |
90 | :class => 'select_city_for_origin' ) | 90 | :class => 'select_city_for_origin' ) |
91 | end | 91 | end |
92 | - | 92 | + |
93 | html + | 93 | html + |
94 | observe_field( state_id, :update => city_id, :function => "new Ajax.Updater(#{city_id.inspect}, #{url_for(:controller => 'search', :action => 'cities').inspect}, {asynchronous:true, evalScripts:true, parameters:'state_id=' + value}); $(#{city_id.inspect}).innerHTML = '<option>#{_('Loading...')}</option>'", :with => 'state_id') | 94 | observe_field( state_id, :update => city_id, :function => "new Ajax.Updater(#{city_id.inspect}, #{url_for(:controller => 'search', :action => 'cities').inspect}, {asynchronous:true, evalScripts:true, parameters:'state_id=' + value}); $(#{city_id.inspect}).innerHTML = '<option>#{_('Loading...')}</option>'", :with => 'state_id') |
95 | end | 95 | end |
@@ -237,7 +237,7 @@ module FormsHelper | @@ -237,7 +237,7 @@ module FormsHelper | ||
237 | weekHeader: #{datepicker_options[:week_header].to_json}, | 237 | weekHeader: #{datepicker_options[:week_header].to_json}, |
238 | yearRange: #{datepicker_options[:year_range].to_json}, | 238 | yearRange: #{datepicker_options[:year_range].to_json}, |
239 | yearSuffix: #{datepicker_options[:year_suffix].to_json} | 239 | yearSuffix: #{datepicker_options[:year_suffix].to_json} |
240 | - }).datepicker('setDate', current_date_or_nil) | 240 | + }).datepicker('setDate', #{current_date_or_nil}) |
241 | </script> | 241 | </script> |
242 | ".html_safe | 242 | ".html_safe |
243 | result | 243 | result |
@@ -296,4 +296,3 @@ protected | @@ -296,4 +296,3 @@ protected | ||
296 | end | 296 | end |
297 | end | 297 | end |
298 | end | 298 | end |
299 | - |