drg_cms 0.6.1.1.1 → 0.6.1.4
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 +4 -4
- data/README.md +25 -10
- data/app/assets/javascripts/drg_cms/drg_cms.js +99 -29
- data/app/assets/stylesheets/drg_cms/drg_cms.css +89 -12
- data/app/controllers/dc_application_controller.rb +60 -163
- data/app/controllers/dc_common_controller.rb +49 -45
- data/app/forms/all_options.yml +4 -1
- data/app/forms/dc_page.yml +4 -0
- data/app/helpers/cms_edit_helper.rb +31 -22
- data/app/helpers/cms_index_helper.rb +42 -21
- data/app/helpers/dc_application_helper.rb +31 -44
- data/app/models/concerns/dc_page_concern.rb +3 -2
- data/app/models/concerns/dc_piece_concern.rb +1 -1
- data/app/models/concerns/dc_site_concern.rb +1 -1
- data/app/models/concerns/dc_user_concern.rb +3 -3
- data/app/models/dc_filter.rb +16 -10
- 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 +4 -2
- 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 +8 -9
- data/app/models/drgcms_form_fields/text_autocomplete.rb +17 -11
- data/app/renderers/dc_page_renderer.rb +7 -6
- data/app/views/cmsedit/_edit_stuff.html.erb +5 -2
- data/app/views/cmsedit/edit.html.erb +2 -1
- data/app/views/cmsedit/index.html.erb +1 -1
- data/app/views/cmsedit/new.html.erb +3 -2
- data/config/locales/models_en.yml +2 -0
- data/config/locales/models_sl.yml +4 -3
- data/drg_cms.gemspec +16 -16
- data/lib/drg_cms/version.rb +1 -1
- data/lib/drg_cms.rb +44 -4
- metadata +29 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94829c523218c40d302d4ab63c76c016a540008b878c48e261691f15b54485f7
|
4
|
+
data.tar.gz: ce0c1134fc51e26f4c8439322223e50c071211416a230e674b86f25f81337f06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f569c43d27c468a545ed56a15822dee25c27bd3f8811eb28ccb1b388a323420135838b37f9590c3ac98a93d7484db283cf14c767a426d1a812c9597eb9f9c2
|
7
|
+
data.tar.gz: 91838e2e5bec0f8b91cea632e8047cfd53dcd2872de5c5d74b65834b64495498b617bcfee5cac4ae673aed2a8e61b5ceb7025f235a8795b6cc009a5e1fb279d7
|
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
|
@@ -184,12 +184,12 @@ $(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 = '';
|
@@ -226,6 +226,11 @@ process_json_result = function(json) {
|
|
226
226
|
}
|
227
227
|
break;
|
228
228
|
|
229
|
+
/**** transfer focus to field ****/
|
230
|
+
case 'focus':
|
231
|
+
$('#' + value).focus();
|
232
|
+
break;
|
233
|
+
|
229
234
|
/**** display message ****/
|
230
235
|
case 'msg':
|
231
236
|
let msg_div = 'dc-form-' + selector;
|
@@ -274,7 +279,7 @@ process_json_result = function(json) {
|
|
274
279
|
case 'window':
|
275
280
|
if (value == 'close') { window.close();
|
276
281
|
} else if (value == 'reload') {
|
277
|
-
location.
|
282
|
+
window.location.href = window.location.href;
|
278
283
|
} else {
|
279
284
|
w = window.open(value, selector);
|
280
285
|
w.focus();
|
@@ -294,10 +299,12 @@ process_json_result = function(json) {
|
|
294
299
|
case 'reload':
|
295
300
|
value = value.toString();
|
296
301
|
if (value == 'parent') {
|
297
|
-
parent.location.reload();
|
302
|
+
//parent.location.reload();
|
303
|
+
parent.location.href = parent.location.href;
|
304
|
+
|
298
305
|
/*** this would be current window (reload: true) ****/
|
299
306
|
} else if (value.length < 5) {
|
300
|
-
location.
|
307
|
+
window.location.href = window.location.href;
|
301
308
|
/*** reload iframe ****/
|
302
309
|
} else {
|
303
310
|
$( '#' + value ).attr('src', $( '#' + value ).attr('src'));
|
@@ -316,6 +323,15 @@ function dc_reload_window() {
|
|
316
323
|
location.reload();
|
317
324
|
}
|
318
325
|
|
326
|
+
/*******************************************************************
|
327
|
+
* Will open popup window
|
328
|
+
*******************************************************************/
|
329
|
+
function popup_window(url, window_name, win, w, h) {
|
330
|
+
let y = win.top.outerHeight / 2 + win.top.screenY - ( h / 2);
|
331
|
+
let x = win.top.outerWidth / 2 + win.top.screenX - ( w / 2);
|
332
|
+
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}`);
|
333
|
+
}
|
334
|
+
|
319
335
|
/*******************************************************************
|
320
336
|
* Will select first editable input field on form. Works only when tab
|
321
337
|
* is selected. Still have to find out, what to do on initial display.
|
@@ -453,13 +469,48 @@ $(document).ready( function() {
|
|
453
469
|
* Sort action clicked on cmsedit
|
454
470
|
*******************************************************************/
|
455
471
|
$('.drgcms_sort').change( function(e) {
|
456
|
-
|
457
|
-
|
458
|
-
|
472
|
+
let table = e.target.getAttribute("data-table");
|
473
|
+
let form = e.target.getAttribute("data-form");
|
474
|
+
if (form === null) form = table;
|
475
|
+
let sort = e.target.value;
|
459
476
|
e.target.value = null;
|
460
477
|
window.location.href = "/cmsedit?sort=" + sort + "&table=" + table + "&form_name=" + form;
|
461
478
|
});
|
462
|
-
|
479
|
+
|
480
|
+
/*******************************************************************
|
481
|
+
* Click on dc-check-all icon. Check or uncheck all checkboxes
|
482
|
+
*******************************************************************/
|
483
|
+
$('.dc-check-all').on('click',function(e) {
|
484
|
+
let checkboxes = $('.dc-check');
|
485
|
+
if ($(this).hasClass('fa-check-square-o')) {
|
486
|
+
// check all checkboxes
|
487
|
+
checkboxes.each( function() {
|
488
|
+
$(this).prop('checked', true);
|
489
|
+
$(this).parent().closest('div').addClass('dc-checked');
|
490
|
+
});
|
491
|
+
$(this).removeClass('fa-check-square-o').addClass('fa-square-o');
|
492
|
+
} else {
|
493
|
+
// uncheck all checkboxes
|
494
|
+
checkboxes.each( function() {
|
495
|
+
$(this).prop('checked', false);
|
496
|
+
$(this).parent().closest('div').removeClass('dc-checked');
|
497
|
+
});
|
498
|
+
$(this).removeClass('fa-square-o').addClass('fa-check-square-o');
|
499
|
+
}
|
500
|
+
});
|
501
|
+
|
502
|
+
/*******************************************************************
|
503
|
+
* Click on dc-check icon. Change color of background of element
|
504
|
+
*******************************************************************/
|
505
|
+
$('.dc-check').on('click',function(e) {
|
506
|
+
let parent = $(this).parent().closest('div');
|
507
|
+
if ($(this).prop('checked')) {
|
508
|
+
parent.addClass('dc-checked');
|
509
|
+
} else {
|
510
|
+
parent.removeClass('dc-checked');
|
511
|
+
}
|
512
|
+
});
|
513
|
+
|
463
514
|
/*******************************************************************
|
464
515
|
* Tab clicked on form. Hide old and show selected div.
|
465
516
|
*******************************************************************/
|
@@ -538,33 +589,46 @@ $(document).ready( function() {
|
|
538
589
|
$('.dc-link-ajax').on('click', function(e) {
|
539
590
|
// confirmation if required
|
540
591
|
if (confirmation_is_cancled(this)) {return false;}
|
541
|
-
|
592
|
+
|
593
|
+
// url must be specified in data-url
|
594
|
+
let url = this.getAttribute("data-url");
|
595
|
+
if (url.length < 5) return false;
|
596
|
+
|
542
597
|
// check HTML5 validations
|
543
598
|
if ($("form")[0] && !$("form")[0].checkValidity() ) {
|
544
599
|
$("form")[0].reportValidity();
|
545
600
|
return false;
|
546
601
|
}
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
602
|
+
|
603
|
+
let data = {};
|
604
|
+
let request = this.getAttribute("data-request");
|
605
|
+
switch (request) {
|
606
|
+
case 'script':
|
607
|
+
eval(this.getAttribute("data-script"));
|
608
|
+
return false;
|
609
|
+
|
610
|
+
case 'post':
|
611
|
+
data = $('form').serialize();
|
612
|
+
break;
|
613
|
+
|
614
|
+
default:
|
615
|
+
request = 'get'; // by default
|
559
616
|
}
|
560
617
|
|
561
|
-
|
562
|
-
|
618
|
+
// add checkbox id-s to data if checkboxes present
|
619
|
+
let checkboxes = $('.dc-check');
|
620
|
+
if (checkboxes.length > 0) {
|
621
|
+
let checked = [];
|
622
|
+
checkboxes.each( function() {
|
623
|
+
if ($(this).prop('checked')) checked.push($(this).attr("id"));
|
624
|
+
})
|
625
|
+
data['checked'] = checked;
|
626
|
+
}
|
563
627
|
|
564
628
|
$('.dc-spinner').show();
|
565
629
|
$.ajax({
|
566
630
|
url: url,
|
567
|
-
type:
|
631
|
+
type: request,
|
568
632
|
dataType: "json",
|
569
633
|
data: data,
|
570
634
|
success: function(data) {
|
@@ -674,9 +738,8 @@ $(document).ready( function() {
|
|
674
738
|
* data from with text_autocomplete and data doesn't exist in belongs_to table.
|
675
739
|
*******************************************************************/
|
676
740
|
$('.in-edit-add').on('click', function(e) {
|
677
|
-
let url = '/cmsedit/new?table=' + this.getAttribute("data-table");
|
678
|
-
|
679
|
-
w = window.open(url, '', 'chrome=yes,width=800,height=600,resizable,scrollbars=yes,status=1,centerscreen=yes,modal=yes');
|
741
|
+
let url = '/cmsedit/new?window_close=0&table=' + this.getAttribute("data-table");
|
742
|
+
let w = popup_window(url, '', window, 1000, 800);
|
680
743
|
w.focus();
|
681
744
|
});
|
682
745
|
|
@@ -1073,6 +1136,13 @@ $(document).ready( function() {
|
|
1073
1136
|
dc_toggle_div(div);
|
1074
1137
|
});
|
1075
1138
|
|
1139
|
+
/*******************************************************************
|
1140
|
+
* Show-Hide CMS menu on hamburger click
|
1141
|
+
*******************************************************************/
|
1142
|
+
$('#menu-hamburger').on('click', function(e) {
|
1143
|
+
$('.cmsedit-container #menu').toggleClass('visible');
|
1144
|
+
});
|
1145
|
+
|
1076
1146
|
});
|
1077
1147
|
|
1078
1148
|
/*******************************************************************
|
@@ -175,11 +175,13 @@ img { vertical-align:bottom; }
|
|
175
175
|
padding: 7px;
|
176
176
|
}
|
177
177
|
|
178
|
+
/*
|
178
179
|
.dc-link a:hover, .dc-animate a:hover, .dc-result a:hover {
|
179
180
|
background: #f8f8f8;
|
180
181
|
transition: 0.3s;
|
181
182
|
color: #000;
|
182
183
|
}
|
184
|
+
*/
|
183
185
|
|
184
186
|
a.dc-animate:hover { color: #000; background: transparent;}
|
185
187
|
|
@@ -276,6 +278,10 @@ padding: 0;
|
|
276
278
|
align-items: center;
|
277
279
|
}
|
278
280
|
|
281
|
+
.dc-result-data .td:last-child {
|
282
|
+
flex-grow: 1;
|
283
|
+
}
|
284
|
+
|
279
285
|
.dc-result-data .actions, .dc-result-header .actions {
|
280
286
|
padding-right: 4px;
|
281
287
|
display: flex;
|
@@ -283,11 +289,14 @@ padding: 0;
|
|
283
289
|
justify-content: center;
|
284
290
|
white-space: nowrap;
|
285
291
|
}
|
286
|
-
|
287
292
|
.dc-result-header .actions {
|
288
293
|
background-color: #666;
|
289
294
|
}
|
290
295
|
|
296
|
+
.dc-result-data.dc-even.dc-checked, .dc-result-data.dc-odd.dc-checked {
|
297
|
+
background-color: #dbebff;
|
298
|
+
background-color: rgba(76,154,255, 0.6);
|
299
|
+
}
|
291
300
|
|
292
301
|
.dc-result-data .dc-link, .dc-result-data .dc-link-ajax {
|
293
302
|
background: none;
|
@@ -318,6 +327,18 @@ padding: 0;
|
|
318
327
|
background-color: transparent;
|
319
328
|
}
|
320
329
|
|
330
|
+
.dc-check {
|
331
|
+
padding-right: 4px;
|
332
|
+
}
|
333
|
+
|
334
|
+
.dc-result-header .dc-check-all {
|
335
|
+
font-size: 1.2em;
|
336
|
+
margin-left: -1rem;
|
337
|
+
background-color: white;
|
338
|
+
/* padding: 8px 5px; */
|
339
|
+
padding: 6px 3px;
|
340
|
+
}
|
341
|
+
|
321
342
|
.dc-menu {
|
322
343
|
padding: 4px 0;
|
323
344
|
display: inline-table;
|
@@ -328,7 +349,6 @@ display: inline-table;
|
|
328
349
|
margin-right: 3px;
|
329
350
|
}
|
330
351
|
|
331
|
-
|
332
352
|
#data-fields {margin: 5px;}
|
333
353
|
|
334
354
|
.dc-link {
|
@@ -380,7 +400,7 @@ border: 1px solid #ddd;
|
|
380
400
|
}
|
381
401
|
|
382
402
|
.dc-link-ajax.with-link {padding: 7px}
|
383
|
-
|
403
|
+
.cmsform .dc-link-ajax.with-link {padding: 0}
|
384
404
|
|
385
405
|
.dc-link-ajax i, .dc-link-no i {
|
386
406
|
padding: 1px 3px 0 0;
|
@@ -724,7 +744,6 @@ color: #aaa;
|
|
724
744
|
}
|
725
745
|
.dc-form-ul {
|
726
746
|
padding: 2px 0;
|
727
|
-
margin-top: 6px;
|
728
747
|
margin-bottom: -3px;
|
729
748
|
}
|
730
749
|
|
@@ -749,12 +768,10 @@ margin-bottom: -3px;
|
|
749
768
|
text-decoration: none;
|
750
769
|
text-align: center;
|
751
770
|
font-weight: 600;
|
752
|
-
line-height: 1.
|
753
|
-
|
754
|
-
padding:4px 15px;
|
755
|
-
background: #e8e8e8;
|
771
|
+
line-height: 1.2em;
|
772
|
+
padding: 0.4em 1em;
|
756
773
|
background: #666;
|
757
|
-
margin
|
774
|
+
margin: 0 1px 1px 0;
|
758
775
|
border-left: 1px solid #ddd;
|
759
776
|
border-right: 1px solid #ddd;
|
760
777
|
border-radius: 4px 4px 0 0;
|
@@ -834,6 +851,8 @@ display: flex;
|
|
834
851
|
color: lightcoral;
|
835
852
|
}
|
836
853
|
|
854
|
+
#menu-hamburger { display: none;}
|
855
|
+
|
837
856
|
.dc-handle:before {
|
838
857
|
font-family: 'FontAwesome';
|
839
858
|
content: '\f0dc\20';
|
@@ -1216,6 +1235,19 @@ background-color: transparent;
|
|
1216
1235
|
color: #ccc;
|
1217
1236
|
}
|
1218
1237
|
|
1238
|
+
.dc-action-menu .dc-link:empty {
|
1239
|
+
display: none;
|
1240
|
+
}
|
1241
|
+
|
1242
|
+
.dc-action-menu li.spacer {
|
1243
|
+
border-right: 2px solid #888;
|
1244
|
+
border-radius: 0;
|
1245
|
+
padding: 7px 0;
|
1246
|
+
margin-right: 5px;
|
1247
|
+
}
|
1248
|
+
|
1249
|
+
/***** POPUP ******/
|
1250
|
+
|
1219
1251
|
#popup {
|
1220
1252
|
min-width: 50%;
|
1221
1253
|
}
|
@@ -1426,10 +1458,21 @@ color: #669;
|
|
1426
1458
|
}
|
1427
1459
|
|
1428
1460
|
/****** MOBILE DEVICE *****/
|
1429
|
-
@media only screen and (max-width: 600px) {
|
1461
|
+
@media only screen and (max-device-width: 600px) {
|
1462
|
+
body, .body {font-size: 11px !important;}
|
1463
|
+
#site-top div:nth-of-type(2) {padding-top: 0 !important;}
|
1464
|
+
|
1465
|
+
.dc-form {
|
1466
|
+
border: none;
|
1467
|
+
border-top: 2px solid #888;
|
1468
|
+
border-bottom: 2px solid #888;
|
1469
|
+
margin-top: 4px;
|
1470
|
+
}
|
1471
|
+
|
1430
1472
|
.dc-form .row-div {
|
1431
1473
|
display: block;
|
1432
1474
|
}
|
1475
|
+
.dc-form-li {margin-top: 3px;}
|
1433
1476
|
|
1434
1477
|
.dc-form-label {
|
1435
1478
|
text-align: left;
|
@@ -1437,11 +1480,45 @@ color: #669;
|
|
1437
1480
|
padding-bottom: 2px;
|
1438
1481
|
white-space: nowrap;
|
1439
1482
|
}
|
1483
|
+
.dc-form-label label {
|
1484
|
+
font-size: 14px;
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
.app-menu li {margin-bottom: 4px;}
|
1488
|
+
|
1489
|
+
.dc-submit {
|
1490
|
+
padding: 1px 0 0;
|
1491
|
+
line-height: 26px;
|
1492
|
+
font-size: 11px;
|
1493
|
+
}
|
1494
|
+
#result {width: 200%;}
|
1495
|
+
|
1496
|
+
.dc-separator {
|
1497
|
+
margin: 8px 0 0;
|
1498
|
+
border-top: 2px solid #888;
|
1499
|
+
}
|
1440
1500
|
|
1441
|
-
.dc-
|
1442
|
-
.dc-menu li {margin-top: 2px;}
|
1501
|
+
.dc-menu li {margin-bottom: 4px;}
|
1443
1502
|
|
1444
1503
|
.dc-width-10, .dc-width-14, .dc-width-21, .dc-width-85, .dc-width-100 {width: 100%;}
|
1504
|
+
|
1505
|
+
.dc-width-100 {
|
1506
|
+
overflow: auto;
|
1507
|
+
}
|
1508
|
+
|
1509
|
+
textarea, input, select {
|
1510
|
+
max-width: 90%;
|
1511
|
+
}
|
1512
|
+
|
1513
|
+
#menu-hamburger {
|
1514
|
+
display: block;
|
1515
|
+
padding: 4px;
|
1516
|
+
font-size: 2em;
|
1517
|
+
}
|
1518
|
+
|
1519
|
+
.cmsedit-container #menu {display: none;}
|
1520
|
+
.cmsedit-container #menu.visible {display: initial; width: 150%;}
|
1521
|
+
.cmsedit-iframe {padding-left: 2px;}
|
1445
1522
|
}
|
1446
1523
|
|
1447
1524
|
/******* Firefox only ********/
|