cck_forms 3.6.0 → 3.6.1

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
  SHA256:
3
- metadata.gz: acb7223b683169514ba7fe62afb969cd6c26fe1afd4b013be5fca609ac4b0e21
4
- data.tar.gz: 97990bd9deeeadb882db89fca09f24b592f86f91d1ed8e7ba7b07f2752938e7e
3
+ metadata.gz: 1ac913bdb00f008ff4928945481a137270c4002c162e96c827f2d076b4ab24fb
4
+ data.tar.gz: 6466bf72731c201e6d3386d85e3db8f42dacd12b14377bc69c616307873ececb
5
5
  SHA512:
6
- metadata.gz: 2349f645a6ed49c8ea83b0a87844dbb8a6d10a3c63a738f65e3c754383720ecf39aace5e190d4f51b8fed3944f265c900ae70253fe2707581ece25511a8b91c5
7
- data.tar.gz: bb0637b9720063cd402a32a520bb64e9bae258b920e7f638c533308a51afd735e0252e745bdf9506e1601df4ffdde8e59c36ad09ceff22a7e47f212b8c517c3b
6
+ metadata.gz: 36dcc060729037b66807f262eb4864fae2f8ca0d378a0bb77c20dce705ee72a9dadf109299ddd9dc1793c7545391b3fb254b3bbf2b87251b7f07c4a6c8576d62
7
+ data.tar.gz: cbf452a9e33468bf091cee8e5e02691883e3187bb2bb167f1df56da317904739b4a78369a54da02ad060e9f87ffc2e7af4de0cc6b146c967fbdde0299e1383dc
@@ -226,9 +226,11 @@ class CckForms::ParameterTypeClass::WorkHours
226
226
 
227
227
  open_until_last_client_html = unless options[:hide_open_until_last_client]
228
228
  <<HTML
229
- <div class="checkbox">
230
- <label class="form_work_hours_option">#{form_builder.check_box :open_until_last_client} <nobr>#{I18n.t 'cck_forms.work_hours.until_last_client'}</nobr></label>
231
- </div>
229
+ <li class="nav-item">
230
+ <a class="nav-link">
231
+ #{form_builder.check_box :open_until_last_client} #{I18n.t 'cck_forms.work_hours.until_last_client'}
232
+ </a>
233
+ </li>
232
234
  HTML
233
235
  end
234
236
 
@@ -237,21 +239,25 @@ HTML
237
239
  <div class="form_work_hours_time">
238
240
  #{header}
239
241
  </div>
242
+ <div class="form_work_hours_time form-inline">
243
+ <div class="form_work_hours_selects">
244
+ <span class="form_work_hours_select">
245
+ <span>#{I18n.t 'cck_forms.work_hours.time_from'}</span> #{open_time_form}
246
+ </span>
247
+ <span class="form_work_hours_select">
248
+ <span>#{I18n.t 'cck_forms.work_hours.time_till'}</span> #{close_time_form}
249
+ </span>
250
+ </div>
251
+ </div>
240
252
  <div class="form_work_hours_time">
241
- <table width="100%">
242
- <tr>
243
- <td width="60%" class="form-inline">
244
- #{I18n.t 'cck_forms.work_hours.time_from'} #{open_time_form}
245
- #{I18n.t 'cck_forms.work_hours.time_till'} #{close_time_form}
246
- </td>
247
- <td width="40%">
248
- <div class="checkbox">
249
- <label class="form_work_hours_option">#{form_builder.check_box :open_24_hours} #{I18n.t 'cck_forms.work_hours.24h'}</label>
250
- </div>
251
- #{open_until_last_client_html}
252
- </td>
253
- </tr>
254
- </table>
253
+ <ul class="nav nav-pills">
254
+ <li class="nav-item">
255
+ <a class="nav-link">
256
+ #{form_builder.check_box :open_24_hours} #{I18n.t 'cck_forms.work_hours.24h'}
257
+ </a>
258
+ </li>
259
+ #{open_until_last_client_html}
260
+ </ul>
255
261
  </div>
256
262
  </div>
257
263
  HTML
@@ -1,3 +1,3 @@
1
1
  module CckForms
2
- VERSION = '3.6.0'
2
+ VERSION = '3.6.1'
3
3
  end
