drg_cms 0.6.1.11 → 0.7.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +260 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +9 -5
  5. data/app/assets/javascripts/drg_cms/drg_cms.js +95 -34
  6. data/app/assets/javascripts/drg_cms/jquery.bpopup.js +372 -0
  7. data/app/assets/javascripts/drg_cms_application.js +1 -3
  8. data/app/assets/javascripts/drg_cms_cms.js +3 -4
  9. data/app/assets/stylesheets/drg_cms/drg_cms.css +37 -5
  10. data/app/assets/stylesheets/drg_cms/jstree.css +32 -27
  11. data/app/assets/stylesheets/drg_cms/select-multiple.css +6 -4
  12. data/app/controllers/cmsedit_controller.rb +22 -24
  13. data/app/controllers/dc_application_controller.rb +10 -9
  14. data/app/controllers/dc_common_controller.rb +14 -11
  15. data/app/controllers/dc_main_controller.rb +0 -1
  16. data/app/controls/dc_gallery_control.rb +46 -0
  17. data/app/controls/dc_image_control.rb +180 -0
  18. data/app/controls/dc_page_control.rb +3 -3
  19. data/app/controls/dc_poll_result_control.rb +7 -8
  20. data/app/controls/dc_report.rb +9 -4
  21. data/app/controls/design_element_settings_control.rb +88 -37
  22. data/app/forms/all_options.yml +18 -7
  23. data/app/forms/cms_menu.yml +10 -4
  24. data/app/forms/dc_category.yml +17 -8
  25. data/app/forms/dc_category_as_tree.yml +31 -0
  26. data/app/forms/dc_gallery.yml +1 -1
  27. data/app/forms/dc_image.yml +122 -0
  28. data/app/forms/dc_image_search.yml +72 -0
  29. data/app/forms/dc_page.yml +11 -8
  30. data/app/forms/dc_steps_template.yml +2 -1
  31. data/app/forms/help/dc_category_as_tree.en +4 -0
  32. data/app/forms/help/dc_category_as_tree.sl +5 -0
  33. data/app/helpers/cms_common_helper.rb +24 -16
  34. data/app/helpers/cms_edit_helper.rb +28 -35
  35. data/app/helpers/cms_helper.rb +21 -5
  36. data/app/helpers/cms_index_helper.rb +53 -38
  37. data/app/helpers/dc_application_helper.rb +95 -121
  38. data/app/helpers/dc_category_helper.rb +129 -0
  39. data/app/helpers/dc_image_helper.rb +127 -0
  40. data/app/models/concerns/dc_policy_rule_concern.rb +1 -1
  41. data/app/models/concerns/dc_user_concern.rb +12 -4
  42. data/app/models/dc_category.rb +62 -24
  43. data/app/models/dc_design.rb +5 -4
  44. data/app/models/dc_filter.rb +19 -18
  45. data/app/models/dc_image.rb +237 -0
  46. data/app/models/dc_internals.rb +5 -9
  47. data/app/models/dc_policy_role.rb +8 -8
  48. data/app/models/drgcms_form_fields/date_picker.rb +10 -12
  49. data/app/models/drgcms_form_fields/datetime_picker.rb +10 -11
  50. data/app/models/drgcms_form_fields/drgcms_field.rb +55 -30
  51. data/app/models/drgcms_form_fields/embedded.rb +11 -8
  52. data/app/models/drgcms_form_fields/journal_diff.rb +2 -2
  53. data/app/models/drgcms_form_fields/multitext_autocomplete.rb +51 -47
  54. data/app/models/drgcms_form_fields/select.rb +20 -14
  55. data/app/models/drgcms_form_fields/text_with_select.rb +5 -9
  56. data/app/models/drgcms_form_fields/tree_select.rb +20 -19
  57. data/app/renderers/dc_gallery_renderer.rb +10 -4
  58. data/app/renderers/dc_page_renderer.rb +7 -7
  59. data/app/renderers/dc_poll_renderer.rb +13 -12
  60. data/app/views/cmsedit/_edit_stuff.html.erb +1 -1
  61. data/app/views/cmsedit/edit.html.erb +1 -1
  62. data/app/views/cmsedit/index.html.erb +1 -1
  63. data/app/views/cmsedit/new.html.erb +1 -0
  64. data/app/views/layouts/content.html.erb +1 -1
  65. data/config/locales/drgcms_en.yml +16 -2
  66. data/config/locales/drgcms_sl.yml +15 -2
  67. data/config/locales/models_en.yml +33 -0
  68. data/config/locales/models_sl.yml +44 -1
  69. data/drg_cms.gemspec +3 -3
  70. data/lib/drg_cms/version.rb +1 -1
  71. data/lib/drg_cms.rb +19 -5
  72. data/lib/generators/convert_to_ar/USAGE +8 -0
  73. data/lib/generators/convert_to_ar/convert_to_ar_generator.rb +158 -0
  74. data/lib/tasks/dc_cleanup.rake +20 -42
  75. metadata +25 -14
  76. data/History.log +0 -109
  77. data/app/assets/javascripts/drg_cms/jquery.bpopup.min.js +0 -7
  78. data/app/views/layouts/__cmsedit.html.erb +0 -16
