simple_form_extension 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/simple_form_extension/templates/config/locales/simple_form_extension.en.yml +4 -0
- data/lib/generators/simple_form_extension/templates/config/locales/simple_form_extension.fr.yml +4 -0
- data/lib/simple_form_extension/inputs.rb +0 -1
- data/lib/simple_form_extension/inputs/date_time_input.rb +18 -7
- data/lib/simple_form_extension/version.rb +1 -1
- data/vendor/assets/javascripts/simple_form_extension/datetimepicker.coffee +18 -3
- metadata +2 -3
- data/lib/simple_form_extension/inputs/air_redactor_input.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58c0b2f6d645cc957beb0490999f19aa2fe2b311
|
4
|
+
data.tar.gz: 0a4babbd115696a168f07a2b86477de745e8c9cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 525267f1f89d731e5d8f54667aa980c516f376d76bc02237b4f213ee8993738e78f9da9801e0371d5660eb3f206aad376a71f909ba328cd1571b681fdc6aac8d
|
7
|
+
data.tar.gz: ddcf4d10d63dbd502e1ad5a7fb29c4a8f80786b04df719c2d0d17dc0321487e2f4cda687a3861028a8621ebf421a3e876bc74ffefefafa818b92f34a9a4b4f59
|
@@ -9,28 +9,39 @@ module SimpleFormExtension
|
|
9
9
|
input_html_options[:class] << "form-control"
|
10
10
|
|
11
11
|
input_html_options[:data] ||= {}
|
12
|
-
input_html_options[:data].merge!(
|
13
|
-
:'date-format' => _translate('date.format.js'),
|
14
|
-
:'datetime-format' => _translate('datetime.format.js'),
|
15
|
-
:'week-start-day' => _translate('shared.week_start_day')
|
16
|
-
)
|
12
|
+
input_html_options[:data].merge!(type_specific_option)
|
17
13
|
|
18
14
|
if (value = object.send(attribute_name)) && !input_html_options.key?(:value)
|
19
15
|
format = _translate("#{ input_type }.format.rails")
|
20
16
|
input_html_options[:value] = I18n.l(value, format: format)
|
21
17
|
end
|
22
18
|
|
23
|
-
|
24
19
|
content_tag(:div, class: 'input-group') do
|
25
20
|
@builder.text_field(attribute_name, input_html_options) +
|
26
21
|
|
27
22
|
content_tag(:span, class: 'input-group-btn') do
|
28
23
|
content_tag(:button, type: 'button', class: 'btn btn-default datetimepicker-trigger') do
|
29
|
-
content_tag(:i, '', class:
|
24
|
+
content_tag(:i, '', class: "fa fa-#{ icon }")
|
30
25
|
end
|
31
26
|
end
|
32
27
|
end
|
33
28
|
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def type_specific_option
|
33
|
+
options = { format: _translate("#{ input_type }.format.js") }
|
34
|
+
|
35
|
+
unless input_type == :time
|
36
|
+
options[:'week-start-day'] = _translate('shared.week_start_day')
|
37
|
+
end
|
38
|
+
|
39
|
+
options
|
40
|
+
end
|
41
|
+
|
42
|
+
def icon
|
43
|
+
input_type == :time ? 'clock-o' : 'calendar'
|
44
|
+
end
|
34
45
|
end
|
35
46
|
end
|
36
47
|
end
|
@@ -13,7 +13,7 @@ class DateTimePicker
|
|
13
13
|
initializePicker: ->
|
14
14
|
@$input.datetimepicker(
|
15
15
|
lang: @locale
|
16
|
-
format: @$input.data('
|
16
|
+
format: @$input.data('format')
|
17
17
|
dayOfWeekStart: @$input.data('week-start-day')
|
18
18
|
)
|
19
19
|
|
@@ -25,10 +25,18 @@ class DatePicker extends DateTimePicker
|
|
25
25
|
@$input.datetimepicker(
|
26
26
|
lang: @locale
|
27
27
|
timepicker: false
|
28
|
-
format: @$input.data('
|
28
|
+
format: @$input.data('format')
|
29
29
|
dayOfWeekStart: @$input.data('week-start-day')
|
30
30
|
)
|
31
31
|
|
32
|
+
class TimePicker extends DateTimePicker
|
33
|
+
initializePicker: ->
|
34
|
+
@$input.datetimepicker(
|
35
|
+
lang: @locale
|
36
|
+
datepicker: false,
|
37
|
+
format: @$input.data('format')
|
38
|
+
)
|
39
|
+
|
32
40
|
# Lazy initialization of date and datetime pickers
|
33
41
|
onPageReady ->
|
34
42
|
$('body').on 'click', 'input.datetime', (e) ->
|
@@ -44,4 +52,11 @@ onPageReady ->
|
|
44
52
|
$('body').on 'click', '.date .datetimepicker-trigger', (e) ->
|
45
53
|
$input = $(e.currentTarget).closest('.date').find('input.date')
|
46
54
|
DatePicker.forInput($input, DatePicker).show()
|
47
|
-
|
55
|
+
|
56
|
+
$('body').on 'click', 'input.time', (e) ->
|
57
|
+
TimePicker.forInput($(e.currentTarget), TimePicker).show()
|
58
|
+
|
59
|
+
$('body').on 'click', '.time .datetimepicker-trigger', (e) ->
|
60
|
+
$input = $(e.currentTarget).closest('.time').find('input.time')
|
61
|
+
TimePicker.forInput($input, TimePicker).show()
|
62
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Vasseur
|
@@ -118,7 +118,6 @@ files:
|
|
118
118
|
- lib/simple_form_extension/components/popovers.rb
|
119
119
|
- lib/simple_form_extension/ext/form_builder.rb
|
120
120
|
- lib/simple_form_extension/inputs.rb
|
121
|
-
- lib/simple_form_extension/inputs/air_redactor_input.rb
|
122
121
|
- lib/simple_form_extension/inputs/boolean_input.rb
|
123
122
|
- lib/simple_form_extension/inputs/collection_check_boxes_input.rb
|
124
123
|
- lib/simple_form_extension/inputs/collection_radio_buttons_input.rb
|
@@ -167,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
166
|
version: '0'
|
168
167
|
requirements: []
|
169
168
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
169
|
+
rubygems_version: 2.2.2
|
171
170
|
signing_key:
|
172
171
|
specification_version: 4
|
173
172
|
summary: A simple extention for simple_form with, colorpiker, icon, fileupload, image
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module SimpleFormExtension
|
2
|
-
module Inputs
|
3
|
-
class AirRedactorInput < SimpleForm::Inputs::TextInput
|
4
|
-
def input(wrapper_options = nil)
|
5
|
-
@additional_classes ||= additional_classes
|
6
|
-
@additional_classes -= [input_type]
|
7
|
-
|
8
|
-
|
9
|
-
input_html_options[:"data-air-redactor"] = true
|
10
|
-
|
11
|
-
super
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|