Sha256: f4ff82010db76cea02e0aa41a63cde0328f7c5d3e87abf2304bbcc7fa5885538

Contents?: true

Size: 715 Bytes

Versions: 9

Compression:

Stored size: 715 Bytes

Contents

module InlineFormsHelper
    InlineForms::SPECIAL_MIGRATION_TYPES[:range]=:integer
  # range
  def range_show(object, attribute, values)
    link_to_inline_edit object, attribute, object.send(attribute), nil
  end
  def range_edit(object, attribute, values)
    # the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
    collection_select( ('_' + object.class.to_s.downcase).to_sym, attribute.to_sym, values, 'to_i', 'to_s', :selected => object.send(attribute))
  end
  def range_update(object, attribute, values)
    object[attribute.to_sym] = params[('_' + object.class.to_s.downcase).to_sym][attribute.to_sym]
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
inline_forms-0.7.2 app/helpers/form_elements/range.rb
inline_forms-0.7.1 app/helpers/form_elements/range.rb
inline_forms-0.7.0 app/helpers/form_elements/range.rb
inline_forms-0.6.5 app/helpers/form_elements/range.rb
inline_forms-0.6.4 app/helpers/form_elements/range.rb
inline_forms-0.6.3 app/helpers/form_elements/range.rb
inline_forms-0.6.2 app/helpers/form_elements/range.rb
inline_forms-0.6.1 app/helpers/form_elements/range.rb
inline_forms-0.6.0 app/helpers/form_elements/range.rb