@@ -44,20 +44,20 @@ module CmsCommonHelper
44
44
  # Returns:
45
45
  # String. Translated text.
46
46
  ####################################################################
47
- def self.t(key, default=nil)
47
+ def self.t(key, default = nil)
48
48
  c = I18n.t(key)
49
- if c.class == Hash or c.match( 'translation missing' )
49
+ if c.class == Hash || c.match( /translation missing/i )
50
50
  c = I18n.t(key, locale: 'en')
51
- # Still not found. Return default if set
52
- if c.class == Hash or c.match( 'translation missing' )
53
- c = default.nil? ? key : default
51
+ # Still not found, return default
52
+ if c.class == Hash || c.match( /translation missing/i )
53
+ c = default || key
54
54
  end
55
55
  end
56
56
  c
57
57
  end
58
58
 
59
59
  ####################################################################
60
- def t(key, default=nil) #:nodoc
60
+ def t(key, default = nil) #:nodoc
61
61
  CmsCommonHelper.t(key, default)
62
62
  end
63
63
 
@@ -72,7 +72,7 @@ end
72
72
  # Returns:
73
73
  # String. Translated text.
74
74
  ####################################################################
75
- def t_tablename(tablename, default=nil)
75
+ def t_tablename(tablename, default = nil)
76
76
  t('helpers.label.' + tablename + '.tabletitle', default || tablename)
77
77
  end
78
78
 
@@ -81,21 +81,29 @@ end
81
81
  # Translation is provided by lang.helpers.label.table_name.field_name locale. If
82
82
  # translation is not found method will capitalize field_name and replace '_' with ' '.
83
83
  ############################################################################
84
- def t_label_for_field(field_name, default='')
85
- c = t("helpers.label.#{@form['table']}.#{field_name}", default)
86
- c = field_name.capitalize.gsub('_',' ') if c.match( 'translation missing' )
87
- c
84
+ def t_label_for_field(field_name, default = '')
85
+ c = (@form['i18n_prefix'] || "helpers.label.#{@form['table']}") + ".#{field_name}"
86
+ c = field_name if field_name.match(/helpers\./)
87
+
88
+ label = t(c, default)
89
+ label = field_name.capitalize.gsub('_', ' ') if c.match( /translation missing/i )
90
+ label
88
91
  end
89
92
 
90
93
  ############################################################################
91
- # Returns label for field translated to current locale for usage browser header.
94
+ # Returns label for field translated to current locale for usage in browser header.
92
95
  # Translation is provided by lang.helpers.label.table_name.field_name locale. If
93
96
  # not found method will look in standard drgcms translations.
94
- #
95
97
  ############################################################################
96
98
  def t_label_for_column(options)
