cck_forms 3.4.4 → 3.5.1

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
- SHA1:
3
- metadata.gz: f23c7296f8d99270dad64a2eb63d68753190a098
4
- data.tar.gz: 405d3a8da75336283392c732012e65da4269bc08
2
+ SHA256:
3
+ metadata.gz: e5b1694eaef5aa6125133841efdedd5310233d322c178cf5cfa1da1e836f8b1e
4
+ data.tar.gz: 5b45670f29322fb3fbf11faa71cd958b09fc8dfff6e6d0abe345f9c85fbd9b0d
5
5
  SHA512:
6
- metadata.gz: 6d44d8edb906d9e20d6839c1b4881d52f9f0f8363718093b6bf063c2eb26eb39d91391a97316ffd4bc66f171b01f4cf93dda175b2e44919c577577e7b7dea47a
7
- data.tar.gz: 56722f8414d55ae7d9c8de68c648a4fccfafec876ffa824b4899632ca4c2f0f668539451fd20dc98fc302f7fff710ed8251ba1d57d39fe311c7c6815219bff43
6
+ metadata.gz: 7c65ff5c37bc0960d9cb2c9f5bb0100e1bd41f4740370fb104a5da81d2e1c2c2bee634fa277fc615f8117f10bfb8c1277931e7ba711a7dc7d68b46390e1d06ed
7
+ data.tar.gz: b53e4c077aeb1c28e29a08660da5bd3d1e2f62a6f14105358b9d088518082659a8cf746426c08de27f81421bf45c301225b9e75d852fd58c851103522fda0926
@@ -14,6 +14,32 @@ class CckForms::ParameterTypeClass::Float
14
14
  trailing_zeros && value.to_i == value ? value.to_i : value
15
15
  end
16
16
 
17
+ # '123' -> 123
18
+ # '100/' -> $gte: 100
19
+ # '100/150' -> $gte: 100, $lte: 150
20
+ # '/150' -> $lte: 150
21
+ #
22
+ # l: 100 -> $gte: 100
23
+ # l: 100, h: 150 -> $gte: 100, $lte: 150
24
+ # h: 150 -> $lte: 150
25
+ def search(selectable, field, query)
26
+ if query.is_a?(Hash) || query.to_s.include?('/')
27
+ low, high = query.is_a?(Hash) ? [query[:l] || query['l'], query[:h] || query['h']] : query.to_s.split('/')
28
+
29
+ if low.to_f > 0
30
+ selectable = selectable.gte(field => low.to_f)
31
+ end
32
+
33
+ if high.to_f > 0
34
+ selectable = selectable.lte(field => high.to_f)
35
+ end
36
+
37
+ selectable
38
+ else
39
+ selectable.where(field => query.to_f)
40
+ end
41
+ end
42
+
17
43
  # HTML input
18
44
  def build_form(form_builder, options)
19
45
  set_value_in_hash options
@@ -11,6 +11,7 @@ class CckForms::ParameterTypeClass::Map
11
11
  @@map_providers = [MAP_TYPE_YANDEX, MAP_TYPE_GOOGLE]
12
12
 
13
13
  mattr_accessor :google_maps_api_key
14
+ mattr_accessor :yandex_maps_api_key
14
15
 
15
16
  # In MongoDB: {latlon: [x, y], zoom: z}
16
17
  #
@@ -197,7 +198,8 @@ class CckForms::ParameterTypeClass::Map
197
198
  map_html_containers.push %Q|<div id="#{id}_#{map}" data-id=#{id} class="map_widget" style="display: none; width: #{options[:width]}px; height: #{options[:height]}px"></div>|
198
199
  end
199
200
 
200
- api_key = @@google_maps_api_key.present? ? "&key=#{@@google_maps_api_key}" : nil
201
+ google_api_key = @@google_maps_api_key.present? ? "&key=#{@@google_maps_api_key}" : nil
202
+ yandex_api_key = @@yandex_maps_api_key.present? ? "&apikey=#{@@yandex_maps_api_key}" : nil
201
203
 
202
204
  %Q|
203
205
  <div class="map-canvas">
@@ -218,12 +220,12 @@ class CckForms::ParameterTypeClass::Map
218
220
  var script;
219
221
  script = document.createElement('script');
220
222
  script.type = 'text/javascript';
221
- script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=googleMapReady#{api_key}';
223
+ script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=googleMapReady#{google_api_key}';
222
224
  document.body.appendChild(script);
223
225
 
224
226
  script = document.createElement('script');
225
227
  script.type = 'text/javascript';
