Module: Admin::PaymentFieldsHelper
- Defined in:
- app/helpers/admin/payment_fields_helper.rb
Instance Method Summary collapse
- #payment_field(form_builder, object, type, method, element, options = {}) ⇒ Object
- #payment_field_with_env(form_builder, object, method, env, element) ⇒ Object
- #payment_fields_with_env(form_builder, object, method, elements) ⇒ Object
Instance Method Details
#payment_field(form_builder, object, type, method, element, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/admin/payment_fields_helper.rb', line 18 def payment_field(form_builder, object, type, method, element, = {}) field_name = serialized_field_name(method, element) raw( form_builder.label(field_name, t(element, :scope => [:helpers, :label, form_builder.object_name, method])) + tag(:br) + case type when :check_box form_builder.send(type, field_name, .merge(:checked => (object[method] and object[method][element] == '1'))) else form_builder.send(type, field_name, .merge(:value => (object[method].nil? ? '' : object[method][element]))) end ) end |
#payment_field_with_env(form_builder, object, method, env, element) ⇒ Object
11 12 13 14 15 16 |
# File 'app/helpers/admin/payment_fields_helper.rb', line 11 def payment_field_with_env(form_builder, object, method, env, element) field_name = serialized_field_name(method, env, element) content_tag(:div, form_builder.label(field_name, t(element, :scope => [:payment, method])), :class => 'grid_3 omega') + content_tag(:div, form_builder.text_field(field_name, :value => (object[method].nil? ? '' : object[method][env][element])), :class => 'grid_4 alpha') + content_tag(:div, '', :class => 'clear') end |
#payment_fields_with_env(form_builder, object, method, elements) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/helpers/admin/payment_fields_helper.rb', line 2 def payment_fields_with_env(form_builder, object, method, elements) %w(development production).map do |env| content_tag(:div, content_tag(:h4, env.capitalize) + elements.map { |element| payment_field_with_env(form_builder, object, method, env, element) }.join('').html_safe, :class => 'grid_7') end.join("\n").html_safe end |