97
99
  label = options['caption'] || options['label']
98
- label = (options['name'] ? "helpers.label.#{@form['table']}.#{options['name']}" : '') if label.nil?
100
+ if label.blank?
101
+ label = if options['name']
102
+ prefix = @form['i18n_prefix'] || "helpers.label.#{@form['table']}"
103
+ "#{prefix}.#{options['name']}"
104
+ end
105
+ label = label.to_s
106
+ end
99
107
  label = t(label) if label.match(/\./)
100
108
  label = t("drgcms.#{options['name']}") if label.match('helpers.') # standard field names like created_by, updated_at
101
109
  label
@@ -161,8 +169,8 @@ end
161
169
  ############################################################################
162
170
  def self.dc_choices_for_field(model, field)
163
171
  c = CmsCommonHelper.t('helpers.label.' + model + '.choices4_' + field )
164
- return ['error'] if c.match( 'translation missing' )
165
- c.chomp.split(',').inject([]) {|r,v| r << v.split(':') }
172
+ return ['error'] if c.match( /translation missing/i )
173
+ c.chomp.split(',').inject([]) { |r, v| r << v.split(':') }
166
174
  end
167
175
 
168
176
  ############################################################################
@@ -44,17 +44,11 @@ def dc_value_for_parameter(param, current_document = nil)#:nodoc:
44
44
  end
45
45
 
46
46
  ############################################################################
47
- # Creates actions div for edit form.
48
- #
49
- # Displaying readonly form turned out to be challenge. For now when readonly parameter
50
- # has value 2, back link will force readonly form. Value 1 or not set will result in
51
- # normal link.
47
+ # Determine if action button on the form is active. Action will be greyed out otherwise.
48
+ #
49
+ # @return : Boolean : defined by 'active' option'. Default is True.
52
50
  ############################################################################
53
51
  def dc_is_action_active?(options)
54
- if options['when_new']
55
- dc_deprecate("when_option will be deprecated and replaced by active: not_new_record! Form #{CmsHelper.form_param(params)}")
56
- return !(dc_dont?(options['when_new']) && @record.new_record?)
57
- end
58
52
  return true unless options['active']
59
53
 
60
54
  # alias record and document so both can be used in eval
@@ -137,7 +131,7 @@ def dc_actions_for_form(position)
137
131
  actions.delete('standard')
138
132
  actions = actions.to_a.sort { |x, y| x[0] <=> y[0] }
139
133
  # Add spinner to the beginning
