Sha256: df89fc01236c28e107a9b06f45fd8ae5a9a111ae4ec9304bd4510bcbf019c1b7

Contents?: true

Size: 1.28 KB

Versions: 5

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
  page_title 'Text Fields'

  indented_grid do
    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

5 entries across 5 versions & 1 rubygems

Version Path
voom-presenters-0.1.13 app/demo/components/text_fields.pom
voom-presenters-0.1.12 app/demo/components/text_fields.pom
voom-presenters-0.1.11 app/demo/components/text_fields.pom
voom-presenters-0.1.10 app/demo/components/text_fields.pom
voom-presenters-0.1.9 app/demo/components/text_fields.pom