Sha256: 0a9e5ad6118c552d1d356c9c411ddc8da54913f566037cdeb1b726f60ad67811

Contents?: true

Size: 857 Bytes

Versions: 52

Compression:

Stored size: 857 Bytes

Contents

# -*- encoding : utf-8 -*-
InlineForms::SPECIAL_COLUMN_TYPES[:radio_button]=:integer
# radio buttons are integers in this version
# us like this:
#   [ :sex , "gender", :radio_button, { 1 => 'male', 2 => 'female' } ],

def radio_button_show(object, attribute)
  values = attribute_values(object, attribute)
  link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : ""
end

def radio_button_edit(object, attribute)
  out ='<ul class="radio_list">'
  values = attribute_values(object, attribute)
  values.each do |key,value|
    out << '<li>'
    out << radio_button_tag(attribute.to_s, key, key == object.send(attribute))
    out << value
    out << '</li>'
  end
  out << '</ul>'
  raw out
end

def radio_button_update(object, attribute)
  object[attribute.to_s.to_sym] = params[attribute.to_s.to_sym]
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
inline_forms-1.6.50 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.49 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.48 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.47 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.46 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.45 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.44 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.43 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.42 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.41 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.40 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.39 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.38 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.37 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.36 lib/app/helpers/form_elements/radio_button.rb
inline_forms-1.6.35 lib/app/helpers/form_elements/radio_button.rb
inline_forms-2.23 lib/app/helpers/form_elements/radio_button.rb
inline_forms-2.22 lib/app/helpers/form_elements/radio_button.rb
inline_forms-2.21 lib/app/helpers/form_elements/radio_button.rb
inline_forms-2.2 lib/app/helpers/form_elements/radio_button.rb