140
- html = %Q[<span class="dc-spinner">#{fa_icon('settings-o spin')}</span><ul class="dc-menu #{position}">]
134
+ html = %(<span class="dc-spinner">#{mi_icon('settings-o spin')}</span><ul class="dc-menu #{position}">)
141
135
 
142
136
  actions.each do |key, options|
143
137
  session[:form_processing] = "form:actions: #{key} #{options}"
@@ -211,7 +205,7 @@ def dc_actions_for_form(position)
211
205
  dc_submit_tag(caption, icon, { data: parameters, title: options['title'] }) +
212
206
  '</li>'
213
207
  else
214
- %(<li><div class="dc-link-no">#{fa_icon(icon)} #{caption}</div></li>)
208
+ %(<li><div class="dc-link-no">#{mi_icon(icon)} #{caption}</div></li>)
215
209
  end
216
210
 
217
211
  # delete with some sugar added
@@ -322,25 +316,25 @@ def dc_head_for_form
322
316
  caption = options['caption']
323
317
  span = options['span'] || 1
324
318
  @css << "\n#{options['css']}" unless options['css'].blank?
325
- label = if caption.blank?
326
- ''
327
- elsif options['name'] == caption
328
- t_label_for_field(options['name'], options['name'].capitalize.gsub('_',' ') )
329
- else
330
- t(caption, caption)
331
- end
319
+ label = if caption.blank?
320
+ ''
321
+ elsif options['name'] == caption
322
+ t_label_for_field(options['name'], options['name'].capitalize.gsub('_', ' ') )
323
+ else
324
+ t(caption, caption)
325
+ end
332
326
  # Field value
333
327
  begin
334
328
  field = if options['eval']
335
- dc_process_column_eval(options, @record)
336
- else
337
- @record.send(options['name'])
338
- end
329
+ dc_process_column_eval(options, @record)
330
+ else
331
+ dc_format_value(@record.send(options['name']), options['format'])
332
+ end
339
333
  rescue Exception => e
340
334
  dc_log_exception(e, 'dc_head_for_form')
341
335
  field = '!!!Error'
342
336
  end
343
- #
337
+
344
338
  klass = dc_style_or_class(nil, options['class'], field, @record)
345
339
  style = dc_style_or_class(nil, options['style'], field, @record)
346
340
  html << %(<div class="dc-column #{klass}" style="width:#{percent*span}%;#{style}">
@@ -487,18 +481,17 @@ def dc_input_form_create(fields_on_tab) #:nodoc:
487
481
  </div> )
488
482
  else
489
483
  # no label
490
- if dc_dont?(options['caption'])
491
- label = ''
492
- label_width = 0
493
- data_width = 100
494
- elsif group_option > 1
495
- label_width = group_option != group_count ? 10 : 14
496
- data_width = 21
497
- else
498
- label_width = 14
499
- data_width = 85
500
- end
501
- help.gsub!('<br>',"\n") if help.present?
484
+ label_width, data_width = if dc_dont?(options['caption'])
485
+ label = ''
486
+ [0, 100]
487
+ elsif group_option == 1
488
+ [14, 85]
489
+ elsif group_option == 2
490
+ group_count == 2 ? [14, 21] : [10, 45]
491
+ elsif group_option == 3
492
+ group_count == 3 ? [14, 21] : [10, 21]
493
+ end
494
+ help.gsub!('<br>', "\n") if help.present?
502
495
  %(
503
496
  <div class="dc-form-label dc-color-#{odd_even} dc-align-#{labels_pos} dc-width-#{label_width}" title="#{help}">
504
497
  <label for="record_#{options['name']}">#{label} </label>
@@ -110,7 +110,7 @@ end
110
110
  ############################################################################
111
111
  def dc_label_help(options)
112
112
  # no label or help in comments
113
- return [nil, nil] if %w(comment action).include?(options['type'])
113
+ return [nil, nil] if %w[comment action].include?(options['type'])
114
114
 
115
115
  label = options['caption'] || options['text'] || options['label']
116
116
  if options['name']
@@ -122,8 +122,16 @@ def dc_label_help(options)
122
122
  end
123
123
  # help text can be defined in form or in translations starting with helpers. or as helpers.help.collection.field
124
124
  help = options['help']
125
- help ||= "helpers.help.#{@form['table']}.#{options['name']}" if options['name']
126
- help = t(help, ' ') if help.to_s.match(/helpers\./)
125
+ if help.blank?
126
+ help = if options['name']
127
+ # if defined as i18n_prefix replace "label" with "help"
128
+ prefix = @form['i18n_prefix'] ? @form['i18n_prefix'].sub('label', 'help') : "helpers.help.#{@form['table']}"
129
+ "#{prefix}.#{options['name']}"
130
+ end
131
+ help = help.to_s
132
+ end
133
+ help = t(help, ' ') if help.to_s.match(/help\./)
134
+
127
135
  [label, help]
128
136
  end
129
137
 
@@ -300,10 +308,18 @@ def dc_log_exception(exception, where = '')
300
308
  end
301
309
 
302
310
  ############################################################################
303
- # Will return form id, to be used on each form for simpler css selecting.
311
+ # Will return form id. id can be used for css selecting of fields on form.
312
+ # Form id is by default form_name || table parameter.
304
313
  ############################################################################
305
314
  def dc_form_id
306
- %( id=#{CmsHelper.form_param(params) || CmsHelper.table_param(params)} )
315
+ %(id="#{CmsHelper.form_param(params) || CmsHelper.table_param(params)}" ).html_safe
316
+ end
317
+
318
+ ############################################################################
319
+ # Will return class for form. Class can be used for different styling of forms.
320
+ ############################################################################
321
+ def dc_form_class(additional_class = nil)
322
+ %(class="#{additional_class} #{@form['class']}" ).html_safe
307
323
  end
308
324
 
309
325
  ############################################################################
@@ -35,12 +35,10 @@ module CmsIndexHelper
35
35
  def dc_actions_for_index
36
36
  @js = @form['script'] || @form['js'] || ''
37
37
  @css = @form['css'] || ''
38
- return '' if @form['index'].nil?
39
-
40
- actions = @form['index']['actions']
38
+ actions = @form.dig('index', 'actions')
41
39
  return '' if actions.blank?
42
40
 
43
- std_actions = {2 => 'new', 3 => 'sort', 4 => 'filter' }
41
+ std_actions = { 2 => 'new', 3 => 'sort', 4 => 'filter' }
44
42
  std_actions.delete(2) if @form['readonly']
45
43
 
46
44
  if actions.class == String
@@ -51,22 +49,16 @@ def dc_actions_for_index
51
49
  end
52
50
 
53
51
  html_left, html_right = '', ''
54
- # Remove actions settings and sort
55
- only_actions = []
56
- actions.each { |key, value| only_actions << [key, value] if key.class == Integer }
57
- only_actions.sort_by!(&:first)
58
- only_actions.each do |key, options|
52
+ # remove settings and sort
53
+ actions_only = actions.inject([]) { |r, action| r << action if action.first.class == Integer; r }.sort_by(&:first)
54
+ actions_only.each do |key, options|
59
55
  session[:form_processing] = "index:actions: #{key}=#{options}"
60
56
  next if options.nil? # must be
61
57
 
62
- url = @form_params.clone
63
- yaml = options.class == String ? {'type' => options} : options # if single definition simulate type parameter
58
+ url = @form_params.clone
59
+ yaml = options.class == String ? { 'type' => options } : options # sinle action. Simulate type parameter
64
60
  action = yaml['type'].to_s.downcase
65
- if action == 'url'
66
- dc_deprecate "action: url will be deprecated. Use action: link in index: actions! Form #{params['form_name']}"
67
- action = 'link'
68
- end
69
- # if return_to is present link directly to URL
61
+
70
62
  if action == 'link' && yaml['url']
71
63
  url = yaml['url']
72
64
  else
@@ -89,10 +81,8 @@ def dc_actions_for_index
89
81
  choices << [ t("helpers.label.#{@form['table']}.#{e}"), e ]
90
82
  end
91
83
  end
92
- data = t('drgcms.sort') + select('sort', 'sort', choices, { include_blank: true }, { class: 'dc-sort-select',
93
- 'data-table' => @form['table'], 'data-form' => CmsHelper.form_param(params)} )
94
- data = mi_icon('sort') + select('sort', 'sort', choices, { include_blank: true }, { class: 'dc-sort-select',
95
- 'data-table' => @form['table'], 'data-form' => CmsHelper.form_param(params)} )
84
+ data = mi_icon('sort') + select('sort', 'sort', choices, { include_blank: true },
85
+ { class: 'dc-sort-select', 'data-table': @form['table'], 'data-form': CmsHelper.form_param(params)} )
96
86
  html_right << %(<li title="#{t('drgcms.sort')}"><div class="dc-sort">#{data}</li>)
97
87
 
98
88
  # filter
@@ -263,9 +253,16 @@ def dc_actions_column
263
253
  actions.delete('standard')
264
254
  end
265
255
  # check must be first action
266
- has_check = actions[0] && actions[0]['type'] == 'check'
267
- width = actions.size == 1 ? 22 : 44
268
- width = 22 if actions.size > 2 && !has_check
256
+ has_check = has_action_type('check', actions)
257
+ # when readonly only check and show are allowed
258
+ if @form['readonly']
259
+ width = has_action_type('show', actions) ? 22 : 0
260
+ width += 22 if has_check
261
+ else
262
+ width = actions.size == 1 ? 22 : 44
263
+ width = 22 if actions.size > 2 && !has_check
264
+ end
265
+
269
266
  [actions, width, has_check]
270
267
  end
271
268
 
@@ -275,7 +272,7 @@ end
275
272
  def dc_actions_column_for_footer
276
273
  return '' unless @form['result_set']['actions']
277
274
 
278
- ignore, width, ignore2 = dc_actions_column
275
+ ignore, width, ignore2 = dc_actions_column()
279
276
  %(<div class="dc-result-actions" style="width: #{width}px;"></div>).html_safe
280
277
  end
281
278
 
@@ -284,10 +281,10 @@ end
284
281
  ############################################################################
285
282
  def dc_actions_for_result(document)
286
283
  actions = @form['result_set']['actions']
287
- return '' if actions.nil? || @form['readonly']
284
+ return '' if actions.nil? #|| @form['readonly']
288
285
 
289
286
  actions, width, has_check = dc_actions_column()
290
- has_sub_menu = actions.size > 2 || (has_check && actions.size > 1)
287
+ has_sub_menu = actions.size > 2 #|| (has_check && actions.size > 1)
291
288
 
292
289
  main_menu, sub_menu = '', ''
293
290
  actions.sort_by(&:first).each do |num, action|
@@ -296,14 +293,16 @@ def dc_actions_for_result(document)
296
293
  # if single definition simulate type parameter
297
294
  yaml = action.class == String ? { 'type' => action } : action
298
295
 
296
+ next if @form['readonly'] && !%[show check].include?(yaml['type'])
297
+
299
298
  if %w(ajax link window popup submit).include?(yaml['type'])
300
299
  @record = document # otherwise document fields can't be used as parameters
301
300
  html = dc_link_ajax_window_submit_action(yaml, document)
302
301
  else
303
302
  caption = dc_get_caption(yaml) || "drgcms.#{yaml['type']}"
304
- title = t(yaml['help'] || caption, '')
303
+ title = t(yaml['title'] || yaml['help'] || caption)
305
304
  caption = has_sub_menu ? t(caption, '') : nil
306
- html = '<li>'
305
+ html = '<li>'
307
306
  html << case yaml['type']
308
307
  when 'check' then
309
308
  main_menu << '<li>' + check_box_tag("check-#{document.id}", false, false, { class: 'dc-check' }) + '</li>'
@@ -312,13 +311,15 @@ def dc_actions_for_result(document)
312
311
  when 'edit' then
313
312
  parms['action'] = 'edit'
314
313
  parms['id'] = document.id
314
+ parms['readonly'] = yaml['readonly']
315
315
  dc_link_to( caption, 'edit-o', parms, title: title )
316
316
 
317
317
  when 'show' then
318
318
  parms['action'] = 'show'
319
319
  parms['id'] = document.id
320
320
  parms['readonly'] = true
321
- dc_link_to( caption, 'eye', parms, title: title )
321
+ icon = yaml['icon'] || 'eye-o'
322
+ dc_link_to( caption, icon, parms, title: title )
322
323
 
323
324
  when 'duplicate' then
324
325
  parms['id'] = document.id
@@ -362,7 +363,7 @@ end
362
363
  ############################################################################
363
364
  def dc_header_for_result
364
365
  html = '<div class="dc-result-header">'
365
- if @form['result_set']['actions'] && !@form['readonly']
366
+ if @form['result_set']['actions'] #&& !@form['readonly']
366
367
  ignore, width, has_check = dc_actions_column()
367
368
  check_all = fa_icon('check-box-o', class: 'dc-check-all') if has_check
368
369
  html << %(<div class="dc-result-actions" style="width:#{width}px;">#{check_all}</div>)
@@ -436,7 +437,7 @@ end
436
437
  ############################################################################
437
438
  # Formats value according to format supplied or data type. There is lots of things missing here.
438
439
  ############################################################################
439
- def dc_format_value(value, format=nil)
440
+ def dc_format_value(value, format = nil)
440
441
  return '' if value.nil?
441
442
 
442
443
  klass = value.class.to_s
@@ -444,7 +445,7 @@ def dc_format_value(value, format=nil)
444
445
 
445
446
  format = format.to_s.upcase
446
447
  if format[0] == 'N'
447
- return '' if value == 0 && format.match('Z')
448
+ return '' if format.match('Z') && value.to_s.to_f == 0.0
448
449
 
449
450
  format.gsub!('Z', '')
450
451
  dec = format[1].blank? ? nil : format[1].to_i
@@ -491,7 +492,9 @@ def dc_columns_for_result(document)
491
492
  dc_process_column_eval(v, document)
492
493
  # as field
493
494
  elsif document.respond_to?(v['name'])
494
- dc_format_value(document.send( v['name'] ), v['format'])
495
+ dc_format_value(document.send(v['name']), v['format'])
496
+ elsif respond_to?(v['name'])
497
+ dc_format_value(send(v['name'], document), v['format'])
495
498
  else
496
499
  "??? #{v['name']}"
497
500
  end
@@ -501,7 +504,7 @@ def dc_columns_for_result(document)
501
504
  end
502
505
  html << '<div class="spacer"></div>'
503
506
  # set class
504
- clas = dc_style_or_class(nil, v['td_class'], value, document)
507
+ clas = dc_style_or_class(nil, v['td_class'] || v['class'], value, document)
505
508
  # set width and align an additional style
506
509
  style = dc_style_or_class(nil, v['td_style'] || v['style'], value, document)
507
510
  flex_align = v['align'].to_s == 'right' ? 'flex-direction:row-reverse;' : ''
@@ -522,15 +525,13 @@ def dc_eval_to_array(expression)
522
525
  expression.split(/\ |\,|\(|\)/).delete_if {|e| e.blank? }.map {|e| e.gsub(/\'|\"/,'').strip }
523
526
  end
524
527
 
525
- private
526
-
527
528
  ############################################################################
528
529
  # Process eval. Breaks eval option and calls with send method.
529
530
  # Parameters:
530
531
  # evaluate : String : Expression to be evaluated
531
532
  # parameters : Array : array of parameters which will be send to method
532
533
  ############################################################################
533
- def dc_process_eval(evaluate, parameters)
534
+ def dc_process_eval(evaluate, parameters = nil)
534
535
  # evaluate by calling send method
535
536
  clas, method = evaluate.split('.')
536
537
  if method.nil?
@@ -541,6 +542,8 @@ def dc_process_eval(evaluate, parameters)
541
542
  end
542
543
  end
543
544
 
545
+ private
546
+
544
547
  ############################################################################
545
548
  # Process eval option for field value.
546
549
  # Used for processing single field column on result_set or form head.
@@ -594,7 +597,7 @@ end
594
597
  # Defines style or class for row (tr) or column (td)
595
598
  ############################################################################
596
599
  def dc_style_or_class(selector, yaml, value, record)
597
- return '' if yaml.nil?
600
+ return '' if yaml.blank?
598
601
 
599
602
  # alias record and value so both names can be used in eval
600
603
  field, document = value, record
@@ -662,4 +665,16 @@ def form_has_input_field?(field_name)
662
665
  !(field['type'] == 'readonly' || field['readonly'])
663
666
  end
664
667
 
668
+ ############################################################################
669
+ # return true if actions define check or show option
670
+ ############################################################################
671
+ def has_action_type(type, actions)
672
+ h = { 'check' => 0, 'show' => 1 }
673
+ return false unless identifier = h[type]
674
+ return false unless actions[identifier]
675
+
676
+ type_value = actions[identifier].class == String ? actions[identifier] : actions[identifier]['type']
677
+ type_value == type
678
+ end
679
+
665
680
  end