simple_form_extension 1.1.3 → 1.1.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: 41f086cd052a4b616fbcd9329c43f943baf45da0
4
- data.tar.gz: 121454242d3c9e3e9c80454e0e34e13de660c09b
3
+ metadata.gz: 40b76905f993c1d85fe6d87f2e13c042f985891b
4
+ data.tar.gz: edc4518dda7d58a0e2d8a3d6c3117f183a3f4b7a
5
5
  SHA512:
6
- metadata.gz: 55d81b2f320d89a4a8dfc9c99e502c2609a68aa255997378e576e7e5724639eb9b80d42cf98f419039da57acb99398104b4b6a831f2dd69cb70a09bd4af3aabd
7
- data.tar.gz: 2990f089af56a6811445738d9e6954f7bb880e4c77463d21c6606c7c97d6be3b485aaa243d19d05c3adff269207ca449a782dd4667af70921d309896c174527c
6
+ metadata.gz: daa96cc685910fe4514132b286881ddcd02992f0303c94f1cdcaf7d2d1aaa8f1dd11fc95a52bb3c6143879a382a16fc502498923b211927f97917be07d94f0a2
7
+ data.tar.gz: 01cbf739c86556795d51eb057d163b95347528192c8037b12f95fae7cd3706db1d9d1f036e487bccf6bad375ef1018046d2a529c43275e97f58f639a8b4757dc
@@ -9,9 +9,13 @@ en:
9
9
  select: "Select image"
10
10
  change: "Change image"
11
11
  date:
12
- format: 'm/d/Y'
12
+ format:
13
+ js: 'Y/m/d'
14
+ rails: '%Y/%m/%d'
13
15
  datetime:
14
- format: 'm/d/Y H:i'
16
+ format:
17
+ js: 'Y/m/d H:i'
18
+ rails: '%Y/%m/%d %H:%M'
15
19
  shared:
16
20
  week_start_day: 0
17
21
  selectize:
@@ -9,9 +9,13 @@ fr:
9
9
  select: "Sélectionnez une image"
10
10
  change: "Changer"
11
11
  date:
12
- format: 'd/m/Y'
12
+ format:
13
+ js: 'd/m/Y'
14
+ rails: '%d/%m/%Y'
13
15
  datetime:
14
- format: 'd/m/Y H:i'
16
+ format:
17
+ js: 'd/m/Y H:i'
18
+ rails: '%d/%m/%Y %H:%M'
15
19
  shared:
16
20
  week_start_day: 1
17
21
  selectize:
@@ -3,24 +3,33 @@ module SimpleFormExtension
3
3
  class DateTimeInput < SimpleForm::Inputs::DateTimeInput
4
4
  include SimpleFormExtension::Translations
5
5
 
6
+ delegate :content_tag, to: :template
7
+
6
8
  def input(wrapper_options = nil)
7
9
  input_html_options[:class] << "form-control"
8
10
 
9
11
  input_html_options[:data] ||= {}
10
12
  input_html_options[:data].merge!(
11
- :'date-format' => _translate('date.format'),
12
- :'datetime-format' => _translate('datetime.format'),
13
+ :'date-format' => _translate('date.format.js'),
14
+ :'datetime-format' => _translate('datetime.format.js'),
13
15
  :'week-start-day' => _translate('shared.week_start_day')
14
16
  )
15
17
 
16
- "<div class=\"input-group\">
17
- #{@builder.text_field(attribute_name, input_html_options)}
18
- <span class=\"input-group-btn\">
19
- <button type=\"button\" class=\"btn btn-default datetimepicker-trigger\">
20
- <i class=\"fa fa-calendar\"></i>
21
- </button>
22
- </span>
23
- </div> ".html_safe
18
+ if (value = object.send(attribute_name)) && !input_html_options.key?(:value)
19
+ format = _translate("#{ input_type }.format.rails")
20
+ input_html_options[:value] = I18n.l(value, format: format)
21
+ end
22
+
23
+
24
+ content_tag(:div, class: 'input-group') do
25
+ @builder.text_field(attribute_name, input_html_options) +
26
+
27
+ content_tag(:span, class: 'input-group-btn') do
28
+ content_tag(:button, class: 'btn btn-default datetimepicker-trigger') do
29
+ content_tag(:i, '', class: 'fa fa-calendar')
30
+ end
31
+ end
32
+ end
24
33
  end
25
34
  end
26
35
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Vasseur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2015-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails