Permalink
Browse files

Additional top level actions:

* added number & time picker inputs
* fix for new types and form default initialization
  • Loading branch information...
1 parent 0fda9a7 commit 5e84343efb4352ccfd4f490f04d0bb2f83bde613 @elvanja committed Feb 25, 2014
Showing with 10 additions and 1 deletion.
  1. +9 −0 app/helpers/deckhand/templates_helper.rb
  2. +1 −1 lib/deckhand/form.rb
@@ -27,6 +27,13 @@ def angular_input(name, options)
args['type'] = 'file'
args['ng-file-select'] = "onFileSelect($files, '#{name}')"
args.delete('ng-model')
+ elsif options[:type] == Time
+ args.delete('class')
+ elsif options[:type] == Integer
+ args['type'] = 'number'
+ elsif options[:type] == Float
+ args['type'] = 'number'
+ args['step'] = 0.01
elsif options[:choices]
# nothing
else
@@ -43,6 +50,8 @@ def angular_input(name, options)
elsif options[:editable] == {with: :ckeditor}
args['ckeditor'] = true
content_tag :textarea, '', args
+ elsif options[:type] == Time
+ content_tag :div, content_tag(:timepicker), args
else
content_tag :input, '', args
end
@@ -99,7 +99,7 @@ def resolve_value(value, options)
type = options[:type]
if !value and default = options[:default]
- [TrueClass, FalseClass, Array, Hash].include?(default.class) ? default : send(default)
+ [TrueClass, FalseClass, Float, Time, Integer, String, Array, Hash].include?(default.class) ? default : send(default)
elsif type == :boolean
!!value

0 comments on commit 5e84343

Please sign in to comment.