anjlab-widgets 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,7 +4,9 @@ Bootstrap date and time pickers for rails (ready for rails 4).
4
4
 
5
5
  Note: `simple_form` gem is supported.
6
6
 
7
- Currently `en` and `ru` locales supported.
7
+ Currently `en` and `ru` locales are supported.
8
+
9
+ Note: please use it with [bootstrap-rails](https://github.com/anjlab/bootstrap-rails)
8
10
 
9
11
  ## Installation
10
12
 
@@ -30,6 +30,8 @@ module Anjlab
30
30
  :class => "#{input_html_options[:time_class] || 'input-small'}"
31
31
  }
32
32
 
33
+ default_parts = [''] * 5
34
+
33
35
  case input_type
34
36
  when :datetime, :anjlab_datetime
35
37
  html << @builder.text_field(attribute_name, date_data)
@@ -38,10 +40,12 @@ module Anjlab
38
40
  when :date, :anjlab_date
39
41
  html << @builder.text_field(attribute_name, date_data)
40
42
  when :time, :anjlab_time
43
+ now = Time.now
44
+ default_parts = [now.year, now.month, now.day, '', '']
41
45
  html << @builder.text_field(attribute_name, time_data)
42
46
  end
43
47
 
44
- values = time ? [time.year, time.month, time.day, time.hour, time.min] : [''] * 5
48
+ values = time ? [time.year, time.month, time.day, time.hour, time.min] : default_parts
45
49
  values.each_with_index do |v, index|
46
50
  i = index + 1
47
51
  html << @builder.hidden_field("#{attribute_name}(#{i}i)", value: v, class: "js-aw-#{i}i")
@@ -1,5 +1,5 @@
1
1
  module Anjlab
2
2
  module Widgets
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: anjlab-widgets
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Yury Korolev
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-07 00:00:00.000000000 Z
12
+ date: 2013-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anjlab-bootstrap-rails
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  - - ! '>='
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
- hash: 1068616150774873195
175
+ hash: 1438020642301613825
176
176
  segments:
177
177
  - 0
178
178
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - - ! '>='
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
- hash: 1068616150774873195
184
+ hash: 1438020642301613825
185
185
  segments:
186
186
  - 0
187
187
  requirements: []