drg_cms 0.6.1.5 → 0.6.1.6
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/app/assets/fonts/ibm-plex-sans-300.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-400.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-500.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-600.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-700.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-italic.woff2 +0 -0
- data/app/assets/javascripts/drg_cms/drg_cms.js +62 -24
- data/app/assets/stylesheets/drg_cms/drg_cms.css +80 -27
- data/app/controllers/cmsedit_controller.rb +3 -1
- data/app/controllers/dc_application_controller.rb +1 -1
- data/app/controls/design_element_settings_control.rb +1 -1
- data/app/forms/all_options.yml +22 -6
- data/app/forms/dc_site.yml +2 -5
- data/app/helpers/cms_index_helper.rb +9 -5
- data/app/models/concerns/dc_site_concern.rb +9 -3
- data/app/models/dc_site.rb +0 -1
- data/app/models/drgcms_form_fields/select.rb +2 -2
- data/app/models/drgcms_form_fields/text_autocomplete.rb +19 -11
- data/app/views/layouts/cms.html.erb +3 -5
- data/lib/drg_cms/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36ffde8dc003d78a30e69a2a1f45530841829c5b66d247e7bcece0d3c94a1a15
|
4
|
+
data.tar.gz: 3e1c6a0762f22cce3500de3c4ee0e2258c25f6f39a2aa3dc82f3febd15535449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 562e2196260eefc0999249e1c0e871cda94b7fd2d303482d39314ec2eb6ae5ae4b32545b8a85c4434a28042d9c2c8b9f2c9dc0a1b1be3a0ec49d20cddece7aef
|
7
|
+
data.tar.gz: 03d0849a4040d4b99cf4b8c3b682e77b6c333ad562453700703b49a18d408d2e88555777051cf0b8f61d059ce4bf7e9f1670104f3e3ad786ea226c69c7217c08
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -207,7 +207,7 @@ process_json_result = function(json) {
|
|
207
207
|
// select field
|
208
208
|
} else if (field.is('select')) {
|
209
209
|
// options for select field
|
210
|
-
if (
|
210
|
+
if (Array.isArray(value)) {
|
211
211
|
field.empty();
|
212
212
|
$.each(value, function(index, v) {
|
213
213
|
field.append( new Option(v[0], v[1]) );
|
@@ -334,10 +334,12 @@ function dc_reload_window() {
|
|
334
334
|
/*******************************************************************
|
335
335
|
* Will open popup window
|
336
336
|
*******************************************************************/
|
337
|
-
function popup_window(url,
|
338
|
-
let y =
|
339
|
-
let x =
|
340
|
-
|
337
|
+
function popup_window(url, title, parent_win, w, h) {
|
338
|
+
let y = parent_win.top.outerHeight / 2 + parent_win.top.screenY - (h / 2);
|
339
|
+
let x = parent_win.top.outerWidth / 2 + parent_win.top.screenX - (w / 2);
|
340
|
+
let win = parent_win.open(url, 'dc_popup', `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
|
+
win.document.title = title;
|
342
|
+
return win;
|
341
343
|
}
|
342
344
|
|
343
345
|
/*******************************************************************
|
@@ -401,6 +403,15 @@ dc_toggle_div = function(div) {
|
|
401
403
|
}
|
402
404
|
};
|
403
405
|
|
406
|
+
/*****************************************************************
|
407
|
+
* Return value of the input field on a form
|
408
|
+
******************************************************************/
|
409
|
+
function dc_get_field_value(field_name) {
|
410
|
+
field_name = field_name.replace('record_', '');
|
411
|
+
let field = $('[name="record[' + field_name + ']"]');
|
412
|
+
return field.val();
|
413
|
+
}
|
414
|
+
|
404
415
|
/*******************************************************************
|
405
416
|
*
|
406
417
|
*******************************************************************/
|
@@ -642,6 +653,10 @@ $(document).ready( function() {
|
|
642
653
|
success: function(data) {
|
643
654
|
process_json_result(data);
|
644
655
|
$('.dc-spinner').hide();
|
656
|
+
},
|
657
|
+
error: function (request, status, error) {
|
658
|
+
$('.dc-spinner').css('color','red');
|
659
|
+
alert(request.responseText);
|
645
660
|
}
|
646
661
|
});
|
647
662
|
});
|
@@ -665,24 +680,35 @@ $(document).ready( function() {
|
|
665
680
|
form.setAttribute('action', url);
|
666
681
|
form.setAttribute('method', "post");
|
667
682
|
form.submit();
|
668
|
-
});
|
669
|
-
|
683
|
+
});
|
684
|
+
|
670
685
|
/*******************************************************************
|
671
|
-
|
686
|
+
Will open a new window with URL specified.
|
672
687
|
********************************************************************/
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
688
|
+
$('.dc-window-open').on('click', function(e) {
|
689
|
+
// confirmation if required
|
690
|
+
if (confirmation_is_cancled(this)) { return false; }
|
691
|
+
|
692
|
+
let url = this.getAttribute("data-url");
|
693
|
+
let title = this.getAttribute("title");
|
694
|
+
let w = this.getAttribute("data-x") || 1000;
|
695
|
+
let h = this.getAttribute("data-y") || 800;
|
696
|
+
// add fields values from current formto url
|
697
|
+
let fields = this.getAttribute("data-fields");
|
698
|
+
if (fields) {
|
699
|
+
let form_parms = '?';
|
700
|
+
// ? separator already in url
|
701
|
+
if (url.match(/\?/)) { form_parms = ''; }
|
702
|
+
fields.split(',').forEach( function(field) {
|
703
|
+
let value = dc_get_field_value(field);
|
704
|
+
if (value) {form_parms += '&' + field + '=' + value;}
|
705
|
+
});
|
706
|
+
url += form_parms;
|
707
|
+
}
|
708
|
+
|
709
|
+
let win = popup_window(url, title, window, w, h);
|
710
|
+
win.focus();
|
711
|
+
});
|
686
712
|
|
687
713
|
/*******************************************************************
|
688
714
|
* Animate button on click
|
@@ -738,15 +764,27 @@ $(document).ready( function() {
|
|
738
764
|
|
739
765
|
$('.dc-link-submit').on('click', function(e) {
|
740
766
|
$('.dc-spinner').show();
|
741
|
-
});
|
767
|
+
});
|
768
|
+
|
769
|
+
/*******************************************************************
|
770
|
+
* Hide spinner when validation error occured
|
771
|
+
*******************************************************************/
|
772
|
+
$(':input').on("invalid", function(event) {
|
773
|
+
$('.dc-spinner').hide();
|
774
|
+
});
|
742
775
|
|
743
776
|
/*******************************************************************
|
744
777
|
* Add button clicked while in edit. Create window dialog for adding new record
|
745
778
|
* into required table. This is helper scenario, when user is selecting
|
746
779
|
* data from with text_autocomplete and data doesn't exist in belongs_to table.
|
747
780
|
*******************************************************************/
|
748
|
-
$('.in-edit-add').on('click', function(e) {
|
749
|
-
let
|
781
|
+
$('.in-edit-add').on('click', function(e) {
|
782
|
+
let id = this.getAttribute("data-id");
|
783
|
+
let table = this.getAttribute("data-table");
|
784
|
+
let url = '/cmsedit/new?window_close=0&table=' + table;
|
785
|
+
if (id) {
|
786
|
+
url = '/cmsedit/' + id + '/edit?window_close=0&table=' + table;
|
787
|
+
}
|
750
788
|
let w = popup_window(url, '', window, 1000, 800);
|
751
789
|
w.focus();
|
752
790
|
});
|
@@ -23,7 +23,43 @@
|
|
23
23
|
#++
|
24
24
|
*/
|
25
25
|
|
26
|
-
@
|
26
|
+
@font-face {
|
27
|
+
font-family: DrgSans;
|
28
|
+
font-style: normal;
|
29
|
+
font-weight: 300;
|
30
|
+
src: url('ibm-plex-sans-300.woff2') format('woff2')
|
31
|
+
}
|
32
|
+
@font-face {
|
33
|
+
font-family: DrgSans;
|
34
|
+
font-style: normal;
|
35
|
+
font-weight: 400;
|
36
|
+
src: url('ibm-plex-sans-400.woff2') format('woff2')
|
37
|
+
}
|
38
|
+
@font-face {
|
39
|
+
font-family: DrgSans;
|
40
|
+
font-style: normal;
|
41
|
+
font-weight: 500;
|
42
|
+
src: url('ibm-plex-sans-500.woff2') format('woff2')
|
43
|
+
}
|
44
|
+
@font-face {
|
45
|
+
font-family: DrgSans;
|
46
|
+
font-style: normal;
|
47
|
+
font-weight: 600;
|
48
|
+
src: url('ibm-plex-sans-600.woff2') format('woff2')
|
49
|
+
}
|
50
|
+
@font-face {
|
51
|
+
font-family: DrgSans;
|
52
|
+
font-style: normal;
|
53
|
+
font-weight: 700;
|
54
|
+
src: url('ibm-plex-sans-700.woff2') format('woff2')
|
55
|
+
}
|
56
|
+
|
57
|
+
@font-face {
|
58
|
+
font-family: DrgSans;
|
59
|
+
font-style: italic;
|
60
|
+
font-weight: 400;
|
61
|
+
src: url('ibm-plex-sans-italic.woff2') format('woff2')
|
62
|
+
}
|
27
63
|
|
28
64
|
/* Web reset. Countributed by
|
29
65
|
/* http://meyerweb.com/eric/tools/css/reset/
|
@@ -78,8 +114,8 @@ table {
|
|
78
114
|
/* END */
|
79
115
|
|
80
116
|
body {
|
81
|
-
font-family:
|
82
|
-
font-size:
|
117
|
+
font-family: DrgSans,arial,sans-serif;
|
118
|
+
font-size: 15px;
|
83
119
|
margin: 0;
|
84
120
|
vertical-align: middle;
|
85
121
|
color: #000;
|
@@ -87,7 +123,7 @@ font-weight: 400;
|
|
87
123
|
}
|
88
124
|
|
89
125
|
button {
|
90
|
-
font-family:
|
126
|
+
font-family: DrgSans,arial,sans-serif;
|
91
127
|
}
|
92
128
|
|
93
129
|
|
@@ -97,7 +133,7 @@ padding: 6px 4px;
|
|
97
133
|
margin-left: 1px;
|
98
134
|
border: 1px dashed #888;;
|
99
135
|
border-radius: 2px;
|
100
|
-
font:
|
136
|
+
font: 15px DrgSans,arial,sans-serif;
|
101
137
|
max-width: 100%;
|
102
138
|
vertical-align: middle;
|
103
139
|
}
|
@@ -204,7 +240,7 @@ border-radius: 1px;
|
|
204
240
|
|
205
241
|
.dc-result i {
|
206
242
|
padding: 2px;
|
207
|
-
font-size:
|
243
|
+
font-size: 15px;
|
208
244
|
vertical-align: initial;
|
209
245
|
}
|
210
246
|
|
@@ -515,7 +551,7 @@ border: solid 1px #ccc;;
|
|
515
551
|
border-radius: 0;
|
516
552
|
background: transparent;
|
517
553
|
line-height: 30px;
|
518
|
-
font-size:
|
554
|
+
font-size: 15px;
|
519
555
|
}
|
520
556
|
|
521
557
|
.dc-submit:hover {
|
@@ -702,7 +738,7 @@ color: #aaa;
|
|
702
738
|
|
703
739
|
.dc-readonly {
|
704
740
|
display: inline-block;
|
705
|
-
font-size:
|
741
|
+
font-size: 15px;
|
706
742
|
font-weight: normal;
|
707
743
|
color: #222;
|
708
744
|
padding: 6px 4px;
|
@@ -736,7 +772,7 @@ margin-bottom: -3px;
|
|
736
772
|
|
737
773
|
.dc-spinner {
|
738
774
|
float:left;
|
739
|
-
padding:
|
775
|
+
padding: 0.8em 2px 0;
|
740
776
|
display: none;
|
741
777
|
}
|
742
778
|
|
@@ -754,7 +790,7 @@ margin-bottom: -3px;
|
|
754
790
|
margin: 0 1px 0 0;
|
755
791
|
border-left: 1px solid #ddd;
|
756
792
|
border-right: 1px solid #ddd;
|
757
|
-
border-radius: 4px 4px 0
|
793
|
+
border-radius: 4px 4px 0 0;
|
758
794
|
}
|
759
795
|
|
760
796
|
.dc-form-li:hover, .dc-form-li-selected {
|
@@ -809,7 +845,7 @@ display: flex;
|
|
809
845
|
color: #fff;
|
810
846
|
background-color: #000;
|
811
847
|
font-weight: bold;
|
812
|
-
font-size:
|
848
|
+
font-size: 15px;
|
813
849
|
box-shadow: 2px 2px 6px #666;
|
814
850
|
border-radius: 3px;
|
815
851
|
}
|
@@ -843,7 +879,7 @@ display: flex;
|
|
843
879
|
}
|
844
880
|
|
845
881
|
#cmsedit-div {
|
846
|
-
font-family:
|
882
|
+
font-family: DrgSans,Arial, sans-serif;
|
847
883
|
font-size: 13px;
|
848
884
|
line-height: 13px;
|
849
885
|
}
|
@@ -893,20 +929,17 @@ font-size: 1.2em;
|
|
893
929
|
}
|
894
930
|
|
895
931
|
.cmsedit-container #menu {
|
896
|
-
|
932
|
+
display: inline-block;
|
933
|
+
min-width: 20%;
|
897
934
|
height: 100%;
|
935
|
+
font-size: 15px;
|
936
|
+
font-weight: 600;
|
937
|
+
color: #222;
|
898
938
|
background-color: #fcfcfc;
|
899
|
-
border: 1px solid #eee;
|
900
|
-
border-radius: 1px;
|
901
|
-
}
|
902
|
-
|
903
|
-
.cmsedit-container #menu {
|
904
|
-
display: inline-block;
|
905
939
|
padding: 4px 0;
|
906
940
|
margin: 4px;
|
907
|
-
|
908
|
-
|
909
|
-
font-weight: 600;
|
941
|
+
border: 1px solid #eee;
|
942
|
+
border-radius: 1px;
|
910
943
|
}
|
911
944
|
|
912
945
|
.cmsedit-container .fa {
|
@@ -1439,7 +1472,7 @@ color: #669;
|
|
1439
1472
|
|
1440
1473
|
/****** MOBILE DEVICE *****/
|
1441
1474
|
@media only screen and (max-device-width: 600px) {
|
1442
|
-
body
|
1475
|
+
#body-cms {font-size: 11px;}
|
1443
1476
|
#site-top div:nth-of-type(2) {padding-top: 0 !important;}
|
1444
1477
|
|
1445
1478
|
.dc-form {
|
@@ -1461,16 +1494,29 @@ color: #669;
|
|
1461
1494
|
white-space: nowrap;
|
1462
1495
|
}
|
1463
1496
|
.dc-form-label label {
|
1464
|
-
font-size:
|
1497
|
+
font-size: 15px;
|
1465
1498
|
}
|
1466
1499
|
|
1467
1500
|
.app-menu li {margin-bottom: 4px;}
|
1468
1501
|
|
1502
|
+
.dc-menu { padding: 0;}
|
1503
|
+
|
1469
1504
|
.dc-submit {
|
1470
|
-
|
1471
|
-
line-height: 26px;
|
1505
|
+
line-height: 20px;
|
1472
1506
|
font-size: 11px;
|
1473
1507
|
}
|
1508
|
+
.dc-link div, .dc-link-no {
|
1509
|
+
padding: 4px 8px;
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
.dc-animate a:link, .dc-animate a:active, .dc-animate a:visited,
|
1513
|
+
.dc-result a:link, .dc-result a:active, .dc-result a:visited {
|
1514
|
+
padding: 4px 7px;
|
1515
|
+
}
|
1516
|
+
.dc-action-menu li {padding: 4px 6px;}
|
1517
|
+
.dc-action-menu li.dc-link.plus-link {padding: 4px 0;}
|
1518
|
+
.dc-title .dc-paginate {float: left;}
|
1519
|
+
|
1474
1520
|
#result {width: 200%;}
|
1475
1521
|
|
1476
1522
|
.dc-separator {
|
@@ -1496,8 +1542,15 @@ color: #669;
|
|
1496
1542
|
font-size: 2em;
|
1497
1543
|
}
|
1498
1544
|
|
1545
|
+
.cmsedit-container {display: block;}
|
1499
1546
|
.cmsedit-container #menu {display: none;}
|
1500
|
-
.cmsedit-container #menu.visible {
|
1547
|
+
.cmsedit-container #menu.visible {
|
1548
|
+
display: initial;
|
1549
|
+
width: 200%;
|
1550
|
+
font-weight: 500;
|
1551
|
+
border: none;
|
1552
|
+
margin: 0;
|
1553
|
+
}
|
1501
1554
|
.cmsedit-iframe {padding-left: 2px;}
|
1502
1555
|
}
|
1503
1556
|
|
@@ -783,9 +783,10 @@ end
|
|
783
783
|
def process_return_to(return_to)
|
784
784
|
script = case
|
785
785
|
when return_to == 'index' then return index
|
786
|
+
when return_to.match(/eval=/i) then return_to.sub('eval=', '')
|
786
787
|
when return_to.match(/parent\.reload/i) then 'parent.location.href=parent.location.href;'
|
787
788
|
when return_to.match(/reload/i) then 'location.href=location.href;'
|
788
|
-
when return_to.match(/close/i) then 'window.close();'
|
789
|
+
when return_to.match(/window.close/i) then 'window.close();'
|
789
790
|
when return_to.match(/none/i) then return
|
790
791
|
else "location.href='#{return_to}'"
|
791
792
|
end
|
@@ -829,6 +830,7 @@ def save_data
|
|
829
830
|
value = DrgcmsFormFields.const_get(v['type'].camelize).get_data(params, v['name'])
|
830
831
|
@record.send("#{v['name']}=", value)
|
831
832
|
end
|
833
|
+
|
832
834
|
# before_save callback
|
833
835
|
if (m = callback_method('before_save') )
|
834
836
|
ret = call_callback_method(m)
|
@@ -257,7 +257,7 @@ def dc_set_options(parameters)
|
|
257
257
|
return if parameters.to_s.size < 3
|
258
258
|
# parameters are set as YAML. This should be default in future.
|
259
259
|
parms = YAML.load(parameters) rescue {}
|
260
|
-
@options.
|
260
|
+
@options = @options.deep_merge(parms)
|
261
261
|
end
|
262
262
|
|
263
263
|
##########################################################################
|
@@ -58,7 +58,7 @@ def get_settings()
|
|
58
58
|
# Check fild name
|
59
59
|
begin
|
60
60
|
document = model.find(params[:id])
|
61
|
-
params[:field_name] ||= (params[:location] == 'dc_site' ? '
|
61
|
+
params[:field_name] ||= (params[:location] == 'dc_site' ? 'settings' : 'params')
|
62
62
|
# field not defined on document
|
63
63
|
raise unless document.respond_to?(params[:field_name])
|
64
64
|
yaml = document[params[:field_name]] || ''
|
data/app/forms/all_options.yml
CHANGED
@@ -51,6 +51,14 @@ index:
|
|
51
51
|
eval: ModulClassName.menu_for(self)
|
52
52
|
caption: Some caption
|
53
53
|
|
54
|
+
# result_set method
|
55
|
+
result_set:
|
56
|
+
type: method
|
57
|
+
eval: my_helper_method
|
58
|
+
# or
|
59
|
+
view: path_to/_partial
|
60
|
+
|
61
|
+
# result_set default
|
54
62
|
result_set:
|
55
63
|
filter: custom_filter
|
56
64
|
footer: custom_footer
|
@@ -140,8 +148,15 @@ form:
|
|
140
148
|
method: (get),put,post
|
141
149
|
caption: ajax_call
|
142
150
|
control: control_name.method_to_call
|
143
|
-
|
144
|
-
|
151
|
+
show: default || always || readonly
|
152
|
+
|
153
|
+
active: not_new_record
|
154
|
+
active: new_record
|
155
|
+
active: SomeClass.is_active_method
|
156
|
+
or
|
157
|
+
active:
|
158
|
+
method: SomeClass.is_active_method
|
159
|
+
|
145
160
|
5:
|
146
161
|
type: window
|
147
162
|
controller: cmsedit
|
@@ -150,15 +165,17 @@ form:
|
|
150
165
|
action: edit
|
151
166
|
method: (get),put,post
|
152
167
|
caption: Edit linked document
|
153
|
-
when_new: false
|
154
168
|
params:
|
155
169
|
id:
|
156
170
|
object: record (can be omitted)
|
157
171
|
method: page_id
|
158
172
|
user:
|
159
173
|
object: session
|
160
|
-
method: user_id
|
161
|
-
|
174
|
+
method: user_id
|
175
|
+
html:
|
176
|
+
data-x: 800
|
177
|
+
data-y: 400
|
178
|
+
data-fields: field1,field2,...
|
162
179
|
6:
|
163
180
|
type: script
|
164
181
|
caption: Cancle
|
@@ -166,7 +183,6 @@ form:
|
|
166
183
|
7:
|
167
184
|
type: submit
|
168
185
|
caption: Send
|
169
|
-
when_new: false
|
170
186
|
params:
|
171
187
|
before-save: send_mail
|
172
188
|
after-save: return_to parent.reload
|
data/app/forms/dc_site.yml
CHANGED
@@ -84,12 +84,8 @@ form:
|
|
84
84
|
name: document_extension
|
85
85
|
type: text_field
|
86
86
|
size: 10
|
87
|
-
25:
|
88
|
-
name: site_layout
|
89
|
-
type: text_field
|
90
|
-
size: 20
|
91
87
|
30:
|
92
|
-
name:
|
88
|
+
name: site_layout
|
93
89
|
type: text_field
|
94
90
|
size: 20
|
95
91
|
40:
|
@@ -152,3 +148,4 @@ form:
|
|
152
148
|
caption: false
|
153
149
|
type: embedded
|
154
150
|
form_name: dc_part
|
151
|
+
load: delay
|
@@ -358,7 +358,7 @@ def dc_header_for_result
|
|
358
358
|
label = t(label) if label.match(/\./)
|
359
359
|
# no sorting when embedded documents or custom filter is active
|
360
360
|
#sort_ok = @form['result_set'].nil? || (@form['result_set'] && @form['result_set']['filter'].nil?)
|
361
|
-
sort_ok =
|
361
|
+
sort_ok = !dc_dont?(@form['result_set']['sort'], false)
|
362
362
|
sort_ok = sort_ok || (@form['index'] && @form['index']['sort'])
|
363
363
|
sort_ok = sort_ok && !dc_dont?(v['sort'], false)
|
364
364
|
if @tables.size == 1 and sort_ok
|
@@ -606,11 +606,15 @@ end
|
|
606
606
|
# When result set is to be drawn by Rails helper method.
|
607
607
|
############################################################################
|
608
608
|
def dc_process_result_set_method
|
609
|
-
|
610
|
-
|
611
|
-
send method
|
609
|
+
if @form['result_set']['view']
|
610
|
+
render partial: @form['result_set']['view']
|
612
611
|
else
|
613
|
-
|
612
|
+
method = @form['result_set']['eval'] || 'result_set_eval_misssing'
|
613
|
+
if respond_to?(method)
|
614
|
+
send method
|
615
|
+
else
|
616
|
+
I18n.t('drgcms.no_method', method: method)
|
617
|
+
end
|
614
618
|
end
|
615
619
|
end
|
616
620
|
|
@@ -40,7 +40,6 @@ field :css, type: String, default: ''
|
|
40
40
|
field :route_name, type: String, default: ''
|
41
41
|
field :page_title, type: String
|
42
42
|
field :document_extension, type: String
|
43
|
-
field :page_table, type: String
|
44
43
|
field :page_class, type: String, default: 'DcPage'
|
45
44
|
field :site_layout, type: String, default: 'content'
|
46
45
|
field :menu_class, type: String, default: 'DcSimpleMenu'
|
@@ -87,10 +86,17 @@ def params(what=nil)
|
|
87
86
|
end
|
88
87
|
|
89
88
|
########################################################################
|
90
|
-
# Returns class object of collection
|
89
|
+
# Returns class object of page collection
|
91
90
|
########################################################################
|
92
91
|
def page_klass
|
93
|
-
|
92
|
+
page_class.classify.constantize
|
93
|
+
end
|
94
|
+
|
95
|
+
########################################################################
|
96
|
+
# Returns collection name for page collection
|
97
|
+
########################################################################
|
98
|
+
def page_table
|
99
|
+
page_class.underscore
|
94
100
|
end
|
95
101
|
|
96
102
|
########################################################################
|
data/app/models/dc_site.rb
CHANGED
@@ -38,7 +38,6 @@
|
|
38
38
|
# route_name String Default route name for creating page link. ex. page. Leave blank if not used.
|
39
39
|
# page_title String Default page title displayed in browser's top menu when title can not be extracted from document
|
40
40
|
# document_extension String Default document extension eg. html
|
41
|
-
# page_table String Name of table holding data for pages
|
42
41
|
# page_class String Rails model class name which defines table holding pages data usually DcPage
|
43
42
|
# site_layout String Rails layout used to draw response. This is by default content layout.
|
44
43
|
# menu_class String Rails model class name which defines table holding menu data usually DcMenu
|
@@ -191,9 +191,8 @@ def render
|
|
191
191
|
# separate options and html part
|
192
192
|
html_part = {}
|
193
193
|
@yaml['html'].symbolize_keys!
|
194
|
-
%i(class id style required).each { |sym| html_part[sym] = @yaml['html'].delete(sym) if
|
194
|
+
%i(class id style required).each { |sym| html_part[sym] = @yaml['html'].delete(sym) if @yaml['html'][sym] }
|
195
195
|
html_part[:multiple] = true if @yaml['multiple']
|
196
|
-
|
197
196
|
record = record_text_for(@yaml['name'])
|
198
197
|
if html_part[:multiple]
|
199
198
|
@html << @parent.select(record, @yaml['name'], get_choices, @yaml['html'], html_part)
|
@@ -222,4 +221,5 @@ def self.get_data(params, name)
|
|
222
221
|
end
|
223
222
|
|
224
223
|
end
|
224
|
+
|
225
225
|
end
|
@@ -29,7 +29,8 @@ module DrgcmsFormFields
|
|
29
29
|
# * +name:+ field name (required)
|
30
30
|
# * +type:+ text_autocomplete (required)
|
31
31
|
# * +table+ Collection (table) name. When defined search must contain field name
|
32
|
-
# * +with_new+ Will add an icon for shortcut to add new document to collection
|
32
|
+
# * +with_new+ Will add an icon for shortcut to add new document to related collection
|
33
|
+
# * +with_edit+ Will add an icon for shortcut to edit (view) related document
|
33
34
|
# * +is_id+ Field value represent value as id. If false, field will use entered value and not value selected with autocomplete. Default is true.
|
34
35
|
# * +search:+ Search may consist of three parameters from which are separated either by dot (.)
|
35
36
|
# * search_field_name; when table option is defined search must define field name which will be used for search query
|
@@ -43,8 +44,9 @@ module DrgcmsFormFields
|
|
43
44
|
# type: text_autocomplete
|
44
45
|
# search: dc_user.name
|
45
46
|
# is_id: false
|
46
|
-
#
|
47
|
-
#
|
47
|
+
# size: 30
|
48
|
+
# with_new: user
|
49
|
+
# with_edit: user
|
48
50
|
###########################################################################
|
49
51
|
class TextAutocomplete < DrgcmsField
|
50
52
|
|
@@ -58,8 +60,8 @@ def render
|
|
58
60
|
table = @yaml['search']['table']
|
59
61
|
ret_name = @yaml['search']['field']
|
60
62
|
method = @yaml['search']['method']
|
61
|
-
elsif @yaml['search'].match(
|
62
|
-
table, ret_name, method = @yaml['search'].split(
|
63
|
+
elsif @yaml['search'].match(/\.|\,| /)
|
64
|
+
table, ret_name, method = @yaml['search'].split(/\.|\,| /).map(&:strip)
|
63
65
|
else
|
64
66
|
ret_name = @yaml['search']
|
65
67
|
end
|
@@ -102,16 +104,22 @@ def render
|
|
102
104
|
@yaml['html'] ||= {}
|
103
105
|
@yaml['html']['value'] = value_displayed
|
104
106
|
@yaml['html']['placeholder'] ||= t('drgcms.search_placeholder') || nil
|
105
|
-
|
107
|
+
|
106
108
|
_name = '_' + @yaml['name']
|
107
109
|
record = record_text_for(@yaml['name'])
|
108
110
|
@html << '<span class="dc-text-autocomplete">' + @parent.text_field(record, _name, @yaml['html']) + '<span></span>'
|
111
|
+
# with new icon
|
109
112
|
if @yaml['with_new']
|
110
|
-
@html << ' ' +
|
111
|
-
|
112
|
-
|
113
|
+
@html << ' ' + @parent.fa_icon('plus-square lg', class: 'in-edit-add', title: t('drgcms.new'),
|
114
|
+
style: "vertical-align: top;", 'data-table' => @yaml['with_new'] )
|
115
|
+
end
|
116
|
+
# with edit icon
|
117
|
+
if @yaml['with_edit'] && @record[@yaml['name']].present?
|
118
|
+
@html << ' ' + @parent.fa_icon('edit lg', class: 'in-edit-add', title: t('drgcms.edit'),
|
119
|
+
style: "vertical-align: top;", 'data-table' => @yaml['with_edit'], 'data-id' => @record[@yaml['name']] )
|
113
120
|
end
|
114
|
-
@html << '</span>' + @parent.hidden_field(record, @yaml['name'], value: value)
|
121
|
+
@html << '</span>' + @parent.hidden_field(record, @yaml['name'], value: value) # actual value will be in hidden field
|
122
|
+
|
115
123
|
# JS stuff
|
116
124
|
# allow unselected values on is_id: false option
|
117
125
|
not_id_code = %(
|
@@ -119,7 +127,7 @@ if (ui.item == null) {
|
|
119
127
|
$("##{record}_#{@yaml['name']}").val($("##{record}__#{@yaml['name']}").val() );
|
120
128
|
return;
|
121
129
|
} ) if not_id
|
122
|
-
|
130
|
+
|
123
131
|
@js << <<EOJS
|
124
132
|
$(document).ready(function() {
|
125
133
|
$("##{record}_#{_name}").autocomplete( {
|
@@ -3,15 +3,13 @@
|
|
3
3
|
<head>
|
4
4
|
<title><%= @page_title %></title>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
|
6
8
|
<%= stylesheet_link_tag "cms", media: 'all' %>
|
7
|
-
<% if false %> not require in cms mode
|
8
|
-
<style type="text/css" media="all"><%= "#{@site.css if @site}#{@design.css if @design}\n#{@page.css if @page}".html_safe %></style>
|
9
|
-
<%= @site.header.html_safe if @site %>
|
10
|
-
<% end %>
|
11
9
|
<%= javascript_include_tag "cms" %>
|
12
10
|
<%= csrf_meta_tags %>
|
13
11
|
</head>
|
14
|
-
<body>
|
12
|
+
<body id="body-cms">
|
15
13
|
|
16
14
|
<%= yield %>
|
17
15
|
|
data/lib/drg_cms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.1.
|
4
|
+
version: 0.6.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -163,6 +163,12 @@ files:
|
|
163
163
|
- MIT-LICENSE
|
164
164
|
- README.md
|
165
165
|
- Rakefile
|
166
|
+
- app/assets/fonts/ibm-plex-sans-300.woff2
|
167
|
+
- app/assets/fonts/ibm-plex-sans-400.woff2
|
168
|
+
- app/assets/fonts/ibm-plex-sans-500.woff2
|
169
|
+
- app/assets/fonts/ibm-plex-sans-600.woff2
|
170
|
+
- app/assets/fonts/ibm-plex-sans-700.woff2
|
171
|
+
- app/assets/fonts/ibm-plex-sans-italic.woff2
|
166
172
|
- app/assets/images/32px.png
|
167
173
|
- app/assets/images/drg_cms/32px.png
|
168
174
|
- app/assets/images/drg_cms/40px.png
|