effective_bootstrap 0.1.7 → 0.1.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bff1d75dba9d0ae47c87581ebabc1b30ba624bbc
|
4
|
+
data.tar.gz: 4aca09fc196381f53b7f415a8265e7d98a012a05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a950fc1c9b922679bbc1316b4f17b081c9a522eb6de3682264dd38f014f05769040ce31495b576e14c67a7abba43601059108073ca314c34902aaa8556bff65a
|
7
|
+
data.tar.gz: 70efe8b067991772b672f6b151301d454b23acf605181a4967f1d6149670d80bffadf0f8f1bef2174727b691ceac0ca6c848fed52b70701408808658b91c79a4
|
data/README.md
CHANGED
@@ -209,7 +209,7 @@ Bootstrap 3 Datepicker (https://github.com/Eonasdan/bootstrap-datetimepicker)
|
|
209
209
|
The default options used to initialize this form input are as follows:
|
210
210
|
|
211
211
|
```ruby
|
212
|
-
input_js: { showTodayButton:
|
212
|
+
am_pm: true, input_js: { showTodayButton: false, showClear: false, useCurrent: 'hour' }
|
213
213
|
```
|
214
214
|
|
215
215
|
For a full list of options, please refer to:
|
@@ -5,22 +5,30 @@ module Effective
|
|
5
5
|
def input_html_options
|
6
6
|
{
|
7
7
|
class: ['form-control', 'effective_date_time_picker', 'effective_date', ('not-date-linked' if not_date_linked?)].compact.join(' '),
|
8
|
-
pattern:
|
8
|
+
pattern: pattern
|
9
9
|
}
|
10
10
|
end
|
11
11
|
|
12
12
|
def input_js_options
|
13
|
-
{ format:
|
13
|
+
{ format: format, showTodayButton: false, showClear: false, useCurrent: 'hour', disabledDates: disabled_dates.presence }.compact
|
14
14
|
end
|
15
15
|
|
16
16
|
def input_group_options
|
17
17
|
{ input_group: { class: 'input-group effective_date_time_picker_input_group' }, prepend: content_tag(:span, icon('calendar'), class: 'input-group-text') }
|
18
18
|
end
|
19
19
|
|
20
|
-
def datetime_to_s
|
20
|
+
def datetime_to_s # ruby
|
21
21
|
value&.strftime('%F')
|
22
22
|
end
|
23
23
|
|
24
|
+
def pattern # html
|
25
|
+
'\d{4}(-\d{2})?(-\d{2})?'
|
26
|
+
end
|
27
|
+
|
28
|
+
def format # moment.js
|
29
|
+
'YYYY-MM-DD'
|
30
|
+
end
|
31
|
+
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
@@ -5,12 +5,12 @@ module Effective
|
|
5
5
|
def input_html_options
|
6
6
|
{
|
7
7
|
class: ['form-control', 'effective_date_time_picker', 'effective_datetime', ('not-date-linked' if not_date_linked?)].compact.join(' '),
|
8
|
-
pattern:
|
8
|
+
pattern: pattern
|
9
9
|
}
|
10
10
|
end
|
11
11
|
|
12
12
|
def input_js_options
|
13
|
-
{ format:
|
13
|
+
{ format: format, sideBySide: true, showTodayButton: false, showClear: false, useCurrent: 'hour', disabledDates: disabled_dates.presence }.compact
|
14
14
|
end
|
15
15
|
|
16
16
|
def input_group_options
|
@@ -21,8 +21,16 @@ module Effective
|
|
21
21
|
@builder.super_text_field(name, options[:input].merge(value: datetime_to_s))
|
22
22
|
end
|
23
23
|
|
24
|
-
def datetime_to_s
|
25
|
-
value&.strftime('%F %H:%M')
|
24
|
+
def datetime_to_s # ruby
|
25
|
+
value&.strftime(am_pm? ? '%F %I:%M %p' : '%F %H:%M')
|
26
|
+
end
|
27
|
+
|
28
|
+
def pattern # html
|
29
|
+
am_pm? ? '\d{4}(-\d{2})?(-\d{2})?( \d{1,2})?(:\d{2} \[aApPmM]{2})?' : '\d{4}(\-d{2})?(-\d{2})?( \d{2})?(:\d{2})?'
|
30
|
+
end
|
31
|
+
|
32
|
+
def format # moment.js
|
33
|
+
am_pm? ? 'YYYY-MM-DD LT' : 'YYYY-MM-DD HH:mm'
|
26
34
|
end
|
27
35
|
|
28
36
|
private
|
@@ -52,6 +60,11 @@ module Effective
|
|
52
60
|
@not_date_linked = (options.delete(:date_linked) == false)
|
53
61
|
end
|
54
62
|
|
63
|
+
def am_pm?
|
64
|
+
return @am_pm unless @am_pm.nil?
|
65
|
+
@am_pm = options.key?(:am_pm) ? options.delete(:am_pm) : true
|
66
|
+
end
|
67
|
+
|
55
68
|
end
|
56
69
|
end
|
57
70
|
end
|
@@ -5,20 +5,28 @@ module Effective
|
|
5
5
|
def input_html_options
|
6
6
|
{
|
7
7
|
class: ['form-control', 'effective_date_time_picker', 'effective_time', ('not-date-linked' if not_date_linked?)].compact.join(' '),
|
8
|
-
pattern:
|
8
|
+
pattern: pattern
|
9
9
|
}
|
10
10
|
end
|
11
11
|
|
12
12
|
def input_js_options
|
13
|
-
{ format:
|
13
|
+
{ format: format, showTodayButton: false, showClear: false, useCurrent: 'hour', disabledDates: disabled_dates.presence }.compact
|
14
14
|
end
|
15
15
|
|
16
16
|
def input_group_options
|
17
17
|
{ input_group: { class: 'input-group effective_date_time_picker_input_group' }, prepend: content_tag(:span, icon('clock'), class: 'input-group-text') }
|
18
18
|
end
|
19
19
|
|
20
|
-
def datetime_to_s
|
21
|
-
value&.strftime('%H:%M')
|
20
|
+
def datetime_to_s # ruby
|
21
|
+
value&.strftime(am_pm? ? '%I:%M %p' : '%H:%M')
|
22
|
+
end
|
23
|
+
|
24
|
+
def pattern # html
|
25
|
+
am_pm? ? '\d{1,2}(:\d{2} \[aApPmM]{2})?' : '\d{2}(:\d{2})?'
|
26
|
+
end
|
27
|
+
|
28
|
+
def format # moment.js
|
29
|
+
am_pm? ? 'LT' : 'HH:mm'
|
22
30
|
end
|
23
31
|
|
24
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -481,7 +481,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
481
481
|
version: '0'
|
482
482
|
requirements: []
|
483
483
|
rubyforge_project:
|
484
|
-
rubygems_version: 2.
|
484
|
+
rubygems_version: 2.5.2.3
|
485
485
|
signing_key:
|
486
486
|
specification_version: 4
|
487
487
|
summary: Everything you need to get set up with bootstrap 4.
|