Module: Locomotive::ContentEntriesHelper
- Defined in:
- app/helpers/locomotive/content_entries_helper.rb
Instance Method Summary collapse
- #options_for_belongs_to_custom_field(class_name) ⇒ Object
-
#push_has_many_form(field) ⇒ Object
Keep track of the form used to create / edit content entries from a has_many custom field.
-
#render_has_many_forms ⇒ String
Render all the forms used to create / edit content entries from a has_many custom field.
Instance Method Details
#options_for_belongs_to_custom_field(class_name) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/locomotive/content_entries_helper.rb', line 30 def (class_name) content_type = Locomotive::ContentType.class_name_to_content_type(class_name, current_site) if content_type content_type.ordered_entries.map { |entry| [entry_label(content_type, entry), entry._id] } else [] # unknown content type end end |
#push_has_many_form(field) ⇒ Object
Keep track of the form used to create / edit content entries from a has_many custom field. Because of formtastic which does not work with embedded forms, we have to render them once we are done with our main form.
11 12 13 |
# File 'app/helpers/locomotive/content_entries_helper.rb', line 11 def push_has_many_form(field) (@has_many_forms ||= []) << field end |
#render_has_many_forms ⇒ String
Render all the forms used to create / edit content entries from a has_many custom field. Because of formtastic which does not work with embedded forms, we have to render them once we are done with our main form.
22 23 24 25 26 27 28 |
# File 'app/helpers/locomotive/content_entries_helper.rb', line 22 def render_has_many_forms return unless @has_many_forms @has_many_forms.map do |field| render 'locomotive/custom_fields/types/has_many_form', field: field end.join("\n").html_safe end |