effective_form_inputs 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ / this gives me a mechanism to test the inputs easily on a site with effective style_guide installed
2
+
3
+ = form_for Effective::StyleGuide.new(), :url => '/' do |f|
4
+ = f.effective_date_time_picker :updated_at
@@ -0,0 +1,7 @@
1
+ require "effective_form_inputs/form_inputs"
2
+ require "effective_form_inputs/engine"
3
+ require "effective_form_inputs/version"
4
+
5
+ module EffectiveFormInputs
6
+ REJECTED_INPUT_JS_OPTIONS = [:as, :hint, :error, :readonly, :disabled, :required, :label, :inline_label, :placeholder, :prompt, :min_max, :maxlength, :pattern, :input_html, :wrapper_html, :error_html, :id, :wrapper, :collection]
7
+ end
@@ -0,0 +1,22 @@
1
+ module EffectiveFormInputs
2
+ class Engine < ::Rails::Engine
3
+ engine_name 'effective_form_inputs'
4
+
5
+ config.autoload_paths += Dir["#{config.root}/app/models/**/"]
6
+
7
+ initializer 'effective_orders.action_view' do |app|
8
+ ActiveSupport.on_load :action_view do
9
+ ActionView::Helpers::FormBuilder.send(:include, EffectiveFormInputs::FormInputs)
10
+
11
+ # Going to have to add each custom namespace to SimpleForm
12
+ if defined?(SimpleForm)
13
+ SimpleForm.setup do |config|
14
+ config.custom_inputs_namespaces << 'EffectiveDateTimePicker'
15
+ end
16
+ end
17
+
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module EffectiveFormInputs
2
+ module FormInputs
3
+ def effective_date_time_picker(method, options = {})
4
+ Inputs::EffectiveDateTimePicker::Field.new(@object, @object_name, @template, method, merged_input_js_options(options)).to_html
5
+ end
6
+
7
+ private
8
+
9
+ def merged_input_js_options(options)
10
+ (options || {}).tap do |opts|
11
+ js_options = opts.reject { |k, _| EffectiveFormInputs::REJECTED_INPUT_JS_OPTIONS.include?(k) }
12
+ opts.reject! { |k, _| js_options.include?(k) }
13
+ opts['data-input-js-options'] = js_options if js_options.present?
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module EffectiveFormInputs
2
+ VERSION = '0.1.1'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: effective_form_inputs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Code and Effect
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
27
+ description: Collection of Form Inputs
28
+ email:
29
+ - info@codeandeffect.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - app/assets/javascripts/effective_date_time_picker/bootstrap-datetimepicker.js
38
+ - app/assets/javascripts/effective_date_time_picker/initialize.js.coffee
39
+ - app/assets/javascripts/effective_date_time_picker/input.js
40
+ - app/assets/javascripts/effective_date_time_picker/moment.js
41
+ - app/assets/javascripts/effective_form_inputs.js
42
+ - app/assets/stylesheets/effective_date_time_picker/bootstrap-datetimepicker.scss
43
+ - app/assets/stylesheets/effective_date_time_picker/input.scss
44
+ - app/assets/stylesheets/effective_form_inputs.scss
45
+ - app/models/effective/form_input_field.rb
46
+ - app/models/inputs/effective_date_time_picker/effective_date_time_picker_input.rb
47
+ - app/models/inputs/effective_date_time_picker/field.rb
48
+ - app/views/effective/style_guide/_form_default.html.haml
49
+ - lib/effective_form_inputs.rb
50
+ - lib/effective_form_inputs/engine.rb
51
+ - lib/effective_form_inputs/form_inputs.rb
52
+ - lib/effective_form_inputs/version.rb
53
+ homepage: https://github.com/code-and-effect/effective_form_inputs
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.4.3
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Collection of Form Inputs
77
+ test_files: []