Sha256: 9c14f67c4f1c304cc42099feaa9e73c043543c0d7a2bf467d0d4fecb5ac2a24f

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

require_relative '../helpers/indented_grid'

Voom::Presenters.define(:text_fields) do
  helpers Demo::Helpers::IndentedGrid
  attach :top_nav
  attach :component_drawer

  indented_grid do
    display 'Text Fields'

    headline 'Text'

    text_field name: :text do
      label 'Text...'
    end

    headline 'Password'

    text_field name: :password, password: true do
      label 'Password'
    end

    headline 'Numeric'

    # Client side validation with hints
    headline 'With Hints'
    text_field name: :numeric do
      label 'Number...'
      pattern /-?[0-9]*(\.[0-9]+)?/
      hint 'Input is not a number!'
    end

    headline 'With Errors'
    text_field name: :guess_me do
      label 'Guess a number...'
      pattern /-?[0-9]*(\.[0-9]+)?/
      value '7'
      error 'Input is not a the right number!'
    end

    card do
      display 'Field Level Events'
      heading 'Text Fields'
      body 'This demonstrates that a change event will submit the  field value to the event action. '\
                 'This works with posts and replace actions'
      text_field name: :myfield do
        label 'Data to post'
        event :change do
          replaces :context_list, :context_list
        end
      end
      attach :context_list
    end
    
    attach :code, file: __FILE__
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
voom-presenters-0.1.8 app/demo/components/text_fields.pom
voom-presenters-0.1.7 app/demo/components/text_fields.pom
voom-presenters-0.1.6 app/demo/components/text_fields.pom
voom-presenters-0.1.5 app/demo/components/text_fields.pom
voom-presenters-0.1.4 app/demo/components/text_fields.pom
voom-presenters-0.1.3 app/demo/components/text_fields.pom
voom-presenters-0.1.2 app/demo/components/text_fields.pom
voom-presenters-0.1.1 app/demo/components/text_fields.pom
voom-presenters-0.1.0 app/demo/components/text_fields.pom