Module: ZipSearch::SimpleFormHelper
- Defined in:
- lib/zip_search/simple_form_helper.rb
Constant Summary collapse
- METHODS_TO_EXPORT =
ZipSearch::ASSOCIATION_MODES.map{|m| :"simple_fields_for_#{m}" }
Class Method Summary collapse
- .simple_fields_for_current_location(fb, title = :current_location, *args, &block) ⇒ Object
- .simple_fields_for_location(fb, title = :location, *args, &block) ⇒ Object
- .simple_fields_for_location_history(fb, title = :location_history, *args, &block) ⇒ Object
- .simple_fields_for_locations(fb, title = :locations, *args, &block) ⇒ Object
- .wrap_zs_fields(fields_content) ⇒ Object
Instance Method Summary collapse
- #simple_fields_for_current_location(*args, &block) ⇒ Object
- #simple_fields_for_location(*args, &block) ⇒ Object
- #simple_fields_for_location_history(*args, &block) ⇒ Object
- #simple_fields_for_locations(*args, &block) ⇒ Object
Class Method Details
.simple_fields_for_current_location(fb, title = :current_location, *args, &block) ⇒ Object
13 14 15 |
# File 'lib/zip_search/simple_form_helper.rb', line 13 def self.simple_fields_for_current_location(fb, title=:current_location, *args, &block) wrap_zs_fields fb.simple_fields_for(title, *args, &block) end |
.simple_fields_for_location(fb, title = :location, *args, &block) ⇒ Object
7 8 9 |
# File 'lib/zip_search/simple_form_helper.rb', line 7 def self.simple_fields_for_location(fb, title=:location, *args, &block) wrap_zs_fields fb.simple_fields_for(title, *args, &block) end |
.simple_fields_for_location_history(fb, title = :location_history, *args, &block) ⇒ Object
16 17 18 |
# File 'lib/zip_search/simple_form_helper.rb', line 16 def self.simple_fields_for_location_history(fb, title=:location_history, *args, &block) wrap_zs_fields fb.simple_fields_for(title, *args, &block) end |
.simple_fields_for_locations(fb, title = :locations, *args, &block) ⇒ Object
10 11 12 |
# File 'lib/zip_search/simple_form_helper.rb', line 10 def self.simple_fields_for_locations(fb, title=:locations, *args, &block) wrap_zs_fields fb.simple_fields_for(title, *args, &block) end |
.wrap_zs_fields(fields_content) ⇒ Object
45 46 47 |
# File 'lib/zip_search/simple_form_helper.rb', line 45 def self.wrap_zs_fields(fields_content) "<div class='zs-location-fields'>#{fields_content}</div>".html_safe end |
Instance Method Details
#simple_fields_for_current_location(*args, &block) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/zip_search/simple_form_helper.rb', line 32 def simple_fields_for_current_location(*args, &block) new_block = block_given? ? block : ->(fb2) { render partial: 'zip_search/simple_fields', locals: { title: :current_location, f: fb2 } } SimpleFormHelper.simple_fields_for_current_location(*args, &new_block) end |
#simple_fields_for_location(*args, &block) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/zip_search/simple_form_helper.rb', line 20 def simple_fields_for_location(*args, &block) new_block = block_given? ? block : ->(fb2) { render partial: 'zip_search/simple_fields', locals: { title: :location, f: fb2 } } SimpleFormHelper.simple_fields_for_location(*args, &new_block) end |
#simple_fields_for_location_history(*args, &block) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/zip_search/simple_form_helper.rb', line 38 def simple_fields_for_location_history(*args, &block) new_block = block_given? ? block : ->(fb2) { render partial: 'zip_search/simple_fields', locals: { title: :location, f: fb2 } } SimpleFormHelper.simple_fields_for_location_history(*args, &new_block) end |
#simple_fields_for_locations(*args, &block) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/zip_search/simple_form_helper.rb', line 26 def simple_fields_for_locations(*args, &block) new_block = block_given? ? block : ->(fb2) { render partial: 'zip_search/simple_fields', locals: { title: :locations, f: fb2 } } SimpleFormHelper.simple_fields_for_locations(*args, &new_block) end |