cck_forms 3.5.3 → 3.6.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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ac913bdb00f008ff4928945481a137270c4002c162e96c827f2d076b4ab24fb
|
4
|
+
data.tar.gz: 6466bf72731c201e6d3386d85e3db8f42dacd12b14377bc69c616307873ececb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36dcc060729037b66807f262eb4864fae2f8ca0d378a0bb77c20dce705ee72a9dadf109299ddd9dc1793c7545391b3fb254b3bbf2b87251b7f07c4a6c8576d62
|
7
|
+
data.tar.gz: cbf452a9e33468bf091cee8e5e02691883e3187bb2bb167f1df56da317904739b4a78369a54da02ad060e9f87ffc2e7af4de0cc6b146c967fbdde0299e1383dc
|
@@ -53,7 +53,7 @@ class CckForms::ParameterTypeClass::WorkHours
|
|
53
53
|
met_days.reject! { |_, value| value }
|
54
54
|
|
55
55
|
met_days.keys.each do |day_name|
|
56
|
-
form_builder.fields_for(:value, index: day_name) { |day_builder| result << CckForms::ParameterTypeClass::WorkHours::WorkHoursDay.new(day: day_name, open_24_hours:
|
56
|
+
form_builder.fields_for(:value, index: day_name) { |day_builder| result << CckForms::ParameterTypeClass::WorkHours::WorkHoursDay.new(day: day_name, open_24_hours: false).build_form(day_builder) }
|
57
57
|
end
|
58
58
|
|
59
59
|
form_builder.fields_for(:template) do |day_builder|
|
@@ -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
|
-
<
|
230
|
-
<
|
231
|
-
|
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
|
-
<
|
242
|
-
<
|
243
|
-
<
|
244
|
-
#{I18n.t 'cck_forms.work_hours.
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
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
|
data/lib/cck_forms/version.rb
CHANGED
@@ -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]
|
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 [__]:[__]
|
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,13 +241,17 @@ $(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
|
-
$newGroup
|
246
|
+
$newGroup
|
247
|
+
.find("input[name$=\"[days]\"][value=" + days[i] + "]")
|
248
|
+
.prop("checked", true)
|
249
|
+
.closest(".nav-link").addClass("active") // Bootstrap 4
|
250
|
+
.closest(".nav-item").addClass("active"); // Bootstrap 3
|
245
251
|
}
|
246
252
|
|
247
253
|
// hide checkboxes, link-o-buttons will be in their place
|
248
|
-
$newGroup.find("input[
|
254
|
+
$newGroup.find("input[type=checkbox]").hide();
|
249
255
|
$newGroup.find(".nav-pills").on("click", "a", function(event) {
|
250
256
|
// skip events originated at checkbox inside this link
|
251
257
|
if(event.target == this) {
|
@@ -262,6 +268,12 @@ $(function() {
|
|
262
268
|
|
263
269
|
// make HTML & instantiate widget workhoursday
|
264
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
|
265
277
|
},
|
266
278
|
|
267
279
|
/**
|
@@ -289,7 +301,8 @@ $(function() {
|
|
289
301
|
this._days[dayName].workhoursday("value", $group.workhoursday("value"));
|
290
302
|
|
291
303
|
// mark the day as active
|
292
|
-
input.parentNode.className += " active";
|
304
|
+
input.parentNode.className += " active"; // Bootstrap 4
|
305
|
+
input.parentNode.parentNode.className += " active"; // Bootstrap 3
|
293
306
|
|
294
307
|
} else {
|
295
308
|
|
@@ -300,7 +313,8 @@ $(function() {
|
|
300
313
|
if($group.find("input:checked[name$='[days]']").size() == 0) {
|
301
314
|
$group.remove();
|
302
315
|
} else {
|
303
|
-
input.parentNode.className = input.parentNode.className.replace(/(^|\s)active($|\s)/, "$1");
|
316
|
+
input.parentNode.className = input.parentNode.className.replace(/(^|\s)active($|\s)/, "$1"); // Bootstrap 4
|
317
|
+
input.parentNode.parentNode.className = input.parentNode.parentNode.className.replace(/(^|\s)active($|\s)/, "$1"); // Bootstrap 3
|
304
318
|
}
|
305
319
|
}
|
306
320
|
|
@@ -324,23 +338,39 @@ $(function() {
|
|
324
338
|
// open 24 hours? nullify open/close time
|
325
339
|
case "open_24_hours":
|
326
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
|
327
344
|
break;
|
328
345
|
|
329
346
|
// open until last client? nullify close time
|
330
347
|
case "open_until_last_client":
|
331
348
|
$group.workhoursday("closeTime", {hours: '', minutes: ''});
|
349
|
+
|
350
|
+
input.parentNode.className += " active"; // Bootstrap 4
|
351
|
+
input.parentNode.parentNode.className += " active"; // Bootstrap 3
|
332
352
|
break;
|
333
353
|
|
334
354
|
// close time set? uncheck "open until last" checkbox
|
335
355
|
case "close_time_hours":
|
336
356
|
case "close_time_minutes":
|
337
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
|
338
363
|
// break skipped on purpose!
|
339
364
|
|
340
365
|
// any time set? uncheck "open 24h" checkbox
|
341
366
|
case "open_time_hours":
|
342
367
|
case "open_time_minutes":
|
343
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
|
344
374
|
break;
|
345
375
|
}
|
346
376
|
|
@@ -350,6 +380,13 @@ $(function() {
|
|
350
380
|
$group.workhoursday(camelCasedTime, {minutes: 0})
|
351
381
|
}
|
352
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
|
+
|
353
390
|
// not input
|
354
391
|
} else {
|
355
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.
|
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:
|
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.
|
120
|
+
rubygems_version: 3.0.3
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Content Construction Kit Forms
|