drg_cms 0.6.0.8 → 0.6.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -10
- data/app/assets/javascripts/drg_cms/drg_cms.js +208 -81
- data/app/assets/stylesheets/drg_cms/drg_cms.css +298 -93
- data/app/assets/stylesheets/drg_cms/select-multiple.css +1 -1
- data/app/controllers/cmsedit_controller.rb +174 -167
- data/app/controllers/dc_application_controller.rb +230 -196
- data/app/controllers/dc_common_controller.rb +88 -50
- data/app/controls/dc_help_control.rb +138 -0
- data/app/controls/dc_report.rb +12 -16
- data/app/forms/all_options.yml +14 -5
- data/app/forms/cms_menu.yml +7 -1
- data/app/forms/dc_big_table.yml +0 -2
- data/app/forms/dc_big_table_value.yml +0 -2
- data/app/forms/dc_category.yml +2 -1
- data/app/forms/dc_design.yml +2 -2
- data/app/forms/dc_folder_permission.yml +0 -2
- data/app/forms/dc_help_1.yml +110 -0
- data/app/forms/dc_journal.yml +3 -1
- data/app/forms/dc_json_ld.yml +0 -3
- data/app/forms/dc_link.yml +1 -1
- data/app/forms/dc_menu.yml +8 -12
- data/app/forms/dc_menu_item.yml +2 -3
- data/app/forms/dc_page.yml +7 -2
- data/app/forms/dc_part.yml +1 -0
- data/app/forms/dc_piece.yml +1 -0
- data/app/forms/dc_policy.yml +2 -5
- data/app/forms/dc_poll.yml +13 -16
- data/app/forms/dc_seo.yml +1 -2
- data/app/forms/dc_simple_menu.yml +3 -2
- data/app/forms/dc_site.yml +5 -8
- data/app/forms/dc_user.yml +27 -11
- data/app/forms/dc_user_role.yml +3 -0
- data/app/helpers/cms_common_helper.rb +68 -4
- data/app/helpers/cms_edit_helper.rb +73 -55
- data/app/helpers/cms_helper.rb +70 -32
- data/app/helpers/cms_index_helper.rb +155 -102
- data/app/helpers/dc_application_helper.rb +132 -109
- data/app/models/concerns/dc_page_concern.rb +14 -4
- data/app/models/concerns/dc_piece_concern.rb +1 -1
- data/app/models/concerns/dc_policy_rule_concern.rb +20 -8
- data/app/models/concerns/dc_site_concern.rb +56 -44
- data/app/models/concerns/dc_user_concern.rb +58 -19
- data/app/models/dc_big_table.rb +2 -2
- data/app/models/dc_design.rb +29 -19
- data/app/models/dc_filter.rb +28 -22
- data/app/models/dc_key_value_store.rb +1 -0
- data/app/models/dc_permission.rb +19 -9
- data/app/models/dc_policy.rb +25 -14
- data/app/models/dc_policy_role.rb +22 -11
- data/app/models/dc_temp.rb +8 -1
- data/app/models/dc_user_role.rb +2 -2
- data/app/models/drgcms_form_fields/comment.rb +11 -2
- data/app/models/drgcms_form_fields/date_picker.rb +2 -0
- data/app/models/drgcms_form_fields/drgcms_field.rb +2 -1
- data/app/models/drgcms_form_fields/embedded.rb +9 -10
- data/app/models/drgcms_form_fields/file_field.rb +1 -1
- data/app/models/drgcms_form_fields/file_select.rb +2 -2
- data/app/models/drgcms_form_fields/hash_field.rb +11 -7
- data/app/models/drgcms_form_fields/link_to.rb +2 -2
- data/app/models/drgcms_form_fields/method.rb +5 -4
- data/app/models/drgcms_form_fields/multitext_autocomplete.rb +1 -1
- data/app/models/drgcms_form_fields/number_field.rb +4 -3
- data/app/models/drgcms_form_fields/readonly.rb +13 -17
- data/app/models/drgcms_form_fields/select.rb +24 -25
- data/app/models/drgcms_form_fields/text_autocomplete.rb +22 -14
- data/app/renderers/dc_page_renderer.rb +7 -6
- data/app/renderers/dc_poll_renderer.rb +16 -20
- data/app/views/cmsedit/_edit_stuff.html.erb +5 -2
- data/app/views/cmsedit/_form.html.erb +3 -2
- data/app/views/cmsedit/_result.html.erb +21 -18
- data/app/views/cmsedit/edit.html.erb +4 -1
- data/app/views/cmsedit/index.html.erb +3 -2
- data/app/views/cmsedit/new.html.erb +5 -2
- data/app/views/dc_common/_help.html.erb +17 -0
- data/app/views/layouts/models.html.erb +2 -1
- data/config/locales/drgcms_en.yml +17 -2
- data/config/locales/drgcms_sl.yml +20 -2
- data/config/locales/models_en.yml +7 -5
- data/config/locales/models_sl.yml +12 -9
- data/drg_cms.gemspec +16 -16
- data/lib/drg_cms/version.rb +1 -1
- data/lib/drg_cms.rb +94 -2
- metadata +32 -30
- data/app/models/__dc_dummy.rb +0 -102
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be7dfed0ede6cbd81a93dbefbd517a2cb3d31151339a1bd3598ebde7e76993e9
|
4
|
+
data.tar.gz: d028640f11c1877e4f6eb4efe44f8fdd9306047678b9d731daeab3e56fb32749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f5617503a1c85ce1b5bf2a9d3460a33525ba96e20a82a84b85e7adc6f370a576f97b2e76aa57ff424243958046b396e0c4c2a3529a8ba0f763ef43cbe92f450
|
7
|
+
data.tar.gz: 9e716e8fca1ae6330bd74139512fb952d88600ca42d8cd4c5690e8271fb9a50b3e624e72fbcdc7df5ee820a4cd466fc8c6c2b1f5c58b5b9261afb1d076905237
|
data/README.md
CHANGED
@@ -1,12 +1,26 @@
|
|
1
1
|
# DrgCms
|
2
2
|
|
3
|
-
DRG CMS is advanced way of programming application for Ruby on Rails.
|
3
|
+
DRG CMS is advanced way of programming application for Ruby on Rails.
|
4
|
+
Instead of creating controllers and views for each collection (table),
|
5
|
+
DRG CMS introduces single Cmsedit controller. All CRUD database actions are
|
6
|
+
controlled by DRG Forms file, which can have hundreds of data entry fields
|
7
|
+
and still be easy to maintain and update.
|
4
8
|
|
5
|
-
DRG CMS uses
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
DRG CMS uses MongoDB, leading NO-SQL document database, as database back-end
|
10
|
+
with a help of mongoid gem. Mongoid's flexible document model defines all
|
11
|
+
document fields, indexes, dependencies, validations in single model source file with
|
12
|
+
no Rails migrations required. When collection model is defined, data entry DRG Form
|
13
|
+
can easily be generated with form generator.
|
14
|
+
|
15
|
+
DRG CMS can be used for rapid development of complex, data-entry intensive web
|
16
|
+
sites as well as building your private, in-house, Intranet applications. At
|
17
|
+
the same time it can be used as CMS system with support for running
|
18
|
+
multiple web sites on single Ruby on Rails instance.
|
19
|
+
|
20
|
+
DRG CMS has built-in user friendly role based database access system. Administrator
|
21
|
+
defines roles and roles rights (no access, can read, can edit) as web site policies.
|
22
|
+
Roles are then assigned to users and policies can be assigned to documents (web pages)
|
23
|
+
or even parts of a document.
|
10
24
|
|
11
25
|
Project Tracking
|
12
26
|
----------------
|
@@ -16,9 +30,10 @@ Project Tracking
|
|
16
30
|
Compatibility
|
17
31
|
-------------
|
18
32
|
|
19
|
-
DRG CMS is
|
20
|
-
|
21
|
-
|
33
|
+
DRG CMS is being actively developed since 2012 and has been live tested in production
|
34
|
+
since beginning. It runs against latest technology Ruby (3.0), Rails (6.1)
|
35
|
+
and MongoDB (4.4) and had so far little or no problems advancing to latest versions
|
36
|
+
of required programs.
|
22
37
|
|
23
38
|
Documentation
|
24
39
|
-------------
|
@@ -29,7 +44,7 @@ Please see the DRG CMS website for up-to-date documentation:
|
|
29
44
|
License (MIT LICENCE)
|
30
45
|
---------------------
|
31
46
|
|
32
|
-
Copyright (c) 2012-
|
47
|
+
Copyright (c) 2012-2021 Damjan Rems
|
33
48
|
|
34
49
|
Permission is hereby granted, free of charge, to any person obtaining
|
35
50
|
a copy of this software and associated documentation files (the
|
@@ -47,16 +47,16 @@ dumpAttributes = function(obj) {
|
|
47
47
|
* selected tab and triggers iframe reload.
|
48
48
|
*******************************************************************/
|
49
49
|
update_embedded_on_tab_select = function(div_name) {
|
50
|
-
|
50
|
+
let iframes = $(div_name).find("iframe");
|
51
51
|
$.each(iframes, function(index, iframe) {
|
52
52
|
// delayed load
|
53
|
-
|
53
|
+
let src_delay = iframe.getAttribute('data-src-delay');
|
54
54
|
if (src_delay != null && src_delay != '') {
|
55
55
|
iframe.setAttribute('data-src-delay', '');
|
56
56
|
iframe.setAttribute('src', src_delay);
|
57
57
|
}
|
58
58
|
// always load on tab select
|
59
|
-
|
59
|
+
let src_always = iframe.getAttribute('data-src-always');
|
60
60
|
if (src_always != null) {
|
61
61
|
iframe.setAttribute('src', src_always);
|
62
62
|
}
|
@@ -184,26 +184,23 @@ $(function() {
|
|
184
184
|
*******************************************************************/
|
185
185
|
|
186
186
|
process_json_result = function(json) {
|
187
|
-
|
187
|
+
let i, w, operation, selector, msg_div, field;
|
188
188
|
$.each(json, function(key, value) {
|
189
189
|
i = key.search('_');
|
190
190
|
if (i > 1) {
|
191
|
-
operation = key.substring(0,i);
|
192
|
-
selector = key.substring(i+1,100);
|
191
|
+
operation = key.substring(0, i);
|
192
|
+
selector = key.substring(i+1, 100);
|
193
193
|
} else {
|
194
194
|
operation = key;
|
195
195
|
selector = '';
|
196
196
|
}
|
197
|
-
|
197
|
+
|
198
198
|
switch (operation) {
|
199
199
|
|
200
200
|
/**** update fields on form ****/
|
201
201
|
case 'record':
|
202
|
-
|
203
|
-
var name = key.replace('record_','record[') + ']';
|
202
|
+
let name = key.replace('record_','record[') + ']';
|
204
203
|
field = $('[name="' + name + '"]');
|
205
|
-
console.log(field.attr('type'));
|
206
|
-
console.log(field.is('select'));
|
207
204
|
// checkbox field
|
208
205
|
if (field.is(':checkbox')) {
|
209
206
|
field.prop('checked', value);
|
@@ -229,21 +226,33 @@ process_json_result = function(json) {
|
|
229
226
|
}
|
230
227
|
break;
|
231
228
|
|
229
|
+
/**** transfer focus to field ****/
|
230
|
+
case 'focus':
|
231
|
+
$('#' + value).focus();
|
232
|
+
break;
|
233
|
+
|
232
234
|
/**** display message ****/
|
233
235
|
case 'msg':
|
234
|
-
msg_div = 'dc-form-' + selector;
|
235
|
-
if ( $('.'+msg_div).length == 0 ) {
|
236
|
+
let msg_div = 'dc-form-' + selector;
|
237
|
+
if ( $('.' + msg_div).length == 0 ) {
|
236
238
|
value = '<div class="' + msg_div + '">' + value + '</div>';
|
237
239
|
$('.dc-title').after(value);
|
238
240
|
} else {
|
239
|
-
$('.'+msg_div).html(value);
|
241
|
+
$('.' + msg_div).html(value);
|
242
|
+
$('.' + msg_div).show();
|
240
243
|
}
|
241
244
|
break;
|
242
245
|
|
243
246
|
/**** display popup message ****/
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
+
case 'popup':
|
248
|
+
if (selector == 'url') {
|
249
|
+
$('#popup').bPopup({ loadUrl: value });
|
250
|
+
}
|
251
|
+
else {
|
252
|
+
$('#popup').html(value);
|
253
|
+
$('#popup').bPopup({speed: 650, transition: 'slideUp', position: ['auto',1]});
|
254
|
+
}
|
255
|
+
break;
|
247
256
|
|
248
257
|
/**** update div ****/
|
249
258
|
case '#div+':
|
@@ -269,12 +278,16 @@ process_json_result = function(json) {
|
|
269
278
|
case 'url':
|
270
279
|
window.location.href = value;
|
271
280
|
break;
|
281
|
+
case 'parenturl':
|
282
|
+
parent.location.href = value;
|
283
|
+
break;
|
272
284
|
case 'alert':
|
273
285
|
alert(value);
|
274
286
|
break;
|
275
287
|
case 'window':
|
276
288
|
if (value == 'close') { window.close();
|
277
|
-
} else if (value == 'reload') {
|
289
|
+
} else if (value == 'reload') {
|
290
|
+
window.location.href = window.location.href;
|
278
291
|
} else {
|
279
292
|
w = window.open(value, selector);
|
280
293
|
w.focus();
|
@@ -292,8 +305,11 @@ process_json_result = function(json) {
|
|
292
305
|
eval (value);
|
293
306
|
break;
|
294
307
|
case 'reload':
|
308
|
+
value = value.toString();
|
295
309
|
if (value == 'parent') {
|
296
|
-
parent.location.reload();
|
310
|
+
//parent.location.reload();
|
311
|
+
parent.location.href = parent.location.href;
|
312
|
+
|
297
313
|
/*** this would be current window (reload: true) ****/
|
298
314
|
} else if (value.length < 5) {
|
299
315
|
window.location.href = window.location.href;
|
@@ -315,6 +331,15 @@ function dc_reload_window() {
|
|
315
331
|
location.reload();
|
316
332
|
}
|
317
333
|
|
334
|
+
/*******************************************************************
|
335
|
+
* Will open popup window
|
336
|
+
*******************************************************************/
|
337
|
+
function popup_window(url, window_name, win, w, h) {
|
338
|
+
let y = win.top.outerHeight / 2 + win.top.screenY - ( h / 2);
|
339
|
+
let x = win.top.outerWidth / 2 + win.top.screenX - ( w / 2);
|
340
|
+
return win.open(url, window_name, `toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${w}, height=${h}, top=${y}, left=${x}`);
|
341
|
+
}
|
342
|
+
|
318
343
|
/*******************************************************************
|
319
344
|
* Will select first editable input field on form. Works only when tab
|
320
345
|
* is selected. Still have to find out, what to do on initial display.
|
@@ -344,17 +369,38 @@ $.fn.dc_scroll_view = function () {
|
|
344
369
|
* Updates single field on parent iframe form of embedded form.
|
345
370
|
*******************************************************************/
|
346
371
|
process_parent_form_updates = function(element) {
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
372
|
+
let field = element.getAttribute("data-field");
|
373
|
+
let value = element.getAttribute("data-value");
|
374
|
+
let selector = '#' + field;
|
375
|
+
|
376
|
+
// update record
|
377
|
+
if (field.match(/record/)) {
|
378
|
+
if (window.parent.$(selector).length > 0) {
|
379
|
+
if (field.substring(0, 3) === 'td_') { // readonly field
|
380
|
+
window.parent.$(selector + ' > div').html(value);
|
381
|
+
} else { // input field
|
382
|
+
window.parent.$(selector).val(value);
|
383
|
+
}
|
384
|
+
}
|
385
|
+
// any div
|
386
|
+
} else {
|
387
|
+
if (window.parent.$(selector).length > 0) {
|
388
|
+
window.parent.$(selector).html(value);
|
354
389
|
}
|
355
390
|
}
|
356
391
|
};
|
357
392
|
|
393
|
+
/*****************************************************************
|
394
|
+
* Toggle show and hide div
|
395
|
+
******************************************************************/
|
396
|
+
dc_toggle_div = function(div) {
|
397
|
+
if ($(div).is(":visible")) {
|
398
|
+
$(div).slideUp();
|
399
|
+
} else {
|
400
|
+
$(div).slideDown();
|
401
|
+
}
|
402
|
+
};
|
403
|
+
|
358
404
|
/*******************************************************************
|
359
405
|
*
|
360
406
|
*******************************************************************/
|
@@ -431,19 +477,54 @@ $(document).ready( function() {
|
|
431
477
|
* Sort action clicked on cmsedit
|
432
478
|
*******************************************************************/
|
433
479
|
$('.drgcms_sort').change( function(e) {
|
434
|
-
|
435
|
-
|
436
|
-
|
480
|
+
let table = e.target.getAttribute("data-table");
|
481
|
+
let form = e.target.getAttribute("data-form");
|
482
|
+
if (form === null) form = table;
|
483
|
+
let sort = e.target.value;
|
437
484
|
e.target.value = null;
|
438
485
|
window.location.href = "/cmsedit?sort=" + sort + "&table=" + table + "&form_name=" + form;
|
439
486
|
});
|
440
|
-
|
487
|
+
|
488
|
+
/*******************************************************************
|
489
|
+
* Click on dc-check-all icon. Check or uncheck all checkboxes
|
490
|
+
*******************************************************************/
|
491
|
+
$('.dc-check-all').on('click',function(e) {
|
492
|
+
let checkboxes = $('.dc-check');
|
493
|
+
if ($(this).hasClass('fa-check-square-o')) {
|
494
|
+
// check all checkboxes
|
495
|
+
checkboxes.each( function() {
|
496
|
+
$(this).prop('checked', true);
|
497
|
+
$(this).parent().closest('div').addClass('dc-checked');
|
498
|
+
});
|
499
|
+
$(this).removeClass('fa-check-square-o').addClass('fa-square-o');
|
500
|
+
} else {
|
501
|
+
// uncheck all checkboxes
|
502
|
+
checkboxes.each( function() {
|
503
|
+
$(this).prop('checked', false);
|
504
|
+
$(this).parent().closest('div').removeClass('dc-checked');
|
505
|
+
});
|
506
|
+
$(this).removeClass('fa-square-o').addClass('fa-check-square-o');
|
507
|
+
}
|
508
|
+
});
|
509
|
+
|
510
|
+
/*******************************************************************
|
511
|
+
* Click on dc-check icon. Change color of background of element
|
512
|
+
*******************************************************************/
|
513
|
+
$('.dc-check').on('click',function(e) {
|
514
|
+
let parent = $(this).parent().closest('div');
|
515
|
+
if ($(this).prop('checked')) {
|
516
|
+
parent.addClass('dc-checked');
|
517
|
+
} else {
|
518
|
+
parent.removeClass('dc-checked');
|
519
|
+
}
|
520
|
+
});
|
521
|
+
|
441
522
|
/*******************************************************************
|
442
523
|
* Tab clicked on form. Hide old and show selected div.
|
443
524
|
*******************************************************************/
|
444
525
|
$('.dc-form-li').on('click', function(e) {
|
445
526
|
// find li with dc-form-li-selected class. This is our old tab
|
446
|
-
|
527
|
+
let old_tab_id = null;
|
447
528
|
$(e.target).parents('ul').find('li').each( function() {
|
448
529
|
if ($(this).hasClass('dc-form-li-selected')) {
|
449
530
|
// when not already selected toggle dc-form-li-selected class and save old tab
|
@@ -461,11 +542,11 @@ $(document).ready( function() {
|
|
461
542
|
$('#data_' + e.target.getAttribute("data-div")).toggleClass('div-hidden');
|
462
543
|
|
463
544
|
// resize parent iframe to fit selected tab size
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
545
|
+
let div_height = document.body.scrollHeight;
|
546
|
+
let frame = window.frameElement
|
547
|
+
if (frame === null) frame = document.body;
|
548
|
+
frame.style.height = div_height.toString() + 'px';
|
549
|
+
|
469
550
|
select_first_input_field('#data_' + e.target.getAttribute("data-div"));
|
470
551
|
update_embedded_on_tab_select('#data_' + e.target.getAttribute("data-div"));
|
471
552
|
}
|
@@ -476,10 +557,10 @@ $(document).ready( function() {
|
|
476
557
|
* unless on initial display.
|
477
558
|
*******************************************************************/
|
478
559
|
$('#iframe_cms').on('load', function() {
|
479
|
-
new_height = this.contentWindow.document.body.offsetHeight + 50;
|
560
|
+
let new_height = this.contentWindow.document.body.offsetHeight + 50;
|
480
561
|
if (new_height < 500 && new_height > 60) new_height = 500;
|
481
562
|
this.style.height = new_height + 'px';
|
482
|
-
// scroll to top
|
563
|
+
// scroll to top
|
483
564
|
$('#iframe_cms').dc_scroll_view();
|
484
565
|
});
|
485
566
|
|
@@ -488,52 +569,81 @@ $(document).ready( function() {
|
|
488
569
|
* unless on initial display with no data
|
489
570
|
*******************************************************************/
|
490
571
|
$('#iframe_edit').on('load', function() {
|
491
|
-
// console.log(this.contentWindow.document.body.offsetHeight);
|
492
572
|
if (this.contentWindow.document.body.offsetHeight > 10) {
|
493
573
|
this.style.height = (this.contentWindow.document.body.offsetHeight + 30) + 'px';
|
494
|
-
|
574
|
+
|
495
575
|
$('#iframe_edit').dc_scroll_view();
|
496
576
|
}
|
497
577
|
});
|
498
|
-
|
578
|
+
|
579
|
+
/*******************************************************************
|
580
|
+
* Same goes for iframe_embedded. Resize it + 30px
|
581
|
+
*******************************************************************/
|
582
|
+
$('.iframe_embedded').on('load', function() {
|
583
|
+
let embedded_height = this.contentWindow.document.body.offsetHeight;
|
584
|
+
// workaround. It gets tricky when embedded field is on tab
|
585
|
+
if (embedded_height == 0) embedded_height = 50;
|
586
|
+
this.style.height = (embedded_height + 30) + 'px';
|
587
|
+
// resize parent iframe window too
|
588
|
+
let parentWindow = this.contentWindow.parent;
|
589
|
+
let parent_height = (parentWindow.document.body.offsetHeight + 30) + 'px';
|
590
|
+
//parentWindow.frameElement.setAttribute('style', 'height:' + parent_height);
|
591
|
+
parentWindow.frameElement.style.height = parent_height;
|
592
|
+
});
|
593
|
+
|
499
594
|
/*******************************************************************
|
500
595
|
* Process Ajax call on cmsedit form actions
|
501
596
|
*******************************************************************/
|
502
597
|
$('.dc-link-ajax').on('click', function(e) {
|
503
598
|
// confirmation if required
|
504
599
|
if (confirmation_is_cancled(this)) {return false;}
|
505
|
-
|
600
|
+
|
601
|
+
// url must be specified in data-url
|
602
|
+
let url = this.getAttribute("data-url");
|
603
|
+
if (url.length < 5) return false;
|
604
|
+
|
506
605
|
// check HTML5 validations
|
507
606
|
if ($("form")[0] && !$("form")[0].checkValidity() ) {
|
508
607
|
$("form")[0].reportValidity();
|
509
608
|
return false;
|
510
609
|
}
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
610
|
+
|
611
|
+
let data = {};
|
612
|
+
let request = this.getAttribute("data-request");
|
613
|
+
switch (request) {
|
614
|
+
case 'script':
|
615
|
+
eval(this.getAttribute("data-script"));
|
616
|
+
return false;
|
617
|
+
|
618
|
+
case 'post':
|
619
|
+
data = $('form').serialize();
|
620
|
+
break;
|
621
|
+
|
622
|
+
default:
|
623
|
+
request = 'get'; // by default
|
519
624
|
}
|
520
|
-
|
521
|
-
|
522
|
-
|
625
|
+
|
626
|
+
// add checkbox id-s to data if checkboxes present
|
627
|
+
let checkboxes = $('.dc-check');
|
628
|
+
if (checkboxes.length > 0) {
|
629
|
+
let checked = [];
|
630
|
+
checkboxes.each( function() {
|
631
|
+
if ($(this).prop('checked')) checked.push($(this).attr("id"));
|
632
|
+
})
|
633
|
+
data['checked'] = checked;
|
523
634
|
}
|
524
|
-
|
525
|
-
$('.dc-spinner').show();
|
635
|
+
|
636
|
+
$('.dc-spinner').show();
|
526
637
|
$.ajax({
|
527
|
-
url:
|
528
|
-
type:
|
638
|
+
url: url,
|
639
|
+
type: request,
|
529
640
|
dataType: "json",
|
530
641
|
data: data,
|
531
642
|
success: function(data) {
|
532
643
|
process_json_result(data);
|
533
644
|
$('.dc-spinner').hide();
|
534
645
|
}
|
535
|
-
|
536
|
-
});
|
646
|
+
});
|
537
647
|
});
|
538
648
|
|
539
649
|
/*******************************************************************
|
@@ -636,9 +746,8 @@ $(document).ready( function() {
|
|
636
746
|
* data from with text_autocomplete and data doesn't exist in belongs_to table.
|
637
747
|
*******************************************************************/
|
638
748
|
$('.in-edit-add').on('click', function(e) {
|
639
|
-
url = '/cmsedit/new?table=' + this.getAttribute("data-table");
|
640
|
-
|
641
|
-
w = window.open(url, '', 'chrome=yes,width=800,height=600,resizable,scrollbars=yes,status=1,centerscreen=yes,modal=yes');
|
749
|
+
let url = '/cmsedit/new?window_close=0&table=' + this.getAttribute("data-table");
|
750
|
+
let w = popup_window(url, '', window, 1000, 800);
|
642
751
|
w.focus();
|
643
752
|
});
|
644
753
|
|
@@ -648,13 +757,9 @@ $(document).ready( function() {
|
|
648
757
|
**********************************************************************/
|
649
758
|
$('#filter_field').on('change', function() {
|
650
759
|
if (this.value.length > 0) {
|
651
|
-
name = 'filter_' + this.value;
|
760
|
+
let name = 'filter_' + this.value;
|
652
761
|
$(this).parents('form').find('span').each( function() {
|
653
|
-
|
654
|
-
element = $(this).find(':first').attr('id');
|
655
|
-
sometimes it is the second element
|
656
|
-
if (element == nil) { element = $(this).find(':first').next().attr('id');}
|
657
|
-
*/
|
762
|
+
|
658
763
|
if ($(this).attr('id') == name) {
|
659
764
|
if ( $(this).hasClass('div-hidden') ) { $(this).toggleClass('div-hidden'); }
|
660
765
|
} else {
|
@@ -736,8 +841,8 @@ element = $(this).find(':first').attr('id');
|
|
736
841
|
* Fire action (by default show document) when doubleclicked on result row
|
737
842
|
*******************************************************************/
|
738
843
|
$('.dc-result tr').on('dblclick', function(e) {
|
739
|
-
url = String( this.getAttribute("data-dblclick") );
|
740
|
-
// prevent when data-dblclick not set
|
844
|
+
let url = String( this.getAttribute("data-dblclick") );
|
845
|
+
// prevent when data-dblclick not set
|
741
846
|
if (url.length > 5) {
|
742
847
|
e.preventDefault();
|
743
848
|
location.href = url;
|
@@ -748,8 +853,8 @@ element = $(this).find(':first').attr('id');
|
|
748
853
|
* Fire action (by default show document) when doubleclicked on result row
|
749
854
|
*******************************************************************/
|
750
855
|
$('.dc-result-data').on('dblclick', function(e) {
|
751
|
-
url = String( this.getAttribute("data-dblclick") );
|
752
|
-
// prevent when data-dblclick not set
|
856
|
+
let url = String( this.getAttribute("data-dblclick") );
|
857
|
+
// prevent when data-dblclick not set
|
753
858
|
if (url.length > 5) {
|
754
859
|
e.preventDefault();
|
755
860
|
location.href = url;
|
@@ -798,9 +903,16 @@ element = $(this).find(':first').attr('id');
|
|
798
903
|
* work on all field types.
|
799
904
|
*******************************************************************/
|
800
905
|
$('.record_filter_field_icon').on('click', function(e) {
|
801
|
-
|
802
|
-
|
803
|
-
|
906
|
+
let field = $('#_record__filter_field');
|
907
|
+
let url = $(this).parents('span').attr("data-url");
|
908
|
+
let value = null;
|
909
|
+
|
910
|
+
if (field.is(':checkbox')) {
|
911
|
+
value = field.is(':checked'); }
|
912
|
+
else {
|
913
|
+
value = field.val();
|
914
|
+
}
|
915
|
+
url = url + "&filter_value=" + value;
|
804
916
|
location.href = url;
|
805
917
|
});
|
806
918
|
|
@@ -1002,8 +1114,8 @@ element = $(this).find(':first').attr('id');
|
|
1002
1114
|
return;
|
1003
1115
|
}
|
1004
1116
|
// retrieve name of current field and set it in popup
|
1005
|
-
|
1006
|
-
|
1117
|
+
let header = $(this).closest('.th');
|
1118
|
+
let field_name = header.attr("data-name");
|
1007
1119
|
$('.filter-popup').attr('data-name', field_name);
|
1008
1120
|
// change popup position and show
|
1009
1121
|
$('.filter-popup').css({'top':e.pageY+5,'left':e.pageX, 'position':'absolute'});
|
@@ -1015,15 +1127,30 @@ element = $(this).find(':first').attr('id');
|
|
1015
1127
|
* filter on action.
|
1016
1128
|
*******************************************************************/
|
1017
1129
|
$('.filter-popup li').click( function(e) {
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1130
|
+
let url = $(this).data('url');
|
1131
|
+
let operator = $(this).data('operator');
|
1132
|
+
let parent = $(this).closest('.filter-popup');
|
1133
|
+
let field_name = parent.data("name");
|
1022
1134
|
|
1023
1135
|
url = url + '&filter_field=' + field_name + '&filter_oper=' + operator;
|
1024
1136
|
window.location.href = url;
|
1025
1137
|
});
|
1026
1138
|
|
1139
|
+
/*****************************************************************
|
1140
|
+
* Toggle div
|
1141
|
+
******************************************************************/
|
1142
|
+
$(".dc-handle").click(function() {
|
1143
|
+
let div = this.getAttribute("data-div");
|
1144
|
+
dc_toggle_div(div);
|
1145
|
+
});
|
1146
|
+
|
1147
|
+
/*******************************************************************
|
1148
|
+
* Show-Hide CMS menu on hamburger click
|
1149
|
+
*******************************************************************/
|
1150
|
+
$('#menu-hamburger').on('click', function(e) {
|
1151
|
+
$('.cmsedit-container #menu').toggleClass('visible');
|
1152
|
+
});
|
1153
|
+
|
1027
1154
|
});
|
1028
1155
|
|
1029
1156
|
/*******************************************************************
|