Class: PagesCore::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, LabelledFormBuilder
Defined in:
app/helpers/pages_core/form_builder.rb

Direct Known Subclasses

Admin::FormBuilder

Instance Method Summary collapse

Methods included from LabelledFormBuilder

#field_with_label, #label_and_errors, #label_for, #labelled_check_box, #labelled_country_select, #labelled_date_select, #labelled_datetime_select, #labelled_file_field, #labelled_image_file_field, #labelled_password_field, #labelled_select, #labelled_text_area, #labelled_text_field, #labelled_time_select

Instance Method Details

#image_file_field(attribute, options = {}) ⇒ Object



17
18
19
# File 'app/helpers/pages_core/form_builder.rb', line 17

def image_file_field(attribute, options = {})
  safe_join [image_file_preview(attribute), file_field(attribute, options)]
end

#image_file_preview(attribute) ⇒ Object



8
9
10
11
12
13
14
15
# File 'app/helpers/pages_core/form_builder.rb', line 8

def image_file_preview(attribute)
  return "" unless object.send(attribute) &&
                   !object.send(attribute).new_record?

  tag.p(
    @template.dynamic_image_tag(object.send(attribute), size: "120x100")
  )
end