simple_form_extension 1.2.3 → 1.2.4

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: 61c0c901f77313d4994125503b41485d4d73110d
4
- data.tar.gz: b9195dec83b06e0c2381d553308afe21ffc2001e
3
+ metadata.gz: 58c0b2f6d645cc957beb0490999f19aa2fe2b311
4
+ data.tar.gz: 0a4babbd115696a168f07a2b86477de745e8c9cb
5
5
  SHA512:
6
- metadata.gz: 0d0f105067cf002348b383c07ca61a3c0f33c0cc456bb9e115b6508f971fdd2ae3959a66c9c6ab624fb041b7e61a21eb7e49c387ea96aabc2b0c4dfccaca00b1
7
- data.tar.gz: 9d9f8d0a464183ce41d859a9b2e9d729667903ccf88c6ab6c55eb6578479c71fb72788be38e8d7dafd85956b209119319872db97a2024fe479b3dc23bc973ce8
6
+ metadata.gz: 525267f1f89d731e5d8f54667aa980c516f376d76bc02237b4f213ee8993738e78f9da9801e0371d5660eb3f206aad376a71f909ba328cd1571b681fdc6aac8d
7
+ data.tar.gz: ddcf4d10d63dbd502e1ad5a7fb29c4a8f80786b04df719c2d0d17dc0321487e2f4cda687a3861028a8621ebf421a3e876bc74ffefefafa818b92f34a9a4b4f59
@@ -12,6 +12,10 @@ en:
12
12
  format:
13
13
  js: 'Y/m/d'
14
14
  rails: '%Y/%m/%d'
15
+ time:
16
+ format:
17
+ js: 'H:i'
18
+ rails: '%H:%M'
15
19
  datetime:
16
20
  format:
17
21
  js: 'Y/m/d H:i'
@@ -8,6 +8,10 @@ fr:
8
8
  image:
9
9
  select: "Sélectionnez une image"
10
10
  change: "Changer"
11
+ time:
12
+ format:
13
+ js: 'H:i'
14
+ rails: '%H:%M'
11
15
  date:
12
16
  format:
13
17
  js: 'd/m/Y'
@@ -11,7 +11,6 @@ module SimpleFormExtension
11
11
  autoload :FileInput
12
12
  autoload :ImageInput
13
13
  autoload :RedactorInput
14
- autoload :AirRedactorInput
15
14
  autoload :SelectizeInput
16
15
  end
17
16
  end
@@ -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: 'fa fa-calendar')
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
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
@@ -13,7 +13,7 @@ class DateTimePicker
13
13
  initializePicker: ->
14
14
  @$input.datetimepicker(
15
15
  lang: @locale
16
- format: @$input.data('datetime-format')
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('date-format')
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.3
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.4.4
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