Sha256: a56a296222ea5dea4f2a22239d12fb1cd4bfab18c54abbf8e1b7cc511aa4e13b

Contents?: true

Size: 690 Bytes

Versions: 4

Compression:

Stored size: 690 Bytes

Contents

module MotionPrime
  class TextWithButtonFieldSection < BaseFieldSection
    element :label, type: :label do
      options[:label] || {}
    end
    element :input, type: :text_view do
      {editable: true}.merge(options[:input] || {})
    end
    element :button, type: :button do
      (options[:button] || {}).except(:action)
    end
    element :error_message, type: :error_message, text: proc { observing_errors? and all_errors.join("\n") }

    after_render :bind_text_input
    after_render :bind_button_action

    def bind_button_action
      view(:button).on :touch do
        form.send(options[:button][:action])
      end if options[:button].try(:[], :action)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion-prime-0.3.3 motion-prime/sections/form/text_with_button_field_section.rb
motion-prime-0.3.2 motion-prime/sections/form/text_with_button_field_section.rb
motion-prime-0.3.1 motion-prime/sections/form/text_with_button_field_section.rb
motion-prime-0.3.0 motion-prime/sections/form/text_with_button_field_section.rb