simple_form_datetimepicker 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16608f2518c49c75ea419588051b5b8c6e320113
4
- data.tar.gz: 7ae8c46ab4e840c87882ffc45bb91c7180ff58f4
3
+ metadata.gz: 7e6375ea8b0718386a75995084e8f1343861514f
4
+ data.tar.gz: b12618649d7ce9700f70c80e6c5308fa241d0e79
5
5
  SHA512:
6
- metadata.gz: 04af70eab262a5108ff76670b40340c65c4c11b086298001cbe5e978e46556b0cb5d13ec2f2c31d2af3048d25c7d4f556b787037929f32ba31bbc8295cdb8c30
7
- data.tar.gz: 3c6e01c8206524f11bba1dcd15a5e65aab8f1bbe50a73ad3aec9f2935775cb5f55d871fa77641713d50217f7d31e7ffb04bbe060c1ecf7900923ecf27480b290
6
+ metadata.gz: 918b692aa65c305bea348ab0c3c29bc78918f338f28bdcc9cc102c303f1dfdf68d74c1add802b5eefa729f48ca614276ba8c1274ac3ba3cc96af408fb537bd80
7
+ data.tar.gz: 073cbfd4aac16ca4dc3ddaebab492fee06096b69b6e77f877a8d374541a3657ed435a376309861678421af6bb3e47e1d7ba1587b738ffc02aa8c27e7737e732e
@@ -1,28 +1,30 @@
1
1
  module SimpleForm
2
2
  module Inputs
3
3
  class DateTimeInput < Base
4
- def input
5
- icon = input_html_options.delete(:icon) || 'glyphicon-calendar'
6
- icon_lib = input_html_options.delete(:iconlib) || icon.split('-')[0]
7
- defaultvalue = input_html_options.delete(:defaultvalue)
4
+ def input(wrapper_options)
5
+ merged_input_options = merge_wrapper_options input_html_options, wrapper_options
6
+ icon = merged_input_options.delete(:icon) || 'glyphicon-calendar'
7
+ icon_lib = merged_input_options.delete(:iconlib) || icon.split('-')[0]
8
+ defaultvalue = merged_input_options.delete(:defaultvalue)
8
9
  if defaultvalue.present? && defaultvalue.is_a?(Hash)
9
10
  day_offset = defaultvalue.delete(:day_offset)
10
11
  defaulttime = Time.zone.now.change(defaultvalue)
11
12
  defaulttime += day_offset.days if day_offset.present?
12
13
  defaultvalue = defaulttime
13
14
  end
14
- input_html_options[:class] << 'dtp'
15
- no_group = if input_html_options.key?(:data)
16
- input_html_options[:data][:defaultvalue] = defaultvalue if defaultvalue.present?
17
- input_html_options[:data].key?(:no_group)
15
+ # merged_input_options[:class] << 'dtp'
16
+ input_html_classes.push 'dtp'
17
+ no_group = if merged_input_options.key?(:data)
18
+ merged_input_options[:data][:defaultvalue] = defaultvalue if defaultvalue.present?
19
+ merged_input_options[:data].key? :no_group
18
20
  else
19
- input_html_options[:data] = {:defaultvalue => defaultvalue} if defaultvalue.present?
21
+ merged_input_options[:data] = {:defaultvalue => defaultvalue} if defaultvalue.present?
20
22
  false
21
23
  end
22
24
 
23
25
  out = ''
24
26
  out << '<div class="input-group">' unless no_group
25
- out << @builder.text_field(attribute_name, input_html_options)
27
+ out << @builder.text_field(attribute_name, merged_input_options)
26
28
  unless no_group
27
29
  out << '<span class="input-group-addon">'
28
30
  out << "<span class='#{icon_lib} #{icon}'></span>"
@@ -31,6 +33,10 @@ module SimpleForm
31
33
  end
32
34
  out.html_safe
33
35
  end
36
+
37
+ def label_target
38
+ :"#{attribute_name}"
39
+ end
34
40
  end
35
41
  end
36
- end
42
+ end
@@ -0,0 +1,9 @@
1
+ module SimpleFormDatetimepicker
2
+ module CapybaraHelpers
3
+ def fill_in_dtp(locator, options={})
4
+ locator = find('label', text: locator)[:for] if page.has_css?('label', text: locator)
5
+ fill_in locator, :with => ''
6
+ fill_in locator, options
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormDatetimepicker
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'simple_form_datetimepicker/version'
2
+ require 'simple_form_datetimepicker/capybara_helpers'
2
3
 
3
4
  module SimpleFormDatetimepicker
4
5
  class Engine < ::Rails::Engine
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_datetimepicker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - smit1625
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,16 +87,12 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - ".gitignore"
91
- - Gemfile
92
- - LICENSE.txt
93
- - README.md
94
90
  - Rakefile
95
91
  - lib/generators/simple_form_datetimepicker/install/install_generator.rb
96
92
  - lib/generators/simple_form_datetimepicker/install/templates/simple_form_datetimepicker.rb
97
93
  - lib/simple_form_datetimepicker.rb
94
+ - lib/simple_form_datetimepicker/capybara_helpers.rb
98
95
  - lib/simple_form_datetimepicker/version.rb
99
- - simple_form_datetimepicker.gemspec
100
96
  - vendor/assets/javascripts/simple_form_datetimepicker/bootstrap-datetimepicker.js
101
97
  - vendor/assets/javascripts/simple_form_datetimepicker/init.js
102
98
  - vendor/assets/javascripts/simple_form_datetimepicker/moment.js
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
-
19
- /.idea
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in simple_form_datetimepicker.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 smit1625
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,29 +0,0 @@
1
- # SimpleFormDatetimepicker
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'simple_form_datetimepicker'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install simple_form_datetimepicker
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
@@ -1,26 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'simple_form_datetimepicker/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "simple_form_datetimepicker"
8
- spec.version = SimpleFormDatetimepicker::VERSION
9
- spec.authors = ["smit1625"]
10
- spec.email = ["smit1625@msu.edu"]
11
- spec.description = %q{Beautifies the default datetime input for SimpleForm}
12
- spec.summary = %q{Uses bootstrap-datetimepicker to enhance SimpleForm's default datetime input}
13
- spec.homepage = ""
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_dependency "railties"
24
- spec.add_dependency "simple_form"
25
- spec.add_dependency "american_date"
26
- end