Sha256: 4fa68bb397a72403f12e92f7cd5529e5ccc221ccc7afedeb51660f138e9ed812

Contents?: true

Size: 638 Bytes

Versions: 8

Compression:

Stored size: 638 Bytes

Contents

module EffectiveFormInputsHelper
  def price_to_currency(price)
    price = price || 0
    raise 'price_to_currency expects an Integer representing the number of cents' unless price.kind_of?(Integer)
    number_to_currency(price / 100.0)
  end

  def simple_form_save(form, label = 'Save', options = {}, &block)
    wrapper_options = { class: 'form-actions' }.merge(options.delete(:wrapper_html) || {})
    options = { class: 'btn btn-primary', data: { disable_with: 'Saving...'} }.merge(options)

    content_tag(:div, wrapper_options) do
      form.button(:submit, label, options) + (capture(&block) if block_given?)
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
effective_form_inputs-1.5.0 app/helpers/effective_form_inputs_helper.rb
effective_form_inputs-1.4.1 app/helpers/effective_form_inputs_helper.rb
effective_form_inputs-1.4.0 app/helpers/effective_form_inputs_helper.rb
effective_form_inputs-1.3.0 app/helpers/effective_form_inputs_helper.rb
effective_form_inputs-1.2.9 app/helpers/effective_form_inputs_helper.rb
effective_form_inputs-1.2.8 app/helpers/effective_form_inputs_helper.rb
effective_form_inputs-1.2.7 app/helpers/effective_form_inputs_helper.rb
effective_form_inputs-1.2.6 app/helpers/effective_form_inputs_helper.rb