Sha256: 8b4b65ba3a4566abcfba49a376f72d144d30be4baab62df433357597a39c4010

Contents?: true

Size: 1.46 KB

Versions: 12

Compression:

Stored size: 1.46 KB

Contents

require 'date'

Coprl::Presenters.define(:time_fields) do
  helpers Demo::Helpers::IndentedGrid
  attach :top_nav
  attach :component_drawer
  page_title 'Time Field'

  indented_grid do
    body <<~DOC
      A time field separates user display format from the value format.  
      
      The default time user display [format](/formatting_tokens#time) can be configured globally using the following:      
      
      ````
      Coprl::Presenters::Settings.configure do |config|
        config.presenters.components.defaults.time.format = 'h:i K'
      end
      ````
            
      The value format for date times can be the following, they are expected to be in 24 hour time:

      * Ruby Time/DateTime objects.
      * Chronologically Time Strings, e.g., HH:MM
    DOC
    grid do
      column 6 do
        time_field name: :skydive_at,
                       format: 'H:i' do
          label 'Select your time to skydive'
          icon :event
          event :change do
            replaces :context_list, :context_list
          end
        end
      end
      column 6 do
        attach :context_list
      end
    end
    grid do
      column 6 do
        title 'Min Time'
        time_field min_time: "9:00"

        title 'Max Time'
        time_field max_time: "20:00"

        title 'Range'
        time_field min_time: "16:00", max_time: "20:00"

        title '24 hour time'
        time_field time_24hr: true
      end
    end

  end
  attach :code, file: __FILE__
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 app/demo/components/time_fields.pom
coprl-3.0.0.beta.11 app/demo/components/time_fields.pom
coprl-3.0.0.beta.10 app/demo/components/time_fields.pom
coprl-3.0.0.beta.9 app/demo/components/time_fields.pom
coprl-3.0.0.beta.8 app/demo/components/time_fields.pom
coprl-3.0.0.beta.7 app/demo/components/time_fields.pom
coprl-3.0.0.beta.6 app/demo/components/time_fields.pom
coprl-3.0.0.beta.5 app/demo/components/time_fields.pom
coprl-3.0.0.beta.4 app/demo/components/time_fields.pom
coprl-3.0.0.beta.3 app/demo/components/time_fields.pom
coprl-3.0.0.beta.2 app/demo/components/time_fields.pom
coprl-3.0.0.beta.1 app/demo/components/time_fields.pom