226
- script.src = 'https://api-maps.yandex.ru/2.0/?coordorder=longlat&load=package.full&wizard=constructor&lang=ru-RU&onload=yandexMapReady';
228
+ script.src = 'https://api-maps.yandex.ru/2.0/?coordorder=longlat&load=package.full&wizard=constructor&lang=ru-RU&onload=yandexMapReady#{yandex_api_key}';
227
229
  document.body.appendChild(script);
228
230
  }
229
231
 
@@ -218,7 +218,7 @@ class CckForms::ParameterTypeClass::WorkHours
218
218
 
219
219
  if template
220
220
  header = ['<ul class="nav nav-pills">']
221
- CckForms::ParameterTypeClass::WorkHours::DAYS.each { |day| header << '<li><a href="javascript:void(0)"><input name="' + form_builder.object_name + '[days]" type="checkbox" value="' + day + '" /> ' + CckForms::ParameterTypeClass::WorkHours.day_to_short(day) + '</a></li>' }
221
+ CckForms::ParameterTypeClass::WorkHours::DAYS.each { |day| header << '<li class="nav-item"><a class="nav-link" href="javascript:void(0)"><input name="' + form_builder.object_name + '[days]" type="checkbox" value="' + day + '" /> ' + CckForms::ParameterTypeClass::WorkHours.day_to_short(day) + '</a></li>' }
222
222
  header = header.push('</ul>').join
223
223
  else
224
224
  header = sprintf '<strong>%s</strong>:%s', CckForms::ParameterTypeClass::WorkHours::day_to_short(day), form_builder.hidden_field(:day)
@@ -1,3 +1,3 @@
1
1
  module CckForms
2
- VERSION = '3.4.4'
2
+ VERSION = '3.5.1'
3
3
  end
@@ -241,7 +241,7 @@ $(function() {
241
241
 
242
242
  // mark checkboxes
243
243
  for(var i = 0, ic = days.length; i < ic; ++ i) {
244
- $newGroup.find("input[name$=\"[days]\"][value=" + days[i] + "]").prop("checked", true).closest("li").addClass("active");
244
+ $newGroup.find("input[name$=\"[days]\"][value=" + days[i] + "]").prop("checked", true).closest(".nav-link").addClass("active");
245
245
  }
246
246
 
247
247
  // hide checkboxes, link-o-buttons will be in their place
@@ -289,7 +289,7 @@ $(function() {
289
289
  this._days[dayName].workhoursday("value", $group.workhoursday("value"));
290
290
 
291
291
  // mark the day as active
292
- input.parentNode.parentNode.className += " active";
292
+ input.parentNode.className += " active";
293
293
 
294
294
  } else {
295
295
 
@@ -300,7 +300,7 @@ $(function() {
300
300
  if($group.find("input:checked[name$='[days]']").size() == 0) {
301
301
  $group.remove();
302
302
  } else {
303
- input.parentNode.parentNode.className = input.parentNode.parentNode.className.replace(/(^|\s)active($|\s)/, "$1");
303
+ input.parentNode.className = input.parentNode.className.replace(/(^|\s)active($|\s)/, "$1");
304
304
  }
305
305
  }
306
306
 
@@ -35,12 +35,12 @@ class CckFormsMap.AbstractMap
35
35
  @internalMapAPI.setZoom zoom
36
36
  setMarkerToPoint: (latitudeAndLongitude) ->
37
37
 
38
- setCenterByGeocode: (geocode) ->
38
+ setCenterByGeocode: (geocode, apikey) ->
39
39
 
40
40
  options = {
41
41
  url: 'https://geocode-maps.yandex.ru/1.x/'
42
42
  dataType: 'json'
43
- data: {format: 'json', geocode: geocode, results: 1}
43
+ data: {format: 'json', geocode: geocode, results: 1, apikey: apikey}
44
44
  }
45
45
 
46
46
  xhr = $.ajax options
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.4
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Konanykhin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2022-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -101,7 +101,7 @@ homepage: http://github.com/ilya-konanykhin/cck_forms
101
101
  licenses:
102
102
  - MIT
103
103
  metadata: {}
104
- post_install_message:
104
+ post_install_message:
105
105
  rdoc_options: []
106
106
  require_paths:
107
107
  - lib
@@ -116,9 +116,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 2.6.12
121
- signing_key:
119
+ rubygems_version: 3.0.9
120
+ signing_key:
122
121
  specification_version: 4
123
122
  summary: Content Construction Kit Forms
124
123
  test_files: []