@@ -166,10 +166,12 @@ $(function() {
166
166
  * days are grouped by the same "work value" (checkboxes & open/close time):
167
167
  *
168
168
  * > [^] Mon [^] Tue [^] Wed [^] Thu [^] Fri [_] Sat [_] Sun
169
- * > from [09]:[00] till [20]:[00] [_] open 24 hours [_] open until last client
169
+ * > from [09]:[00] till [20]:[00]
170
+ * > [_] open 24 hours [_] open until last client
170
171
  *
171
172
  * > [_] Mon [_] Tue [_] Wed [_] Thu [_] Fri [^] Sat [^] Sun
172
- * > from [10]:[00] till [__]:[__] [_] open 24 hours [^] open until last client
173
+ * > from [10]:[00] till [__]:[__]
174
+ * > [_] open 24 hours [^] open until last client
173
175
  *
174
176
  * [ Add days ]
175
177
  *
@@ -200,7 +202,7 @@ $(function() {
200
202
  $widget.createGroup([], []);
201
203
  });
202
204
 
203
- this._lastP = $('<p></p>').appendTo($form).append($addGroupLink);
205
+ this._lastP = $('<p class="form_work_hours_add_days"></p>').appendTo($form).append($addGroupLink);
204
206
 
205
207
  this._$template = $form.find(".form_work_hours_day_template");
206
208
 
@@ -239,7 +241,7 @@ $(function() {
239
241
  var newHtml = this._$template[0].outerHTML.replace(/((?:id|name)="[^"]*)template([^"]*")/g, "$1" + this.newGroupId() + "$2");
240
242
  var $newGroup = $(newHtml);
241
243
 
242
- // mark checkboxes
244
+ // mark day checkboxes
243
245
  for(var i = 0, ic = days.length; i < ic; ++ i) {
244
246
  $newGroup
245
247
  .find("input[name$=\"[days]\"][value=" + days[i] + "]")
@@ -249,7 +251,7 @@ $(function() {
249
251
  }
250
252
 
251
253
  // hide checkboxes, link-o-buttons will be in their place
252
- $newGroup.find("input[name$=\"[days]\"]").hide();
254
+ $newGroup.find("input[type=checkbox]").hide();
253
255
  $newGroup.find(".nav-pills").on("click", "a", function(event) {
254
256
  // skip events originated at checkbox inside this link
255
257
  if(event.target == this) {
@@ -266,6 +268,12 @@ $(function() {
266
268
 
267
269
  // make HTML & instantiate widget workhoursday
268
270
  $newGroup.workhoursday().workhoursday("value", value).insertBefore(this._lastP).show();
271
+
272
+ // highlight checked checkboxes
273
+ $newGroup
274
+ .find("input[name$=\"[open_24_hours]\"]:checked, input[name$=\"[open_until_last_client]\"]:checked")
275
+ .closest(".nav-link").addClass("active") // Bootstrap 4
276
+ .closest(".nav-item").addClass("active"); // Bootstrap 3
269
277
  },
270
278
 
271
279
  /**
@@ -330,23 +338,39 @@ $(function() {
330
338
  // open 24 hours? nullify open/close time
331
339
  case "open_24_hours":
332
340
  $group.workhoursday("openTime", {hours: '', minutes: ''}).workhoursday("closeTime", {hours: '', minutes: ''});
341
+
342
+ input.parentNode.className += " active"; // Bootstrap 4
343
+ input.parentNode.parentNode.className += " active"; // Bootstrap 3
333
344
  break;
334
345
 
335
346
  // open until last client? nullify close time
336
347
  case "open_until_last_client":
337
348
  $group.workhoursday("closeTime", {hours: '', minutes: ''});
349
+
350
+ input.parentNode.className += " active"; // Bootstrap 4
351
+ input.parentNode.parentNode.className += " active"; // Bootstrap 3
338
352
  break;
339
353
 
340
354
  // close time set? uncheck "open until last" checkbox
341
355
  case "close_time_hours":
342
356
  case "close_time_minutes":
343
357
  $group.workhoursday("openUntilLastClient", false);
358
+
359
+ $group
360
+ .find("input[name$=\"[open_until_last_client]\"]")
361
+ .closest(".nav-link").removeClass("active") // Bootstrap 4
362
+ .closest(".nav-item").removeClass("active"); // Bootstrap 3
344
363
  // break skipped on purpose!
345
364
 
346
365
  // any time set? uncheck "open 24h" checkbox
347
366
  case "open_time_hours":
348
367
  case "open_time_minutes":
349
368
  $group.workhoursday("open24Hours", false);
369
+
370
+ $group
371
+ .find("input[name$=\"[open_24_hours]\"]")
372
+ .closest(".nav-link").removeClass("active") // Bootstrap 4
373
+ .closest(".nav-item").removeClass("active"); // Bootstrap 3
350
374
  break;
351
375
  }
352
376
 
@@ -356,6 +380,13 @@ $(function() {
356
380
  $group.workhoursday(camelCasedTime, {minutes: 0})
357
381
  }
358
382
 
383
+ // input unchecked
384
+ } else if(inputNodeName == "input" && !input.checked && (fieldName == "open_24_hours" || fieldName == "open_until_last_client")) {
385
+
386
+ // remove active class
387
+ input.parentNode.className = input.parentNode.className.replace(/(^|\s)active($|\s)/, "$1"); // Bootstrap 4
388
+ input.parentNode.parentNode.className = input.parentNode.parentNode.className.replace(/(^|\s)active($|\s)/, "$1"); // Bootstrap 3
389
+
359
390
  // not input
360
391
  } else {
361
392
 
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.6.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Konanykhin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-26 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
- rubygems_version: 3.0.9
120
+ rubygems_version: 3.0.3
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Content Construction Kit Forms