Module: Bhf::EntriesHelper

Includes:
ActionView::FormOptions
Defined in:
app/helpers/bhf/entries_helper.rb

Instance Method Summary collapse

Methods included from ActionView::FormOptions

#option_groups_from_collection_for_select_with_html_attrs, #options_from_collection_for_select_with_html_attrs

Instance Method Details

#definition_item(object, column, &block) ⇒ Object



9
10
11
# File 'app/helpers/bhf/entries_helper.rb', line 9

def definition_item(object, column, &block)
  render partial: 'bhf/helper/definition_item', locals: {object: object, column: column, content: with_output_buffer(&block)}
end

#node(f, field, &block) ⇒ Object



5
6
7
# File 'app/helpers/bhf/entries_helper.rb', line 5

def node(f, field, &block)
  render partial: 'bhf/helper/node', locals: {f: f, field: field, input: with_output_buffer(&block)}
end

#reflection_node(f, field, &block) ⇒ Object



13
14
15
16
17
18
# File 'app/helpers/bhf/entries_helper.rb', line 13

def reflection_node(f, field, &block)
  return if !f.object.respond_to?(field.reflection.name) || (field.form_type == :static && f.object.new_record? && f.object.send(field.reflection.name).blank?)
  render partial: 'bhf/helper/reflection_node', locals: {
    f: f, field: field, input: with_output_buffer(&block)
  }
end

#reflection_title(f, field, count = 2) ⇒ Object



20
21
22
23
24
25
26
# File 'app/helpers/bhf/entries_helper.rb', line 20

def reflection_title(f, field, count = 2)
  title = f.object.class.human_attribute_name(field.reflection.name)
  if field.link
    title = t("bhf.platforms.#{field.link.name}.title", count: count, default: title)
  end
  title
end