cck_forms 3.4.1 → 3.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8014d2ff695301e74af0786d64e8c59d9b9028e4
4
- data.tar.gz: c7f0347885e943b363c39784abcea19a17669c50
3
+ metadata.gz: dc4907e7cfc886d816dec72188a09782a95a913c
4
+ data.tar.gz: ed15ab4358fc8874951b68f1ede216bcdd6e49f7
5
5
  SHA512:
6
- metadata.gz: 341cc155d587f187fb5c8dea78ca2f1316d04e7d8b5df9763f3b27e093cb8bc43cca209a99330549f5662d2f47603dedefc2aa70bc365ff16aca27c9bcddb5f2
7
- data.tar.gz: 00058860396b4f8230ae17df449fbb1f47dad879ee5901d3d753444cefd4f06498bed9fce7aa952b08fa6b10811bb299638b0d0bfe7f6d11e3b70cd1797d01ea
6
+ metadata.gz: 866ef1e469bcc36f90de410af71954ccb004878eacdd557aaf6a54fe3f90f4b13a9d19cbcf792ee563dfafb9040bb8a765336f26c4ea07fd220fcf77a34e5e52
7
+ data.tar.gz: 449fc5a166723a8dafe444f9528db39b18492659317c16c645d163239f87be09e24f97c1d933c84c58a6982ef1a55caa790e6f0127f45aba62c75cbdd343ed74
@@ -174,14 +174,21 @@ class CckForms::ParameterTypeClass::Map
174
174
  inputs << value_builder.hidden_field(:type, value: value['type'])
175
175
  end
176
176
 
177
- allowed_maps = @@map_providers
178
- map_names = {'google' => 'Google', 'yandex' => 'Yandex'}
177
+ allowed_maps = @@map_providers
178
+ map_names = {'google' => 'Google', 'yandex' => 'Yandex'}
179
179
  selected_map_type = value['type'].in?(allowed_maps) ? value['type'] : allowed_maps.first
180
+ group_class = options[:group_class].presence || 'btn-group'
181
+ switcher_classes = {
182
+ 'yandex' => options[:yandex_button_class],
183
+ 'google' => options[:google_button_class]
184
+ }
180
185
 
181
186
  switchers = []
182
- switchers << %Q|<div class="btn-group cck-map-switchers #{'hide' if allowed_maps.count < 2}" style="margin-top: 5px;">|
187
+ switchers << %Q|<div class="#{group_class} cck-map-switchers #{'hide' if allowed_maps.count < 2}" style="margin-top: 5px;">|
183
188
  allowed_maps.map do |map|
184
- switchers << %Q|<a class="btn btn-default #{selected_map_type == map ? 'active' : nil}" href="#" data-map-type="#{map}">#{map_names[map]}</a>|
189
+ button_class = switcher_classes[map].presence || 'btn btn-default'
190
+ button_class << ' active' if selected_map_type == map
191
+ switchers << %Q|<a class="#{button_class}" href="#" data-map-type="#{map}">#{map_names[map]}</a>|
185
192
  end
186
193
  switchers << '</div>'
187
194
 
@@ -79,6 +79,7 @@ class CckForms::ParameterTypeClass::Phones
79
79
  code_class = options[:code_class].presence || 'input-mini form-control'
80
80
  number_class = options[:number_class].presence || 'input-small form-control'
81
81
  group_class = options[:group_class].presence || 'form-inline'
82
+ delimiter = options[:delimiter].presence || '&mdash;'
82
83
 
83
84
  phone_form = []
84
85
 
@@ -88,7 +89,9 @@ class CckForms::ParameterTypeClass::Phones
88
89
  phone_form << phone_builder.text_field(:number, class: number_class, value: phone['number'])
89
90
  end
90
91
 
91
- sprintf '<p class="%s">%s &mdash; %s &mdash; %s</p>', group_class, phone_form[0], phone_form[1], phone_form[2]
92
+ full_phone_form = [phone_form[0], delimiter, phone_form[1], delimiter, phone_form[2]].join
93
+
94
+ sprintf '<p class="%s">%s</p>', group_class, full_phone_form
92
95
  end
93
96
 
94
97
  # 1 empty phone Hash: {prefix: '+7', code: '', number: ''}
@@ -1,3 +1,3 @@
1
1
  module CckForms
2
- VERSION = '3.4.1'
2
+ VERSION = '3.4.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cck_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Konanykhin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails