cirandas.net

ref: master

plugins/delivery/helpers/delivery_plugin/field_helper.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module DeliveryPlugin::FieldHelper

  protected

  def labelled_field form, field, label, field_html, options = {}
    help = options.delete(:help)
    content_tag :div,
      if form then form.label field, label, class: 'control-label' else label_tag field, label, class: 'control-label' end +
      content_tag('div', help, class: 'help-block') +
      content_tag('div', field_html, class: 'field-box') +
      content_tag('div', '', style: 'clear: both'),
      options.merge(class: options[:class].to_s + ' field form-group')
  end

  def labelled_radio form, field, label_text, value, options = {}
    content_tag :div,
      form.radio_button(field, value) +
      form.label("#{field}_#{value}", label_text) +
      content_tag('div', '', class: 'clean'),
      options.merge(class: options[:class].to_s + ' field-radio form-group')
  end

end