drg_cms 0.6.1.4 → 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/app/assets/javascripts/drg_cms/drg_cms.js +12 -4
- data/app/assets/stylesheets/drg_cms/drg_cms.css +29 -49
- data/app/controllers/cmsedit_controller.rb +26 -23
- data/app/controllers/dc_application_controller.rb +16 -1
- data/app/controllers/dc_common_controller.rb +7 -2
- data/app/controls/dc_help_control.rb +12 -0
- data/app/forms/dc_big_table.yml +0 -2
- data/app/forms/dc_big_table_value.yml +0 -2
- data/app/forms/dc_design.yml +1 -2
- data/app/forms/dc_folder_permission.yml +0 -2
- data/app/forms/dc_help_1.yml +2 -1
- data/app/forms/dc_json_ld.yml +0 -3
- data/app/forms/dc_menu.yml +6 -12
- data/app/forms/dc_menu_item.yml +1 -3
- data/app/forms/dc_page.yml +1 -2
- data/app/forms/dc_policy.yml +2 -5
- data/app/forms/dc_poll.yml +10 -16
- data/app/forms/dc_seo.yml +1 -2
- data/app/forms/dc_simple_menu.yml +1 -2
- data/app/forms/dc_site.yml +3 -2
- data/app/helpers/cms_common_helper.rb +1 -1
- data/app/helpers/cms_edit_helper.rb +9 -8
- data/app/helpers/cms_helper.rb +3 -3
- data/app/helpers/cms_index_helper.rb +19 -3
- data/app/helpers/dc_application_helper.rb +35 -7
- data/app/models/dc_big_table.rb +2 -2
- data/app/models/dc_filter.rb +17 -17
- data/app/models/dc_temp.rb +7 -0
- data/app/models/drgcms_form_fields/comment.rb +11 -2
- data/app/models/drgcms_form_fields/select.rb +6 -7
- data/app/views/cmsedit/_form.html.erb +3 -2
- data/app/views/cmsedit/_result.html.erb +21 -18
- data/config/locales/drgcms_en.yml +3 -2
- data/config/locales/drgcms_sl.yml +3 -2
- data/config/locales/models_sl.yml +1 -0
- data/lib/drg_cms/version.rb +1 -1
- data/lib/drg_cms.rb +2 -8
- metadata +2 -2
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
|
@@ -245,9 +245,14 @@ process_json_result = function(json) {
|
|
245
245
|
|
246
246
|
/**** display popup message ****/
|
247
247
|
case 'popup':
|
248
|
-
|
249
|
-
|
250
|
-
|
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;
|
251
256
|
|
252
257
|
/**** update div ****/
|
253
258
|
case '#div+':
|
@@ -273,6 +278,9 @@ process_json_result = function(json) {
|
|
273
278
|
case 'url':
|
274
279
|
window.location.href = value;
|
275
280
|
break;
|
281
|
+
case 'parenturl':
|
282
|
+
parent.location.href = value;
|
283
|
+
break;
|
276
284
|
case 'alert':
|
277
285
|
alert(value);
|
278
286
|
break;
|
@@ -574,7 +582,7 @@ $(document).ready( function() {
|
|
574
582
|
$('.iframe_embedded').on('load', function() {
|
575
583
|
let embedded_height = this.contentWindow.document.body.offsetHeight;
|
576
584
|
// workaround. It gets tricky when embedded field is on tab
|
577
|
-
if (embedded_height == 0) embedded_height =
|
585
|
+
if (embedded_height == 0) embedded_height = 50;
|
578
586
|
this.style.height = (embedded_height + 30) + 'px';
|
579
587
|
// resize parent iframe window too
|
580
588
|
let parentWindow = this.contentWindow.parent;
|
@@ -175,14 +175,6 @@ img { vertical-align:bottom; }
|
|
175
175
|
padding: 7px;
|
176
176
|
}
|
177
177
|
|
178
|
-
/*
|
179
|
-
.dc-link a:hover, .dc-animate a:hover, .dc-result a:hover {
|
180
|
-
background: #f8f8f8;
|
181
|
-
transition: 0.3s;
|
182
|
-
color: #000;
|
183
|
-
}
|
184
|
-
*/
|
185
|
-
|
186
178
|
a.dc-animate:hover { color: #000; background: transparent;}
|
187
179
|
|
188
180
|
.dc-link a img { border: none; }
|
@@ -208,7 +200,6 @@ width: 99.9%;
|
|
208
200
|
padding: 0;
|
209
201
|
border-spacing: 0;
|
210
202
|
border-radius: 1px;
|
211
|
-
/*background-color: #f9f9f9;*/
|
212
203
|
}
|
213
204
|
|
214
205
|
.dc-result i {
|
@@ -230,7 +221,6 @@ padding: 0;
|
|
230
221
|
|
231
222
|
.dc-result-header {
|
232
223
|
display: flex;
|
233
|
-
/* background: linear-gradient(to bottom, #eee 0%, #e2e2e2 100%); */
|
234
224
|
}
|
235
225
|
.dc-result-data {
|
236
226
|
display: flex;
|
@@ -255,12 +245,6 @@ padding: 0;
|
|
255
245
|
|
256
246
|
.dc-result-header .spacer, .dc-result-data .spacer {
|
257
247
|
width: 2px;
|
258
|
-
/*
|
259
|
-
font-size: 1.5em;
|
260
|
-
margin: 0 0;
|
261
|
-
padding: 4px 0;
|
262
|
-
resize: both;
|
263
|
-
/* border-left: 1px solid #ccc;*/
|
264
248
|
}
|
265
249
|
|
266
250
|
.dc-result-header a:link, .dc-result-header a:visited {
|
@@ -335,7 +319,6 @@ padding: 0;
|
|
335
319
|
font-size: 1.2em;
|
336
320
|
margin-left: -1rem;
|
337
321
|
background-color: white;
|
338
|
-
/* padding: 8px 5px; */
|
339
322
|
padding: 6px 3px;
|
340
323
|
}
|
341
324
|
|
@@ -352,12 +335,12 @@ display: inline-table;
|
|
352
335
|
#data-fields {margin: 5px;}
|
353
336
|
|
354
337
|
.dc-link {
|
355
|
-
font-weight: 600;
|
356
|
-
color: #666;
|
357
|
-
text-align: center;
|
358
|
-
border-radius: 3px;
|
359
|
-
background: transparent linear-gradient(to bottom, #fff 0%, #e2e2e2 100%);
|
360
|
-
border: 1px solid #
|
338
|
+
font-weight: 600;
|
339
|
+
color: #666;
|
340
|
+
text-align: center;
|
341
|
+
border-radius: 3px;
|
342
|
+
background: transparent linear-gradient(to bottom, #fff 0%, #e2e2e2 100%);
|
343
|
+
border: 1px solid #eee;
|
361
344
|
}
|
362
345
|
|
363
346
|
.dc-link:hover {
|
@@ -382,13 +365,17 @@ border: 1px solid #ddd;
|
|
382
365
|
font-weight: 600;
|
383
366
|
padding: 7px;
|
384
367
|
vertical-align: bottom;
|
385
|
-
border: 1px solid #
|
368
|
+
border: 1px solid #eee;
|
386
369
|
border-radius: 3px;
|
387
370
|
color: #777;
|
388
371
|
text-shadow: 1px 1px #fff;
|
389
372
|
background: #ddd !important;
|
390
373
|
}
|
391
374
|
|
375
|
+
.dc-action-menu li.dc-link.plus-link {
|
376
|
+
padding: 7px 0;
|
377
|
+
}
|
378
|
+
|
392
379
|
.dc-link-ajax {
|
393
380
|
text-align: left;
|
394
381
|
font-weight: 600;
|
@@ -396,7 +383,7 @@ border: 1px solid #ddd;
|
|
396
383
|
border-radius: 3px;
|
397
384
|
color: #666;
|
398
385
|
background: transparent linear-gradient(to bottom, #fff 0%, #e2e2e2 100%) repeat scroll 0% 0%;
|
399
|
-
border: 1px solid #
|
386
|
+
border: 1px solid #eee;
|
400
387
|
}
|
401
388
|
|
402
389
|
.dc-link-ajax.with-link {padding: 7px}
|
@@ -407,20 +394,19 @@ border: 1px solid #ddd;
|
|
407
394
|
}
|
408
395
|
|
409
396
|
.dc-link-ajax:hover, .dc-action-submit:hover {
|
410
|
-
cursor: pointer;
|
411
|
-
|
412
|
-
|
397
|
+
cursor: pointer;
|
398
|
+
color: #000;
|
399
|
+
background: #eee;
|
413
400
|
border: 1px solid rgba(76,154,255, 1);
|
414
401
|
box-shadow: inset 0 0 0 1px rgba(76,154,255, 1);
|
415
|
-
transition: 0.3s;
|
416
|
-
color: #000;
|
402
|
+
transition: 0.3s;
|
417
403
|
}
|
418
404
|
|
419
405
|
.dc-link-ajax:hover a {
|
420
|
-
color: #000;
|
421
|
-
background: transparent;
|
422
|
-
cursor: pointer;
|
423
|
-
transition: 0.3s;
|
406
|
+
color: #000;
|
407
|
+
background: transparent;
|
408
|
+
cursor: pointer;
|
409
|
+
transition: 0.3s;
|
424
410
|
}
|
425
411
|
|
426
412
|
.dc-link-img {
|
@@ -494,16 +480,12 @@ border: solid 1px #ccc;;
|
|
494
480
|
}
|
495
481
|
.dc-link-submit {
|
496
482
|
text-align: left;
|
497
|
-
padding: 1px 8px 0.5px;
|
498
|
-
/* Exo padding: 0 8px; */
|
499
|
-
|
500
483
|
border-radius: 3px;
|
501
484
|
background-color: #eee;
|
502
485
|
background: transparent linear-gradient(to bottom, #fff 0%, #e2e2e2 100%) repeat scroll 0% 0%;
|
503
|
-
border: 1px solid #
|
486
|
+
border: 1px solid #eee;
|
504
487
|
display: flex;
|
505
488
|
align-items: center;
|
506
|
-
|
507
489
|
}
|
508
490
|
|
509
491
|
.dc-link-submit .fa {
|
@@ -529,7 +511,7 @@ border: solid 1px #ccc;;
|
|
529
511
|
border: none;
|
530
512
|
color: #666;
|
531
513
|
font-weight: 600;
|
532
|
-
padding:
|
514
|
+
padding: 2px 8px 1px;
|
533
515
|
border-radius: 0;
|
534
516
|
background: transparent;
|
535
517
|
line-height: 30px;
|
@@ -638,7 +620,7 @@ color: #aaa;
|
|
638
620
|
|
639
621
|
.dc-form-info {
|
640
622
|
padding: 8px;
|
641
|
-
background-image: linear-gradient(to bottom, #dff0d8
|
623
|
+
background-image: linear-gradient(to bottom, #dff0d8 0, #c8e5bc 100%);
|
642
624
|
background-repeat: repeat-x;
|
643
625
|
color: darkgreen;
|
644
626
|
border: 1px solid #b2dba1;
|
@@ -648,19 +630,17 @@ color: #aaa;
|
|
648
630
|
|
649
631
|
.dc-form-warning {
|
650
632
|
padding: 8px;
|
651
|
-
background-image: linear-gradient(to bottom,
|
633
|
+
background-image: linear-gradient(to bottom, rgba(213, 143, 218, 0.1) 0, rgba(213, 143, 218, 0.5) 100%);
|
652
634
|
background-repeat: repeat-x;
|
653
|
-
color:
|
654
|
-
border: 1px solid
|
635
|
+
color: rgba(102, 51, 153, 1);
|
636
|
+
border: 1px solid rgba(102, 51, 153, 0.3);
|
655
637
|
border-radius: 2px;
|
656
638
|
margin: 2px 0;
|
657
639
|
}
|
658
640
|
|
659
641
|
.dc-form-error {
|
660
642
|
padding: 8px;
|
661
|
-
background-image: linear-gradient(to bottom, #f2dede
|
662
|
-
background-repeat: repeat-x;
|
663
|
-
background-color: #f2dede;
|
643
|
+
background-image: linear-gradient(to bottom, #f2dede 0, #e7c3c3 100%);
|
664
644
|
color: #a94442;
|
665
645
|
border: 1px solid #dca7a7;
|
666
646
|
border-radius: 2px;
|
@@ -771,7 +751,7 @@ margin-bottom: -3px;
|
|
771
751
|
line-height: 1.2em;
|
772
752
|
padding: 0.4em 1em;
|
773
753
|
background: #666;
|
774
|
-
margin: 0 1px
|
754
|
+
margin: 0 1px 0 0;
|
775
755
|
border-left: 1px solid #ddd;
|
776
756
|
border-right: 1px solid #ddd;
|
777
757
|
border-radius: 4px 4px 0 0;
|
@@ -1524,6 +1504,6 @@ color: #669;
|
|
1524
1504
|
/******* Firefox only ********/
|
1525
1505
|
@-moz-document url-prefix() {
|
1526
1506
|
.dc-submit {
|
1527
|
-
padding: 0 2px 1px;
|
1507
|
+
/* padding: 0 2px 1px; */
|
1528
1508
|
}
|
1529
1509
|
}
|
@@ -41,9 +41,10 @@
|
|
41
41
|
# its control's would be found in model_embedded_controls.rb. By convention module names
|
42
42
|
# are declared in camel case, so our dc_page_controls.rb declares DrgcmsControls::DcPageControls module.
|
43
43
|
#
|
44
|
-
# Controls (among other) may contain
|
44
|
+
# Controls (among other) may contain 7 callback methods.
|
45
45
|
# These methods are:
|
46
46
|
# * dc_new_record
|
47
|
+
# * dc_dup_record
|
47
48
|
# * dc_before_edit
|
48
49
|
# * dc_before_save
|
49
50
|
# * dc_after_save
|
@@ -67,7 +68,7 @@
|
|
67
68
|
# if dc_user_can(DcPermission::CAN_READ)
|
68
69
|
# dc_page.where(created_by: session[:user_id])
|
69
70
|
# else
|
70
|
-
# flash[:error] = '
|
71
|
+
# flash[:error] = 'User can not perform this operation!'
|
71
72
|
# nil
|
72
73
|
# end
|
73
74
|
# end
|
@@ -76,7 +77,6 @@
|
|
76
77
|
########################################################################
|
77
78
|
class CmseditController < DcApplicationController
|
78
79
|
before_action :check_authorization, :except => [:login, :logout, :test, :run]
|
79
|
-
before_action :dc_reload_patches if Rails.env.development?
|
80
80
|
protect_from_forgery with: :null_session, only: Proc.new { |c| c.request.format.json? }
|
81
81
|
|
82
82
|
layout 'cms'
|
@@ -234,6 +234,7 @@ end
|
|
234
234
|
# duplicating document and is subroutine of create action.
|
235
235
|
########################################################################
|
236
236
|
def duplicate_document(source)
|
237
|
+
params['dup_fields'] += ',' if params['dup_fields'] # for easier field matching
|
237
238
|
dest = {}
|
238
239
|
source.attribute_names.each do |attribute_name|
|
239
240
|
next if attribute_name == '_id' # don't duplicate _id
|
@@ -294,12 +295,11 @@ def create
|
|
294
295
|
end
|
295
296
|
else # duplicate record
|
296
297
|
find_record
|
297
|
-
params['dup_fields'] += ',' if params['dup_fields'] # for easier field matching
|
298
298
|
new_doc = duplicate_document(@record)
|
299
299
|
create_new_empty_record(new_doc)
|
300
|
-
|
300
|
+
if (m = callback_method('dup_record')) then call_callback_method(m) end
|
301
|
+
update_standards
|
301
302
|
@record.save!
|
302
|
-
|
303
303
|
index
|
304
304
|
end
|
305
305
|
end
|
@@ -331,10 +331,8 @@ def update
|
|
331
331
|
end
|
332
332
|
end
|
333
333
|
|
334
|
-
if dc_user_can(DcPermission::CAN_EDIT_ALL)
|
335
|
-
(
|
336
|
-
@record.created_by == session[:user_id] and
|
337
|
-
dc_user_can(DcPermission::CAN_EDIT) )
|
334
|
+
if dc_user_can(DcPermission::CAN_EDIT_ALL) ||
|
335
|
+
(@record.respond_to?('created_by') && @record.created_by == session[:user_id] && dc_user_can(DcPermission::CAN_EDIT))
|
338
336
|
|
339
337
|
if save_data
|
340
338
|
params[:return_to] = 'index' if params[:commit] == t('drgcms.save&back') # save & back
|
@@ -688,7 +686,7 @@ def create_new_empty_record(initial_data = nil) #:nodoc:
|
|
688
686
|
@record = @tables.first[0].new(initial_data)
|
689
687
|
else
|
690
688
|
rec = @tables.first[0].find(@ids.first) # top most record
|
691
|
-
1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded
|
689
|
+
1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded children by ids
|
692
690
|
@record = rec.send(@tables.last[1].pluralize).new(initial_data) # new record
|
693
691
|
end
|
694
692
|
end
|
@@ -715,8 +713,9 @@ end
|
|
715
713
|
########################################################################
|
716
714
|
def save_journal(operation, changes = {})
|
717
715
|
if operation == :delete
|
718
|
-
@record.attributes.each {|k,v| changes[k] = v}
|
716
|
+
@record.attributes.each { |k, v| changes[k] = v }
|
719
717
|
end
|
718
|
+
changes.except!('created_at', 'updated_at', 'created_by', 'updated_by')
|
720
719
|
|
721
720
|
if (operation != :update) || changes.size > 0
|
722
721
|
# determine site_id
|
@@ -740,7 +739,7 @@ end
|
|
740
739
|
# Returns callback method name or nil if not defined.
|
741
740
|
########################################################################
|
742
741
|
def callback_method(key) #:nodoc:
|
743
|
-
data_key = key.gsub('_','-') # convert _ to -
|
742
|
+
data_key = key.gsub('_', '-') # convert _ to -
|
744
743
|
callback = case
|
745
744
|
when params['data'] && params['data'][data_key] then params['data'][data_key]
|
746
745
|
# dc_ + key method is present then call it automatically
|
@@ -842,7 +841,7 @@ def save_data
|
|
842
841
|
update_standards() if changes.size > 0 # update only if there has been some changes
|
843
842
|
if (saved = @record.save)
|
844
843
|
operation = @record.new_record? ? :new : :update
|
845
|
-
save_journal(operation,
|
844
|
+
save_journal(operation, @record.previous_changes)
|
846
845
|
# after_save callback
|
847
846
|
if (m = callback_method('after_save') ) then call_callback_method(m) end
|
848
847
|
end
|
@@ -1006,30 +1005,34 @@ end
|
|
1006
1005
|
# Process index action for normal collections.
|
1007
1006
|
########################################################################
|
1008
1007
|
def process_collections #:nodoc
|
1009
|
-
# If result_set is not defined on form, then it will fail. :return_to should know where to go
|
1008
|
+
# If result_set is not defined on form, then it will fail. :return_to should know where to go
|
1010
1009
|
if @form['result_set'].nil?
|
1011
|
-
process_return_to(params[:return_to] || 'reload')
|
1010
|
+
process_return_to(params[:return_to] || 'reload')
|
1012
1011
|
return true
|
1013
1012
|
end
|
1014
|
-
#
|
1013
|
+
# when result set is evaluated as Rails helper
|
1014
|
+
@form['result_set']['type'] ||= 'default'
|
1015
|
+
return unless @form['result_set']['type'] == 'default'
|
1016
|
+
|
1017
|
+
# for now enable only filtering of top level documents
|
1015
1018
|
if @tables.size == 1
|
1016
1019
|
check_filter_options()
|
1017
1020
|
check_sort_options()
|
1018
1021
|
end
|
1019
|
-
# result set is defined by filter method in control object
|
1022
|
+
# result set is defined by filter method in control object
|
1020
1023
|
form_filter = @form['result_set']['filter']
|
1021
1024
|
if form_filter
|
1022
1025
|
if respond_to?(form_filter)
|
1023
1026
|
@records = send(form_filter)
|
1024
|
-
# something went wrong. flash[] should have explanation.
|
1027
|
+
# something went wrong. flash[] should have explanation.
|
1025
1028
|
if @records.class == FalseClass
|
1026
1029
|
@records = []
|
1027
1030
|
render(action: :index)
|
1028
1031
|
return true
|
1029
1032
|
end
|
1030
1033
|
process_select_and_deny_fields
|
1031
|
-
# pagination but only if not already set
|
1032
|
-
unless (@form['table'] == 'dc_memory'
|
1034
|
+
# pagination but only if not already set
|
1035
|
+
unless (@form['table'] == 'dc_memory' || @records.options[:limit])
|
1033
1036
|
per_page = (@form['result_set']['per_page'] || 30).to_i
|
1034
1037
|
@records = @records.page(params[:page]).per(per_page) if per_page > 0
|
1035
1038
|
end
|
@@ -1040,10 +1043,10 @@ def process_collections #:nodoc
|
|
1040
1043
|
if @tables.size > 1
|
1041
1044
|
rec = @tables.first[0].find(@ids.first) # top most document.id
|
1042
1045
|
1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids
|
1043
|
-
# TO DO. When field name is different then pluralized class name. Not working yet.
|
1046
|
+
# TO DO. When field name is different then pluralized class name. Not working yet.
|
1044
1047
|
embedded_field_name = @tables.last[0] ? @tables.last[1].pluralize : @tables.last[1]
|
1045
1048
|
@records = rec.send(embedded_field_name) # current embedded set
|
1046
|
-
# sort by order if order field is present in model
|
1049
|
+
# sort by order if order field is present in model
|
1047
1050
|
if @tables.last[1].classify.constantize.respond_to?(:order)
|
1048
1051
|
@records = @records.order_by('order asc')
|
1049
1052
|
end
|
@@ -28,7 +28,8 @@
|
|
28
28
|
class DcApplicationController < ActionController::Base
|
29
29
|
protect_from_forgery with: :null_session, only: Proc.new { |c| c.request.format.json? }
|
30
30
|
before_action :dc_reload_patches if Rails.env.development?
|
31
|
-
|
31
|
+
before_action :dc_set_locale
|
32
|
+
|
32
33
|
########################################################################
|
33
34
|
# Writes anything passed as parameter to logger file.
|
34
35
|
# Very useful for debuging strange errors.
|
@@ -578,6 +579,20 @@ def dc_reload_patches
|
|
578
579
|
end
|
579
580
|
end
|
580
581
|
|
582
|
+
########################################################################
|
583
|
+
# Will set new default locale for application
|
584
|
+
#
|
585
|
+
# @param [String] new_locale : New locale value. If omitted it will be provided from params[:locale].
|
586
|
+
# if new_locale value is 00, application's default_locale will be used.
|
587
|
+
########################################################################
|
588
|
+
def dc_set_locale(new_locale = nil)
|
589
|
+
new_locale ||= params[:locale]
|
590
|
+
if new_locale && new_locale != session[:locale]
|
591
|
+
session[:locale] = new_locale == '00' ? nil : new_locale.to_sym
|
592
|
+
end
|
593
|
+
I18n.locale = session[:locale] ? session[:locale] : I18n.default_locale
|
594
|
+
end
|
595
|
+
|
581
596
|
############################################################################
|
582
597
|
# Writes out deprication msg. It also adds site_name to message, so it is easier to
|
583
598
|
# find where the message is comming from.
|
@@ -49,7 +49,12 @@ def autocomplete
|
|
49
49
|
name = params['search'].split('.').first
|
50
50
|
params['table'] = name.underscore
|
51
51
|
end
|
52
|
-
|
52
|
+
if params['table'].match('_control')
|
53
|
+
# it must be at least logged on
|
54
|
+
return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW, 'dc_memory')
|
55
|
+
else
|
56
|
+
return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW)
|
57
|
+
end
|
53
58
|
|
54
59
|
table = params['table'].classify.constantize
|
55
60
|
input = params['input'].gsub(/\(|\)|\[|\]|\{|\|\.|\,}/, '')
|
@@ -69,7 +74,7 @@ def autocomplete
|
|
69
74
|
end
|
70
75
|
end
|
71
76
|
|
72
|
-
render
|
77
|
+
render json: a
|
73
78
|
end
|
74
79
|
|
75
80
|
########################################################################
|
@@ -116,6 +116,18 @@ def self.choices_for_form_name(session)
|
|
116
116
|
Dir["#{session[:help_project]}/*.yml"].map { |file_name| File.basename(file_name,'.*') }.sort
|
117
117
|
end
|
118
118
|
|
119
|
+
######################################################################
|
120
|
+
# Will return choices for language select on form. Choices can be either set by dc_locales document in dc_big_table
|
121
|
+
# or can be acquired from Rails default locale
|
122
|
+
######################################################################
|
123
|
+
def self.choices_for_locales
|
124
|
+
choices = DcBigTable.choices4('dc_locales')
|
125
|
+
return choices unless choices[0,0] == I18n.t('drgcms.error')
|
126
|
+
|
127
|
+
choices = [I18n.default_locale] + I18n.fallbacks.inject([]) { |r, e| r << e.first }
|
128
|
+
choices.map(&:to_s).uniq
|
129
|
+
end
|
130
|
+
|
119
131
|
######################################################################
|
120
132
|
# Will return temp key for data saved in dc_temp file
|
121
133
|
######################################################################
|
data/app/forms/dc_big_table.yml
CHANGED
data/app/forms/dc_design.yml
CHANGED
data/app/forms/dc_help_1.yml
CHANGED
data/app/forms/dc_json_ld.yml
CHANGED
data/app/forms/dc_menu.yml
CHANGED
@@ -32,25 +32,21 @@ form:
|
|
32
32
|
10:
|
33
33
|
name: name
|
34
34
|
type: text_field
|
35
|
-
|
36
|
-
size: 20
|
35
|
+
size: 20
|
37
36
|
|
38
37
|
20:
|
39
38
|
name: description
|
40
39
|
type: text_field
|
41
|
-
|
42
|
-
size: 20
|
40
|
+
size: 20
|
43
41
|
|
44
42
|
30:
|
45
43
|
name: div_name
|
46
44
|
type: text_field
|
47
|
-
|
48
|
-
size: 20
|
45
|
+
size: 20
|
49
46
|
40:
|
50
47
|
name: link_prepend
|
51
48
|
type: text_field
|
52
|
-
|
53
|
-
size: 20
|
49
|
+
size: 20
|
54
50
|
50:
|
55
51
|
name: dc_site_id
|
56
52
|
type: select
|
@@ -64,13 +60,11 @@ form:
|
|
64
60
|
type: embedded
|
65
61
|
caption: false
|
66
62
|
form_name: dc_menu_item
|
67
|
-
|
68
|
-
height: 1000
|
63
|
+
load: delay
|
69
64
|
|
70
65
|
tab3:
|
71
66
|
20:
|
72
67
|
name: css
|
73
68
|
caption: false
|
74
69
|
type: text_area
|
75
|
-
|
76
|
-
size: 100x50
|
70
|
+
size: 100x50
|
data/app/forms/dc_menu_item.yml
CHANGED
data/app/forms/dc_page.yml
CHANGED
data/app/forms/dc_policy.yml
CHANGED
data/app/forms/dc_poll.yml
CHANGED
@@ -37,14 +37,12 @@ form:
|
|
37
37
|
10:
|
38
38
|
name: name
|
39
39
|
type: text_field
|
40
|
-
|
41
|
-
size: 50
|
40
|
+
size: 50
|
42
41
|
|
43
42
|
20:
|
44
43
|
name: title
|
45
44
|
type: text_field
|
46
|
-
|
47
|
-
size: 50
|
45
|
+
size: 50
|
48
46
|
|
49
47
|
30:
|
50
48
|
name: sub_text
|
@@ -54,8 +52,7 @@ form:
|
|
54
52
|
35:
|
55
53
|
name: pre_display
|
56
54
|
type: text_field
|
57
|
-
|
58
|
-
size: 50
|
55
|
+
size: 50
|
59
56
|
40:
|
60
57
|
name: operation
|
61
58
|
type: select
|
@@ -63,8 +60,7 @@ form:
|
|
63
60
|
50:
|
64
61
|
name: parameters
|
65
62
|
type: text_field
|
66
|
-
|
67
|
-
size: 50
|
63
|
+
size: 50
|
68
64
|
|
69
65
|
60:
|
70
66
|
name: display
|
@@ -73,8 +69,7 @@ form:
|
|
73
69
|
70:
|
74
70
|
name: captcha_type
|
75
71
|
type: text_field
|
76
|
-
|
77
|
-
size: 10
|
72
|
+
size: 10
|
78
73
|
|
79
74
|
80:
|
80
75
|
name: valid_from
|
@@ -92,8 +87,7 @@ form:
|
|
92
87
|
100:
|
93
88
|
name: css
|
94
89
|
type: text_area
|
95
|
-
|
96
|
-
size: 100x20
|
90
|
+
size: 100x20
|
97
91
|
|
98
92
|
110:
|
99
93
|
name: active
|
@@ -103,8 +97,8 @@ form:
|
|
103
97
|
name: js
|
104
98
|
type: text_area
|
105
99
|
caption: false
|
100
|
+
size: 100x50
|
106
101
|
html:
|
107
|
-
size: 100x50
|
108
102
|
style: 'font-family:courier;'
|
109
103
|
tab3:
|
110
104
|
20:
|
@@ -112,13 +106,13 @@ form:
|
|
112
106
|
caption: false
|
113
107
|
type: embedded
|
114
108
|
form_name: dc_poll_item
|
115
|
-
|
116
|
-
|
109
|
+
load: delay
|
110
|
+
|
117
111
|
tab4:
|
118
112
|
10:
|
119
113
|
name: form
|
120
114
|
caption: false
|
121
115
|
type: text_area
|
116
|
+
size: 100x50
|
122
117
|
html:
|
123
|
-
size: 100x50
|
124
118
|
style: 'font-family:courier;'
|
data/app/forms/dc_seo.yml
CHANGED
data/app/forms/dc_site.yml
CHANGED
@@ -132,8 +132,7 @@ form:
|
|
132
132
|
type: text_area
|
133
133
|
size: 130x40
|
134
134
|
|
135
|
-
5permissions:
|
136
|
-
|
135
|
+
5permissions:
|
137
136
|
10:
|
138
137
|
name: inherit_policy
|
139
138
|
type: select
|
@@ -145,6 +144,8 @@ form:
|
|
145
144
|
type: embedded
|
146
145
|
caption: false
|
147
146
|
form_name: dc_policy
|
147
|
+
load: delay
|
148
|
+
|
148
149
|
6parts:
|
149
150
|
10:
|
150
151
|
name: dc_parts
|
@@ -345,7 +345,7 @@ def dc_help_for_tab(tab)
|
|
345
345
|
label, help = dc_label_help(field.last)
|
346
346
|
next if help.blank?
|
347
347
|
|
348
|
-
html << %(<div class="help-field"><div class="help-label">#{label}</div><div class="help-text">#{help}</div></div>)
|
348
|
+
html << %(<div class="help-field"><div class="help-label">#{label}</div><div class="help-text">#{help.gsub("\n",'<br>')}</div></div>)
|
349
349
|
end
|
350
350
|
html
|
351
351
|
end
|
@@ -138,10 +138,10 @@ def dc_actions_for_form(position)
|
|
138
138
|
actions = actions.to_a.sort { |x, y| x[0] <=> y[0] }
|
139
139
|
# Add spinner to the beginning
|
140
140
|
html = %Q[<span class="dc-spinner">#{fa_icon('spinner lg spin')}</span><ul class="dc-menu #{position}">]
|
141
|
-
|
141
|
+
|
142
142
|
actions.each do |key, options|
|
143
143
|
session[:form_processing] = "form:actions: #{key} #{options}"
|
144
|
-
next if options.nil? # yes it
|
144
|
+
next if options.nil? # yes it happens
|
145
145
|
parms = @parms.clone
|
146
146
|
if options.class == String
|
147
147
|
next if @form['readonly'] and !options.match(/back|close/)
|
@@ -307,13 +307,13 @@ def dc_fields_for_tab(fields_on_tab) #:nodoc:
|
|
307
307
|
group_count = options['group'] || 1
|
308
308
|
group_option = options['group'] || 1
|
309
309
|
end
|
310
|
-
|
310
|
+
|
311
311
|
html << if labels_pos == 'top'
|
312
|
-
%
|
312
|
+
%(
|
313
313
|
<div class="dc-form-label-top dc-color-#{odd_even} dc-align-left" title="#{help}">
|
314
314
|
<label for="record_#{options['name']}">#{label} </label>
|
315
315
|
<div id="td_record_#{options['name']}">#{field_html}</div>
|
316
|
-
</div>
|
316
|
+
</div> )
|
317
317
|
else
|
318
318
|
# no label
|
319
319
|
if dc_dont?(options['caption'])
|
@@ -326,13 +326,14 @@ def dc_fields_for_tab(fields_on_tab) #:nodoc:
|
|
326
326
|
else
|
327
327
|
label_width = 14
|
328
328
|
data_width = 85
|
329
|
-
end
|
330
|
-
|
329
|
+
end
|
330
|
+
help.gsub!('<br>',"\n") if help.present?
|
331
|
+
%(
|
331
332
|
<div class="dc-form-label dc-color-#{odd_even} dc-align-#{labels_pos} dc-width-#{label_width}" title="#{help}">
|
332
333
|
<label for="record_#{options['name']}">#{label} </label>
|
333
334
|
</div>
|
334
335
|
<div id="td_record_#{options['name']}" class="dc-form-field dc-color-#{odd_even} dc-width-#{data_width}">#{field_html}</div>
|
335
|
-
|
336
|
+
)
|
336
337
|
end
|
337
338
|
# check if group end
|
338
339
|
if (group_count -= 1) == 0
|
data/app/helpers/cms_helper.rb
CHANGED
@@ -37,7 +37,7 @@ def dc_script_action(yaml)
|
|
37
37
|
# data = {'request' => 'script', 'script' => yaml['js'] || yaml['script'] }
|
38
38
|
# %Q[<li class="dc-link-ajax with-link dc-animate">#{ dc_link_to(yaml['caption'], yaml['icon'], '#', data: data ) }</li>]
|
39
39
|
icon = dc_icon_for_link yaml['icon']
|
40
|
-
data = %
|
40
|
+
data = %(data-request="script" data-script="#{yaml['js'] || yaml['script']}" data-url="script")
|
41
41
|
%Q[<li class="dc-link-ajax dc-animate" #{data}>#{icon} #{ t(yaml['caption'],yaml['caption']) }</li>]
|
42
42
|
end
|
43
43
|
|
@@ -182,7 +182,7 @@ end
|
|
182
182
|
# Returns:
|
183
183
|
# String : HTML code for action
|
184
184
|
############################################################################
|
185
|
-
def dc_link_ajax_window_submit_action(yaml, record=nil, action_active=true)
|
185
|
+
def dc_link_ajax_window_submit_action(yaml, record = nil, action_active = true)
|
186
186
|
parms = {}
|
187
187
|
caption = yaml['caption'] || yaml['text']
|
188
188
|
caption = caption ? t("#{caption.downcase}", caption) : nil
|
@@ -241,7 +241,7 @@ def dc_link_ajax_window_submit_action(yaml, record=nil, action_active=true)
|
|
241
241
|
data-request="#{request}" title="#{yaml['title']}">#{icon}#{caption}</li>]
|
242
242
|
|
243
243
|
elsif yaml['type'] == 'link' # link button
|
244
|
-
clas = "dc-link dc-animate"
|
244
|
+
clas = "dc-link plus-link dc-animate"
|
245
245
|
link = dc_link_to(caption, yaml['icon'], parms, yaml['html'] )
|
246
246
|
%Q[<li class="#{clas}">#{action_active ? link : caption}</li>]
|
247
247
|
|
@@ -84,7 +84,6 @@ def dc_actions_for_index
|
|
84
84
|
# html link options
|
85
85
|
yhtml = yaml['html'] || {}
|
86
86
|
yhtml['title'] = yaml['title'] if yaml['title']
|
87
|
-
|
88
87
|
code = case
|
89
88
|
# sort
|
90
89
|
when action == 'sort' then
|
@@ -113,9 +112,14 @@ def dc_actions_for_index
|
|
113
112
|
caption
|
114
113
|
|
115
114
|
# new
|
116
|
-
when action == 'new' then
|
115
|
+
when action == 'new' then
|
117
116
|
caption = yaml['caption'] || 'drgcms.new'
|
118
|
-
dc_link_to(caption,'plus', url, yhtml )
|
117
|
+
html << "<li class=\"dc-link plus-link dc-animate\">#{dc_link_to(caption, 'plus', url, yhtml )}</li>"
|
118
|
+
next
|
119
|
+
|
120
|
+
when action == 'close' then
|
121
|
+
html << %(<li class="dc-link dc-animate" onclick="window.close();"'>#{fa_icon('close')} #{t('drgcms.close')}</li>)
|
122
|
+
next
|
119
123
|
|
120
124
|
# menu
|
121
125
|
when action == 'menu' then
|
@@ -598,4 +602,16 @@ def dc_define_standard_actions(actions_params, standard)
|
|
598
602
|
actions
|
599
603
|
end
|
600
604
|
|
605
|
+
############################################################################
|
606
|
+
# When result set is to be drawn by Rails helper method.
|
607
|
+
############################################################################
|
608
|
+
def dc_process_result_set_method
|
609
|
+
method = @form['result_set']['eval']
|
610
|
+
if respond_to?(method)
|
611
|
+
send method
|
612
|
+
else
|
613
|
+
I18n.t('drgcms.no_method', method: method)
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
601
617
|
end
|
@@ -288,7 +288,7 @@ def dc_edit_title
|
|
288
288
|
else
|
289
289
|
# concatenate title
|
290
290
|
c = (@form['readonly'] ? t('drgcms.show') : t('drgcms.edit')) + " : "
|
291
|
-
c << (@form['title'] ? t( @form['title'], @form['title'] ) : t_tablename(@form['table'])) + ' : '
|
291
|
+
c << (@form['title'].class == String ? t( @form['title'], @form['title'] ) : t_tablename(@form['table'])) + ' : '
|
292
292
|
title = (title and title['field']) ? title['field'] : @form['form']['edit_title']
|
293
293
|
dc_deprecate('form:edit_title will be deprecated. Use form:title:field instead.') if @form['form']['edit_title']
|
294
294
|
|
@@ -456,19 +456,47 @@ end
|
|
456
456
|
def dc_error_messages_for(doc)
|
457
457
|
return '' unless doc && doc.errors.any?
|
458
458
|
|
459
|
-
msgs = ''
|
460
|
-
doc.errors.each do |error|
|
459
|
+
msgs = doc.errors.inject('') do |r, error|
|
461
460
|
label = t("helpers.label.#{decamelize_type(doc.class)}.#{error.attribute}", error.attribute)
|
462
|
-
|
461
|
+
r << "<li>#{label} : #{error.message}</li>"
|
463
462
|
end
|
464
|
-
|
465
|
-
|
463
|
+
|
464
|
+
html = <<eot
|
466
465
|
<div class="dc-form-error">
|
467
466
|
<h2>#{t('drgcms.errors_no')} #{doc.errors.size}</h2>
|
468
467
|
<ul>#{msgs}</ul>
|
469
468
|
</div>
|
470
469
|
eot
|
471
|
-
|
470
|
+
html.html_safe
|
471
|
+
end
|
472
|
+
|
473
|
+
####################################################################
|
474
|
+
# Returns warning messages if any set in a model.
|
475
|
+
#
|
476
|
+
# When warnings array is added to model its content can be written on top of the form.
|
477
|
+
#
|
478
|
+
# Parameters:
|
479
|
+
# [doc] Document. Document record which will be checked for errors.
|
480
|
+
#
|
481
|
+
# Returns:
|
482
|
+
# String. HTML code formatted for display.
|
483
|
+
####################################################################
|
484
|
+
def dc_warning_messages_for(doc)
|
485
|
+
return ''
|
486
|
+
return '' unless doc && doc.respond_to?(:warnings)
|
487
|
+
|
488
|
+
msgs = doc.warnings.inject('') do |r, error|
|
489
|
+
label = t("helpers.label.#{decamelize_type(doc.class)}.#{error.attribute}", error.attribute)
|
490
|
+
msgs << "<li>#{label} : #{error.message}</li>"
|
491
|
+
end
|
492
|
+
|
493
|
+
html = <<eot
|
494
|
+
<div class="dc-form-warning">
|
495
|
+
<h2>#{t('drgcms.warnings_no')} #{doc.warnings.size}</h2>
|
496
|
+
<ul>#{msgs}</ul>
|
497
|
+
</div>
|
498
|
+
eot
|
499
|
+
html.html_safe
|
472
500
|
end
|
473
501
|
|
474
502
|
####################################################################
|
data/app/models/dc_big_table.rb
CHANGED
@@ -78,10 +78,10 @@ class DcBigTable
|
|
78
78
|
########################################################################
|
79
79
|
# Will return possible choices for specified key prepared for usega in select input field.
|
80
80
|
########################################################################
|
81
|
-
def self.choices4(key, site, locale=nil)
|
81
|
+
def self.choices4(key, site = nil, locale = nil)
|
82
82
|
result = []
|
83
83
|
choices = find_by(key: key, site: site)
|
84
|
-
choices = find_by(key: key, site: nil) if choices.nil?
|
84
|
+
choices = find_by(key: key, site: nil) if site && choices.nil?
|
85
85
|
if choices
|
86
86
|
choices.dc_big_table_values.each do |choice|
|
87
87
|
description = choice.description
|
data/app/models/dc_filter.rb
CHANGED
@@ -119,7 +119,7 @@ def self.get_filter_field(parent)
|
|
119
119
|
return '' if field.nil? && filter['input'].nil?
|
120
120
|
|
121
121
|
saved_readonly = parent.form['readonly']
|
122
|
-
parent.form['readonly'] =
|
122
|
+
parent.form['readonly'] = false # must be
|
123
123
|
field ||= {}
|
124
124
|
# If field has choices available in labels, use them. This is most likely select input field.
|
125
125
|
if field['name']
|
@@ -146,24 +146,24 @@ def self.get_filter_field(parent)
|
|
146
146
|
# remove if present
|
147
147
|
field['with_new'] = nil if field['with_new']
|
148
148
|
# create input field object
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
return '' if klas.nil?
|
153
|
-
|
149
|
+
html = ''
|
150
|
+
klass_string = field['type'].camelize
|
151
|
+
klass = DrgcmsFormFields::const_get(klass_string) rescue nil
|
154
152
|
# return data from object and create html code to display field
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
153
|
+
if klass
|
154
|
+
if drg_field = klass.new(parent, nil, field).render rescue nil
|
155
|
+
js = drg_field.js.blank? ? '' : parent.javascript_tag(drg_field.js)
|
156
|
+
html = %(<li class="no-background">
|
157
|
+
<span class="filter_field" data-url="#{url}">#{drg_field.html}
|
158
|
+
#{parent.fa_icon('search lg', class: 'record_filter_field_icon')}
|
159
|
+
#{js}</span></li>)
|
160
|
+
else
|
161
|
+
# Error. Forget filter
|
162
|
+
parent.session[ parent.form['table'] ][:filter] = nil
|
163
|
+
end
|
160
164
|
end
|
161
|
-
|
162
|
-
|
163
|
-
<span class="filter_field" data-url="#{url}">#{object.html}
|
164
|
-
#{parent.fa_icon('search lg', class: 'record_filter_field_icon')}
|
165
|
-
#{js}</span>
|
166
|
-
</li>)
|
165
|
+
parent.form['readonly'] = saved_readonly
|
166
|
+
html
|
167
167
|
end
|
168
168
|
|
169
169
|
######################################################################
|
data/app/models/dc_temp.rb
CHANGED
@@ -137,4 +137,11 @@ def self.prepare(key:, clear: nil)
|
|
137
137
|
self.where(key: key)
|
138
138
|
end
|
139
139
|
|
140
|
+
########################################################################
|
141
|
+
# Order data by new key. Will update order field with values from new field
|
142
|
+
########################################################################
|
143
|
+
def self.reorder_by(key, new_order)
|
144
|
+
self.where(key: key).each { |doc| doc.order = data[key]; doc.save }
|
145
|
+
end
|
146
|
+
|
140
147
|
end
|
@@ -31,12 +31,17 @@ module DrgcmsFormFields
|
|
31
31
|
# * +type:+ comment (required)
|
32
32
|
# * +caption:+ Caption text written in label place. If set to false comment
|
33
33
|
# will occupy whole row. (required)
|
34
|
-
#
|
34
|
+
# * +html:+ Optional html attributes will be added to div surrounding the comment.
|
35
|
+
#
|
35
36
|
# Form example:
|
36
37
|
# 30:
|
37
38
|
# type: comment
|
38
39
|
# text: myapp.comment_text
|
39
40
|
# caption: false
|
41
|
+
# html:
|
42
|
+
# style: 'color: red'
|
43
|
+
# class: some_class
|
44
|
+
# id: some_id
|
40
45
|
###########################################################################
|
41
46
|
class Comment < DrgcmsField
|
42
47
|
|
@@ -45,7 +50,11 @@ class Comment < DrgcmsField
|
|
45
50
|
###########################################################################
|
46
51
|
def render
|
47
52
|
comment = @yaml['comment'] || @yaml['text']
|
48
|
-
@html
|
53
|
+
@yaml['html'] ||= {}
|
54
|
+
@yaml['html']['class'] = 'dc-comment ' + @yaml['html']['class'].to_s
|
55
|
+
html = @yaml['html'].inject('') { |r, e| r << %( #{e[0]}="#{e[1]}") }
|
56
|
+
|
57
|
+
@html << %(<div #{html}>#{t(comment, comment).gsub("\n",'<br>')}</div>)
|
49
58
|
self
|
50
59
|
end
|
51
60
|
end
|
@@ -144,8 +144,7 @@ end
|
|
144
144
|
def add_view_code
|
145
145
|
return '' if (data = @record.send(@yaml['name'])).blank?
|
146
146
|
|
147
|
-
|
148
|
-
table, form_name = *ar
|
147
|
+
table, form_name = @yaml['view'].split(/\ |\,/).delete_if { |e| e.blank? }
|
149
148
|
url = @parent.url_for(controller: :cmsedit, id: data, action: :edit, table: table, form_name: form_name, readonly: true, window_close: 1 )
|
150
149
|
icon = @parent.fa_icon('eye')
|
151
150
|
%(<span class="dc-window-open" data-url="#{url}">#{icon}</span>)
|
@@ -158,9 +157,9 @@ def ro_standard
|
|
158
157
|
value = @record.respond_to?(@yaml['name']) ? @record.send(@yaml['name']) : nil
|
159
158
|
return self if value.blank?
|
160
159
|
|
160
|
+
html = ''
|
161
161
|
choices = get_choices()
|
162
162
|
if value.class == Array # multiple choices
|
163
|
-
html = ''
|
164
163
|
value.each do |element|
|
165
164
|
choices.each do |choice|
|
166
165
|
if choice.to_s == element.to_s
|
@@ -169,17 +168,17 @@ def ro_standard
|
|
169
168
|
end
|
170
169
|
end
|
171
170
|
end
|
172
|
-
return super(html)
|
173
171
|
else
|
174
172
|
choices.each do |choice|
|
175
173
|
if choice.class == Array
|
176
|
-
|
174
|
+
(html = choice.first; break) if choice.last.to_s == value.to_s
|
177
175
|
else
|
178
|
-
|
176
|
+
(html = choice; break) if choice.to_s == value.to_s
|
179
177
|
end
|
180
178
|
end
|
179
|
+
html << add_view_code if @yaml['view']
|
181
180
|
end
|
182
|
-
super(
|
181
|
+
super(html)
|
183
182
|
end
|
184
183
|
|
185
184
|
###########################################################################
|
@@ -1,24 +1,27 @@
|
|
1
1
|
|
2
2
|
<div class="dc-table-frame">
|
3
3
|
|
4
|
-
<%
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
4
|
+
<% if @form['result_set']['type'] == 'method' %>
|
5
|
+
<%= dc_process_result_set_method %>
|
6
|
+
<% elsif @records %>
|
7
|
+
<%= dc_background_for_result(:start) %>
|
8
|
+
<%= dc_header_for_result %>
|
9
|
+
|
10
|
+
<% for document in @records %>
|
11
|
+
<%= dc_row_for_result(document) %>
|
12
|
+
<%= dc_actions_for_result(document) %>
|
13
|
+
<%= dc_columns_for_result(document) %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% if @record_footer %>
|
18
|
+
<div class="dc-result-data footer">
|
19
|
+
<%= dc_actions_column_for_footer() %>
|
20
|
+
<%= dc_columns_for_result(@record_footer) %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= dc_background_for_result(:end) %>
|
22
25
|
<% end %>
|
23
26
|
<%= dc_filter_popup() %>
|
24
27
|
|
@@ -60,9 +60,10 @@ en:
|
|
60
60
|
login: Login into CMS
|
61
61
|
username: User name
|
62
62
|
password: Password
|
63
|
-
form_error: Error loading form
|
63
|
+
form_error: Error loading form %{form_name}
|
64
64
|
img_large: Click for larger image
|
65
|
-
no_class: Class %{class} not defined!
|
65
|
+
no_class: Class [%{class}] not defined!
|
66
|
+
no_method: Method (helper) [%{method}] not defined!
|
66
67
|
img_alt_not_present: All images in body must have alternative text entered
|
67
68
|
|
68
69
|
toggle_cms: Toggle CMS edit/view mode
|
@@ -60,9 +60,10 @@ sl:
|
|
60
60
|
login: Prijava v CMS
|
61
61
|
username: Uporabnik
|
62
62
|
password: Geslo
|
63
|
-
form_error: Napaka pri branju forme
|
63
|
+
form_error: Napaka pri branju forme %{form_name}
|
64
64
|
img_large: Klik za večjo sliko
|
65
|
-
no_class:
|
65
|
+
no_class: Razred (class) [%{class}] ni definiran!
|
66
|
+
no_method: Metoda (helper) [%{method}] ne obstaja!
|
66
67
|
img_alt_not_present: Vse slike v vsebini morajo imeti vpisano nadomestno besedilo
|
67
68
|
|
68
69
|
toggle_cms: Preklopi med CMS urejanjem in prikazom
|
data/lib/drg_cms/version.rb
CHANGED
data/lib/drg_cms.rb
CHANGED
@@ -140,12 +140,8 @@ end
|
|
140
140
|
def self.model_check(document, crash = false)
|
141
141
|
return nil unless document.errors.any?
|
142
142
|
|
143
|
-
msg = ""
|
144
|
-
|
145
|
-
msg << "#{attribute}: #{errors_array}\n"
|
146
|
-
end
|
147
|
-
#
|
148
|
-
if crash and msg.size > 0
|
143
|
+
msg = document.errors.inject('') { |r, error| r << "#{error.attribute}: #{error.message}\n" }
|
144
|
+
if crash && msg.size > 0
|
149
145
|
msg = "Validation errors in #{document.class}:\n" + msg
|
150
146
|
pp msg
|
151
147
|
Rails.logger.error(msg)
|
@@ -245,5 +241,3 @@ def self.routes
|
|
245
241
|
end
|
246
242
|
|
247
243
|
end
|
248
|
-
|
249
|
-
DrgCms.add_patches_path(File.dirname(__FILE__) + '../app/models/drgcms_form_fields/patches')
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|