drg_cms 0.6.1.6 → 0.6.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +203 -24
- data/app/assets/javascripts/drg_cms/drg_cms.js +183 -95
- data/app/assets/stylesheets/drg_cms/drg_cms.css +542 -509
- data/app/assets/stylesheets/drg_cms_application.css +1 -1
- data/app/assets/stylesheets/drg_cms_cms.css +1 -4
- data/app/controllers/cmsedit_controller.rb +25 -103
- data/app/controllers/dc_common_controller.rb +6 -5
- data/app/controls/browse_models_control.rb +15 -26
- data/app/controls/cmsedit_control.rb +125 -0
- data/app/controls/dc_help_control.rb +1 -1
- data/app/controls/dc_page_control.rb +0 -1
- data/app/controls/dc_poll_result_control.rb +1 -1
- data/app/controls/dc_report.rb +1 -1
- data/app/forms/all_options.yml +1 -1
- data/app/forms/cms_menu.yml +24 -24
- data/app/forms/dc_browse_fields.yml +13 -9
- data/app/forms/dc_poll_result_export.yml +1 -1
- data/app/helpers/cms_common_helper.rb +7 -5
- data/app/helpers/cms_edit_helper.rb +52 -45
- data/app/helpers/cms_helper.rb +76 -40
- data/app/helpers/cms_index_helper.rb +180 -139
- data/app/helpers/dc_application_helper.rb +37 -43
- data/app/models/concerns/dc_page_concern.rb +1 -1
- data/app/models/dc_filter.rb +30 -22
- data/app/models/dc_json_ld.rb +1 -1
- data/app/models/dc_part.rb +19 -9
- data/app/models/drgcms_form_fields/drgcms_field.rb +10 -4
- data/app/models/drgcms_form_fields/link_to.rb +1 -1
- data/app/models/drgcms_form_fields/multitext_autocomplete.rb +5 -5
- data/app/models/drgcms_form_fields/readonly.rb +3 -0
- data/app/models/drgcms_form_fields/select.rb +8 -7
- data/app/models/drgcms_form_fields/text_autocomplete.rb +2 -2
- data/app/renderers/dc_part_renderer.rb +1 -1
- data/app/renderers/dc_poll_renderer.rb +1 -1
- data/app/views/cmsedit/_edit_stuff.html.erb +12 -12
- data/app/views/cmsedit/login.html.erb +1 -1
- data/app/views/dc_common/paste_clipboard.html.erb +1 -1
- data/config/locales/drgcms_en.yml +2 -1
- data/config/locales/drgcms_sl.yml +2 -1
- data/config/locales/kaminari.yml +1 -1
- data/drg_cms.gemspec +1 -1
- data/lib/drg_cms/version.rb +1 -1
- data/lib/drg_cms.rb +4 -4
- metadata +4 -5
- data/app/views/cmsedit/__remove_edit_stuff.js.erb +0 -6
- data/app/views/cmsedit/__show.html.erb +0 -21
@@ -50,12 +50,7 @@ def dc_actions_for_index
|
|
50
50
|
actions['standard'] = nil
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
|
-
html = %(
|
55
|
-
<form id="dc-action-menu">
|
56
|
-
<span class="dc-spinner">#{fa_icon('spinner lg spin')}</span>
|
57
|
-
<ul class="dc-action-menu">)
|
58
|
-
|
53
|
+
html_left, html_right = '', ''
|
59
54
|
# Remove actions settings and sort
|
60
55
|
only_actions = []
|
61
56
|
actions.each { |key, value| only_actions << [key, value] if key.class == Integer }
|
@@ -72,7 +67,7 @@ def dc_actions_for_index
|
|
72
67
|
action = 'link'
|
73
68
|
end
|
74
69
|
# if return_to is present link directly to URL
|
75
|
-
if action == 'link'
|
70
|
+
if action == 'link' && yaml['url']
|
76
71
|
url = yaml['url']
|
77
72
|
else
|
78
73
|
url['controller'] = yaml['controller'] if yaml['controller']
|
@@ -82,53 +77,57 @@ def dc_actions_for_index
|
|
82
77
|
url['control'] = yaml['control'] if yaml['control']
|
83
78
|
end
|
84
79
|
# html link options
|
85
|
-
|
86
|
-
|
87
|
-
|
80
|
+
html_options = yaml['html'] || {}
|
81
|
+
html_options['title'] = yaml['title'] if yaml['title']
|
82
|
+
case
|
88
83
|
# sort
|
89
|
-
when action == 'sort'
|
90
|
-
choices = [[
|
84
|
+
when action == 'sort'
|
85
|
+
choices = [%w[id id]]
|
91
86
|
if @form['index']['sort']
|
92
|
-
@form['index']['sort'].split(',').each do |
|
93
|
-
|
94
|
-
choices << [ t("helpers.label.#{@form['table']}.#{
|
87
|
+
@form['index']['sort'].split(',').each do |e|
|
88
|
+
e.strip!
|
89
|
+
choices << [ t("helpers.label.#{@form['table']}.#{e}"), e ]
|
95
90
|
end
|
96
91
|
end
|
97
|
-
|
98
|
-
|
99
|
-
|
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
|
+
html_right << %(<li><div class="dc-sort">#{data}</li>)
|
100
95
|
|
101
96
|
# filter
|
102
|
-
when action == 'filter'
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
97
|
+
when action == 'filter'
|
98
|
+
table = session[@form['table']]
|
99
|
+
url = table&.dig(:filter) ?
|
100
|
+
url_for(controller: 'cmsedit', action: 'run', control: 'cmsedit.filter_off', t: @form['table'], f: CmsHelper.form_param(params)) :
|
101
|
+
''
|
102
|
+
html_right << %(
|
103
|
+
<li>
|
104
|
+
<div class="dc-filter" title="#{DcFilter.title4_filter_off(table)}" data-url="#{url.html_safe}">
|
105
|
+
#{mi_icon(url.blank? ? 'search' : 'search_off') }#{DcFilter.menu_filter(self).html_safe}
|
106
|
+
</div>
|
107
|
+
</li>#{DcFilter.get_filter_field(self)}).html_safe
|
113
108
|
|
114
109
|
# new
|
115
|
-
when action == 'new'
|
110
|
+
when action == 'new'
|
116
111
|
caption = yaml['caption'] || 'drgcms.new'
|
117
|
-
|
118
|
-
|
112
|
+
html_options['class'] = 'dc-link'
|
113
|
+
html_left << "<li>#{dc_link_to(caption, 'add', url, html_options)}</li>"
|
114
|
+
|
115
|
+
when action == 'close'
|
116
|
+
html_left << %(<li><div class="dc-link" onclick="window.close();"'>#{fa_icon('close')} #{t('drgcms.close')}</div></li>)
|
119
117
|
|
120
|
-
when action == '
|
121
|
-
|
122
|
-
next
|
118
|
+
when action == 'back'
|
119
|
+
html_left << %(<li><div class="dc-link" onclick="history.back();"'>#{fa_icon('arrow_back')} #{t('drgcms.back')}</div></li>)
|
123
120
|
|
124
121
|
# menu
|
125
|
-
when action == 'menu'
|
126
|
-
if options['caption']
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
122
|
+
when action == 'menu'
|
123
|
+
code = if options['caption']
|
124
|
+
caption = t(options['caption'], options['caption']) + ' ' + fa_icon('caret-down')
|
125
|
+
caption + eval(options['eval'])
|
126
|
+
else # when caption is false, provide own actions
|
127
|
+
eval(options['eval'])
|
128
|
+
end
|
129
|
+
html_left << %(<li><div class="dc-link">#{code}</div></li>)
|
130
|
+
|
132
131
|
=begin
|
133
132
|
# reorder
|
134
133
|
when action == 'reorder' then
|
@@ -140,27 +139,34 @@ def dc_actions_for_index
|
|
140
139
|
dc_link_to( caption, 'reorder', parms, method: :delete )
|
141
140
|
=end
|
142
141
|
when action == 'script'
|
143
|
-
|
144
|
-
next
|
142
|
+
html_left << dc_script_action(options)
|
145
143
|
|
146
144
|
when action == 'field'
|
147
|
-
|
148
|
-
next
|
145
|
+
html_right << dc_field_action(yaml)
|
149
146
|
|
150
|
-
when %w(ajax link window submit).include?(action)
|
151
|
-
|
152
|
-
next
|
147
|
+
when %w(ajax link window popup submit).include?(action)
|
148
|
+
html_left << dc_link_ajax_window_submit_action(options, nil)
|
153
149
|
|
154
150
|
else
|
155
|
-
caption = yaml
|
156
|
-
icon = yaml['icon']
|
157
|
-
|
151
|
+
caption = dc_get_caption(yaml) || t("drgcms.#{action}")
|
152
|
+
icon = yaml['icon'] || action
|
153
|
+
html_options['class'] = 'dc-link'
|
154
|
+
code = dc_link_to(caption, icon, url, html_options)
|
155
|
+
html_left << %(<li>#{code}</li>)
|
158
156
|
end
|
159
|
-
html << "<li class=\"dc-link dc-animate\">#{code}</li>"
|
160
|
-
html << DcFilter.get_filter_field(self) if action == 'filter'
|
161
157
|
end
|
162
|
-
|
163
|
-
|
158
|
+
|
159
|
+
%(
|
160
|
+
<form id="dc-action-menu">
|
161
|
+
<span class="dc-spinner">#{fa_icon('settings-o spin')}</span>
|
162
|
+
|
163
|
+
<div class="dc-action-menu">
|
164
|
+
<ul class="dc-left">#{html_left}</ul>
|
165
|
+
<ul class="dc-right">#{html_right}</ul>
|
166
|
+
</div>
|
167
|
+
<div style="clear: both;"></div>
|
168
|
+
</form>
|
169
|
+
).html_safe
|
164
170
|
end
|
165
171
|
|
166
172
|
############################################################################
|
@@ -168,53 +174,53 @@ end
|
|
168
174
|
############################################################################
|
169
175
|
def dc_div_filter
|
170
176
|
choices = []
|
171
|
-
filter =
|
177
|
+
filter = @form['index'] && @form['index']['filter'] ? @form['index']['filter'] + ',' : ''
|
172
178
|
filter << 'id as text_field' # filter id is added by default
|
173
179
|
filter.split(',').each do |f|
|
174
180
|
f.strip!
|
175
181
|
name = f.match(' as ') ? f.split(' ').first : f
|
176
182
|
# like another field on the form
|
177
|
-
if f.match(' like ')
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
choices << [ t("helpers.label.#{@form['table']}.#{name}", name), f ]
|
183
|
+
name, like, f = f.split(' ') if f.match(' like ')
|
184
|
+
choices << [ t("helpers.label.#{@form['table']}.#{name}", name), f ]
|
185
|
+
end
|
186
|
+
choices4_operators = t('drgcms.choices4_filter_operators').chomp.split(',').inject([]) do |r, v|
|
187
|
+
r << (v.match(':') ? v.split(':') : v )
|
183
188
|
end
|
184
|
-
choices4_operators = t('drgcms.choices4_filter_operators').chomp.split(',').inject([]) {|r,v| r << (v.match(':') ? v.split(':') : v )}
|
185
189
|
# currently selected options
|
186
|
-
if session[@form['table']]
|
190
|
+
if session[@form['table']] && session[@form['table']][:filter]
|
187
191
|
field_name, operators_value, dummy = session[@form['table']][:filter].split("\t")
|
188
192
|
else
|
189
193
|
field_name, operators_value = nil, nil
|
190
194
|
end
|
191
|
-
|
192
|
-
|
193
|
-
|
195
|
+
url_on = url_for(controller: 'cmsedit', action: :run, control: 'cmsedit.filter_on' ,
|
196
|
+
t: CmsHelper.table_param(params), f: CmsHelper.form_param(params), filter_input: 1)
|
197
|
+
url_off = url_for(controller: 'cmsedit', action: :run, control: 'cmsedit.filter_off',
|
198
|
+
t: CmsHelper.table_param(params), f: CmsHelper.form_param(params))
|
199
|
+
%(
|
194
200
|
<div id="drgcms_filter" class="div-hidden">
|
195
201
|
<h1>#{t('drgcms.filter_set')}</h1>
|
196
202
|
|
197
203
|
#{ select(nil, 'filter_field1', options_for_select(choices, field_name), { include_blank: true }) }
|
198
204
|
#{ select(nil, 'filter_oper', options_for_select(choices4_operators, operators_value)) }
|
199
205
|
<div class="dc-menu">
|
200
|
-
<div class="dc-link dc-
|
201
|
-
<div class="dc-link
|
206
|
+
<div class="dc-link dc-filter-set" data-url="#{url_on}">#{fa_icon('done')} #{t('drgcms.filter_on')}</div>
|
207
|
+
<div class="dc-link-ajax" data-url="#{url_off}">
|
208
|
+
#{mi_icon('close')}#{t('drgcms.filter_off')}
|
209
|
+
</div>
|
202
210
|
</div>
|
203
|
-
</div>
|
204
|
-
EOT
|
205
|
-
html.html_safe
|
211
|
+
</div>).html_safe
|
206
212
|
end
|
207
213
|
|
208
214
|
############################################################################
|
209
215
|
# Creates popup div for setting filter on result set header.
|
210
216
|
############################################################################
|
211
217
|
def dc_filter_popup
|
212
|
-
html = %
|
213
|
-
|
214
|
-
|
215
|
-
|
218
|
+
html = %(<div class="filter-popup" style="display: none;"><div>#{t('drgcms.filter_set')}</div><ul>)
|
219
|
+
url = url_for(controller: 'cmsedit', action: 'run', control: 'cmsedit.filter_on',
|
220
|
+
t: @form['table'], f: params['form_name'], filter_input: 1)
|
221
|
+
|
216
222
|
t('drgcms.choices4_filter_operators').chomp.split(',').each do |operator_choice|
|
217
|
-
caption,choice = operator_choice.split(':')
|
223
|
+
caption, choice = operator_choice.split(':')
|
218
224
|
html << %Q[<li data-operator="#{choice}" data-url="#{url}">#{caption}</li>]
|
219
225
|
end
|
220
226
|
html << "</ul></div>"
|
@@ -245,18 +251,20 @@ end
|
|
245
251
|
############################################################################
|
246
252
|
def dc_actions_column
|
247
253
|
actions = @form['result_set']['actions']
|
248
|
-
return [{}, 0] if actions.nil? || dc_dont?(actions)
|
254
|
+
return [{}, 0, false] if actions.nil? || dc_dont?(actions)
|
249
255
|
|
250
256
|
# standard actions
|
251
|
-
actions = {'standard' => true} if actions.class == String && actions == 'standard'
|
257
|
+
actions = { 'standard' => true } if actions.class == String && actions == 'standard'
|
252
258
|
std_actions = { 2 => 'edit', 5 => 'delete' }
|
253
259
|
if actions['standard']
|
254
260
|
actions.merge!(std_actions)
|
255
261
|
actions.delete('standard')
|
256
262
|
end
|
257
|
-
|
258
|
-
|
259
|
-
|
263
|
+
# check must be first action
|
264
|
+
has_check = actions.first[1] == 'check'
|
265
|
+
width = actions.size == 1 ? 22 : 44
|
266
|
+
width = 22 if actions.size > 2 and !has_check
|
267
|
+
[actions, width, has_check]
|
260
268
|
end
|
261
269
|
|
262
270
|
############################################################################
|
@@ -265,8 +273,8 @@ end
|
|
265
273
|
def dc_actions_column_for_footer
|
266
274
|
return '' unless @form['result_set']['actions']
|
267
275
|
|
268
|
-
ignore, width = dc_actions_column
|
269
|
-
%
|
276
|
+
ignore, width, ignore2 = dc_actions_column
|
277
|
+
%(<div class="dc-result-actions" style="width: #{width}px;"></div>).html_safe
|
270
278
|
end
|
271
279
|
|
272
280
|
############################################################################
|
@@ -276,57 +284,75 @@ def dc_actions_for_result(document)
|
|
276
284
|
actions = @form['result_set']['actions']
|
277
285
|
return '' if actions.nil? || @form['readonly']
|
278
286
|
|
279
|
-
actions, width = dc_actions_column()
|
280
|
-
|
281
|
-
|
282
|
-
|
287
|
+
actions, width, has_check = dc_actions_column()
|
288
|
+
has_sub_menu = actions.size > 2 || (has_check && actions.size > 1)
|
289
|
+
|
290
|
+
main_menu, sub_menu = '', ''
|
291
|
+
actions.sort_by(&:first).each do |num, action|
|
292
|
+
session[:form_processing] = "result_set:actions: #{num}=#{action}"
|
283
293
|
parms = @parms.clone
|
284
294
|
# if single definition simulate type parameter
|
285
|
-
yaml =
|
286
|
-
|
287
|
-
if %w(ajax link window submit).include?(yaml['type'])
|
295
|
+
yaml = action.class == String ? { 'type' => action } : action
|
296
|
+
|
297
|
+
if %w(ajax link window popup submit).include?(yaml['type'])
|
288
298
|
@record = document # otherwise document fields can't be used as parameters
|
289
|
-
html
|
299
|
+
html = dc_link_ajax_window_submit_action(yaml, document)
|
290
300
|
else
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
when
|
301
|
+
caption = dc_get_caption(yaml) || "drgcms.#{yaml['type']}"
|
302
|
+
title = t(yaml['help'] || caption, '')
|
303
|
+
caption = has_sub_menu ? t(caption, '') : nil
|
304
|
+
html = '<li>'
|
305
|
+
html << case yaml['type']
|
306
|
+
when 'check' then
|
307
|
+
main_menu << '<li>' + check_box_tag("check-#{document.id}", false, false, { class: 'dc-check' }) + '</li>'
|
308
|
+
next
|
309
|
+
|
310
|
+
when 'edit' then
|
297
311
|
parms['action'] = 'edit'
|
298
|
-
parms['id']
|
299
|
-
dc_link_to(
|
312
|
+
parms['id'] = document.id
|
313
|
+
dc_link_to( caption, 'edit-o', parms, title: title )
|
314
|
+
|
315
|
+
when 'show' then
|
316
|
+
parms['action'] = 'show'
|
317
|
+
parms['id'] = document.id
|
318
|
+
parms['readonly'] = true
|
319
|
+
dc_link_to( caption, 'eye', parms, title: title )
|
300
320
|
|
301
|
-
when
|
302
|
-
parms['id']
|
321
|
+
when 'duplicate' then
|
322
|
+
parms['id'] = document.id
|
303
323
|
# duplicate string will be added to these fields.
|
304
324
|
parms['dup_fields'] = yaml['dup_fields']
|
305
325
|
parms['action'] = 'create'
|
306
|
-
dc_link_to(
|
326
|
+
dc_link_to( caption, 'content_copy-o', parms, data: { confirm: t('drgcms.confirm_dup') }, method: :post, title: title )
|
307
327
|
|
308
|
-
when
|
328
|
+
when 'delete' then
|
309
329
|
parms['action'] = 'destroy'
|
310
|
-
parms['id']
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
# undocumented so far
|
315
|
-
when yaml['type'] == 'edit_embedded'
|
316
|
-
parms['controller'] = 'cmsedit'
|
317
|
-
parms['table'] += ";#{yaml['table']}"
|
318
|
-
parms['ids'] ||= ''
|
319
|
-
parms['ids'] += "#{document.id};"
|
320
|
-
dc_link_to( nil, 'table lg', parms, method: :get )
|
321
|
-
|
330
|
+
parms['id'] = document.id
|
331
|
+
dc_link_to( caption, 'delete-o', parms, data: { confirm: t('drgcms.confirm_delete') }, method: :delete, title: title )
|
332
|
+
|
322
333
|
else # error.
|
323
334
|
yaml['type'].to_s
|
324
335
|
end
|
325
336
|
html << '</li>'
|
326
337
|
end
|
338
|
+
|
339
|
+
if has_sub_menu
|
340
|
+
sub_menu << html
|
341
|
+
else
|
342
|
+
main_menu << html
|
343
|
+
end
|
327
344
|
end
|
328
|
-
|
329
|
-
|
345
|
+
|
346
|
+
if has_sub_menu
|
347
|
+
%(
|
348
|
+
<ul class="dc-result-actions" style="width: #{width}px;">#{main_menu}
|
349
|
+
<li><div class="dc-result-submenu">#{fa_icon('more_vert')}
|
350
|
+
<ul id="menu-#{document.id}">#{sub_menu}</ul>
|
351
|
+
</div></li>
|
352
|
+
</ul>)
|
353
|
+
else
|
354
|
+
%(<ul class="dc-result-actions" style="width: #{width}px;">#{main_menu}</ul>)
|
355
|
+
end.html_safe
|
330
356
|
end
|
331
357
|
|
332
358
|
############################################################################
|
@@ -334,12 +360,10 @@ end
|
|
334
360
|
############################################################################
|
335
361
|
def dc_header_for_result
|
336
362
|
html = '<div class="dc-result-header">'
|
337
|
-
if @form['result_set']['actions']
|
338
|
-
ignore, width = dc_actions_column()
|
339
|
-
|
340
|
-
|
341
|
-
end
|
342
|
-
html << %Q[<div class="actions" style="width:#{width}px;">#{check_all}</div>]
|
363
|
+
if @form['result_set']['actions'] && !@form['readonly']
|
364
|
+
ignore, width, has_check = dc_actions_column()
|
365
|
+
check_all = fa_icon('check-square-o', class: 'dc-check-all') if has_check
|
366
|
+
html << %(<div class="dc-result-actions" style="width:#{width}px;">#{check_all}</div>)
|
343
367
|
end
|
344
368
|
# preparation for sort icon
|
345
369
|
sort_field, sort_direction = nil, nil
|
@@ -352,25 +376,32 @@ def dc_header_for_result
|
|
352
376
|
session[:form_processing] = "result_set:columns: #{k}=#{v}"
|
353
377
|
next if v['width'].to_s.match(/hidden|none/i)
|
354
378
|
|
355
|
-
th = %
|
379
|
+
th = %(<div class="th" style="width:#{v['width'] || '15%'};text-align:#{v['align'] || 'left'};" data-name="#{v['name']}")
|
356
380
|
label = v['caption'] || v['label']
|
357
381
|
label = (v['name'] ? "helpers.label.#{@form['table']}.#{v['name']}" : '') if label.nil?
|
358
382
|
label = t(label) if label.match(/\./)
|
359
|
-
# no sorting when embedded documents or custom filter is active
|
360
|
-
#sort_ok = @form['result_set'].nil? || (@form['result_set'] && @form['result_set']['filter'].nil?)
|
383
|
+
# no sorting when embedded documents or custom filter is active
|
361
384
|
sort_ok = !dc_dont?(@form['result_set']['sort'], false)
|
362
385
|
sort_ok = sort_ok || (@form['index'] && @form['index']['sort'])
|
363
386
|
sort_ok = sort_ok && !dc_dont?(v['sort'], false)
|
364
|
-
if @tables.size == 1
|
365
|
-
icon = '
|
387
|
+
if @tables.size == 1 && sort_ok
|
388
|
+
icon = 'sort_unset md-18'
|
389
|
+
filter_class = form_has_input_field?(v['name']) ? nil : 'no-filter'
|
366
390
|
if v['name'] == sort_field
|
367
|
-
icon = sort_direction == '1' ? '
|
368
|
-
|
369
|
-
|
391
|
+
icon = sort_direction == '1' ? 'sort_down md-18' : 'sort_up md-18'
|
392
|
+
else
|
393
|
+
# no icon if filter can not be set
|
394
|
+
icon = nil if filter_class
|
395
|
+
end
|
396
|
+
# sort and filter icon
|
397
|
+
icon = mi_icon(icon, class: filter_class) if icon
|
398
|
+
url = url_for(controller: 'cmsedit', action: 'run', control: 'cmsedit.sort', sort: v['name'],
|
399
|
+
t: CmsHelper.table_param(params), f: CmsHelper.form_param(params))
|
400
|
+
th << %(><span data-url="#{url}">#{label}</span>#{icon}</div>)
|
370
401
|
else
|
371
402
|
th << ">#{label}</div>"
|
372
403
|
end
|
373
|
-
html <<
|
404
|
+
html << %(<div class="spacer"></div>) + th
|
374
405
|
end
|
375
406
|
end
|
376
407
|
(html << '</div>').html_safe
|
@@ -386,8 +417,8 @@ def dc_clicks_for_result(document)
|
|
386
417
|
opts = {}
|
387
418
|
opts[:controller] = yaml['controller'] || 'cmsedit'
|
388
419
|
opts[:action] = yaml['action']
|
389
|
-
opts[:table] = yaml['table']
|
390
|
-
opts[:form_name] = yaml['form_name']
|
420
|
+
opts[:table] = yaml['table'] || CmsHelper.table_param(params)
|
421
|
+
opts[:form_name] = yaml['form_name'] || CmsHelper.form_param(params) || opts[:table]
|
391
422
|
opts[:method] = yaml['method'] || 'get'
|
392
423
|
opts[:id] = document['id']
|
393
424
|
opts[:readonly] = yaml['readonly'] if yaml['readonly']
|
@@ -396,8 +427,8 @@ def dc_clicks_for_result(document)
|
|
396
427
|
else
|
397
428
|
html << (' data-dblclick=' +
|
398
429
|
url_for(action: 'show', controller: 'cmsedit', id: document.id, ids: params[:ids],
|
399
|
-
readonly: (params[:readonly] ? 2 : 1),
|
400
|
-
|
430
|
+
readonly: (params[:readonly] ? 2 : 1), t: CmsHelper.table_param(params),
|
431
|
+
f: CmsHelper.form_param(params)) ) if @form['form']
|
401
432
|
end
|
402
433
|
html
|
403
434
|
end
|
@@ -532,7 +563,7 @@ def dc_process_column_eval(yaml, document)
|
|
532
563
|
|
533
564
|
# defined in helpers. For example dc_icon_for_boolean
|
534
565
|
elsif respond_to?(yaml['eval'])
|
535
|
-
send(yaml['eval'], document
|
566
|
+
send(yaml['eval'], document, yaml['name'])
|
536
567
|
|
537
568
|
# defined in model
|
538
569
|
elsif document.respond_to?(yaml['eval'])
|
@@ -618,4 +649,14 @@ def dc_process_result_set_method
|
|
618
649
|
end
|
619
650
|
end
|
620
651
|
|
652
|
+
############################################################################
|
653
|
+
# Check if form has defined input field for field_name and that is not readonly field.
|
654
|
+
############################################################################
|
655
|
+
def form_has_input_field?(field_name)
|
656
|
+
field = dc_get_field_form_definition(field_name)
|
657
|
+
return if field.nil?
|
658
|
+
|
659
|
+
!(field['type'] == 'readonly' || field['readonly'])
|
660
|
+
end
|
661
|
+
|
621
662
|
end
|