drg_cms 0.6.1.9 → 0.7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +260 -0
- data/MIT-LICENSE +1 -1
- data/README.md +9 -5
- data/app/assets/javascripts/drg_cms/drg_cms.js +69 -32
- data/app/assets/javascripts/drg_cms_application.js +0 -2
- data/app/assets/javascripts/drg_cms_cms.js +2 -3
- data/app/assets/stylesheets/drg_cms/drg_cms.css +89 -26
- data/app/assets/stylesheets/drg_cms/jstree.css +32 -27
- data/app/assets/stylesheets/drg_cms/select-multiple.css +4 -2
- data/app/controllers/cmsedit_controller.rb +9 -111
- data/app/controllers/dc_application_controller.rb +100 -23
- data/app/controllers/dc_common_controller.rb +10 -24
- data/app/controls/browse_models_control.rb +3 -1
- data/app/controls/cmsedit_control.rb +5 -1
- data/app/controls/dc_category_control.rb +61 -0
- data/app/controls/dc_report.rb +1 -1
- data/app/forms/all_options.yml +2 -0
- data/app/forms/cms_menu.yml +3 -2
- data/app/forms/dc_browse_models.yml +24 -2
- data/app/forms/dc_category.yml +17 -8
- data/app/forms/dc_category_as_tree.yml +31 -0
- data/app/forms/dc_steps_template.yml +51 -0
- data/app/forms/help/dc_category_as_tree.en +4 -0
- data/app/forms/help/dc_category_as_tree.sl +5 -0
- data/app/helpers/cms_common_helper.rb +66 -1
- data/app/helpers/cms_edit_helper.rb +230 -121
- data/app/helpers/cms_helper.rb +74 -17
- data/app/helpers/cms_index_helper.rb +40 -37
- data/app/helpers/dc_application_helper.rb +37 -76
- data/app/helpers/dc_category_helper.rb +129 -0
- data/app/models/dc_category.rb +50 -24
- data/app/models/dc_journal.rb +2 -2
- data/app/models/dc_json_ld.rb +18 -41
- data/app/models/drgcms_form_fields/date_picker.rb +10 -12
- data/app/models/drgcms_form_fields/datetime_picker.rb +10 -11
- data/app/models/drgcms_form_fields/drgcms_field.rb +46 -4
- data/app/models/drgcms_form_fields/readonly.rb +1 -1
- data/app/models/drgcms_form_fields/select.rb +2 -2
- data/app/models/drgcms_form_fields/text_autocomplete.rb +2 -2
- data/app/models/drgcms_form_fields/text_with_select.rb +1 -0
- data/app/models/drgcms_form_fields/tree_select.rb +20 -19
- data/app/renderers/dc_common_renderer.rb +20 -3
- data/app/views/cmsedit/_form.html.erb +19 -12
- data/app/views/cmsedit/edit.html.erb +10 -6
- data/app/views/cmsedit/index.html.erb +5 -3
- data/app/views/cmsedit/new.html.erb +9 -5
- data/app/views/dc_common/_help.html.erb +1 -0
- data/app/views/layouts/content.html.erb +1 -1
- data/config/locales/drgcms_en.yml +7 -0
- data/config/locales/drgcms_sl.yml +7 -0
- data/drg_cms.gemspec +3 -3
- data/lib/drg_cms/version.rb +1 -1
- data/lib/tasks/dc_cleanup.rake +20 -42
- metadata +18 -12
- data/History.log +0 -109
@@ -116,7 +116,7 @@ def toggle_edit_mode
|
|
116
116
|
end
|
117
117
|
url << (url.match(/\?/) ? '&' : '?')
|
118
118
|
url << "return_to_ypos=#{ypos}"
|
119
|
-
redirect_to
|
119
|
+
redirect_to(url, allow_other_host: true)
|
120
120
|
end
|
121
121
|
|
122
122
|
####################################################################
|
@@ -128,15 +128,15 @@ def process_login
|
|
128
128
|
|
129
129
|
unless params[:record][:password].blank? #password must not be empty
|
130
130
|
user = DcUser.find_by(username: params[:record][:username], active: true)
|
131
|
-
if user
|
131
|
+
if user && user.authenticate(params[:record][:password])
|
132
132
|
fill_login_data(user, params[:record][:remember_me].to_i == 1)
|
133
|
-
return redirect_to
|
133
|
+
return redirect_to(params[:return_to] || '/', allow_other_host: true)
|
134
134
|
else
|
135
135
|
clear_login_data # on the safe side
|
136
136
|
end
|
137
137
|
end
|
138
138
|
flash[:error] = t('drgcms.invalid_username')
|
139
|
-
redirect_to
|
139
|
+
redirect_to(params[:return_to] || '/', allow_other_host: true)
|
140
140
|
end
|
141
141
|
|
142
142
|
####################################################################
|
@@ -144,7 +144,7 @@ end
|
|
144
144
|
####################################################################
|
145
145
|
def logout
|
146
146
|
clear_login_data
|
147
|
-
redirect_to
|
147
|
+
redirect_to(params[:return_to] || '/', allow_other_host: true)
|
148
148
|
end
|
149
149
|
|
150
150
|
####################################################################
|
@@ -156,14 +156,14 @@ def login
|
|
156
156
|
user = DcUser.find(cookies.signed[:remember_me])
|
157
157
|
if user and user.active
|
158
158
|
fill_login_data(user, true)
|
159
|
-
return
|
159
|
+
return(redirect_to params[:return_to], allow_other_host: true)
|
160
160
|
else
|
161
161
|
clear_login_data # on the safe side
|
162
162
|
end
|
163
163
|
end
|
164
164
|
# Display login
|
165
165
|
route = params[:route] || 'poll'
|
166
|
-
redirect_to
|
166
|
+
redirect_to("/#{route}?poll_id=login&return_to=#{params[:return_to]}", allow_other_host: true)
|
167
167
|
end
|
168
168
|
|
169
169
|
####################################################################
|
@@ -268,7 +268,7 @@ end
|
|
268
268
|
########################################################################
|
269
269
|
def add_json_ld_schema
|
270
270
|
edited_document = DcJsonLd.find_document_by_ids(CmsHelper.table_param(params), params[:ids])
|
271
|
-
yaml = YAML.load_file(
|
271
|
+
yaml = YAML.load_file( CmsHelper.form_file_find('json_ld_schema') )
|
272
272
|
schema_data = yaml[params[:schema]]
|
273
273
|
# Existing document
|
274
274
|
if edited_document.dc_json_lds.find_by(type: "@#{params[:schema]}")
|
@@ -283,12 +283,10 @@ end
|
|
283
283
|
# Will provide help data
|
284
284
|
########################################################################
|
285
285
|
def help
|
286
|
+
dc_form_read
|
286
287
|
form_name = CmsHelper.form_param(params) || CmsHelper.table_param(params)
|
287
|
-
@form = form_name ? YAML.load_file(dc_find_form_file(form_name)) : {}
|
288
|
-
return render json: {} if @form.nil?
|
289
|
-
|
290
288
|
help_file_name = @form['help'] || @form['extend'] || form_name
|
291
|
-
help_file_name = find_help_file(help_file_name)
|
289
|
+
help_file_name = DcApplicationController.find_help_file(help_file_name)
|
292
290
|
@help = YAML.load_file(help_file_name) if help_file_name
|
293
291
|
# no auto generated help on index action
|
294
292
|
return render json: {} if params[:type] == 'index' && @help.nil?
|
@@ -298,18 +296,6 @@ end
|
|
298
296
|
|
299
297
|
protected
|
300
298
|
|
301
|
-
########################################################################
|
302
|
-
# Will search for help file and return it's path if found
|
303
|
-
########################################################################
|
304
|
-
def find_help_file(help_file_name)
|
305
|
-
file_name = nil
|
306
|
-
DrgCms.paths(:forms).reverse.each do |path|
|
307
|
-
f = "#{path}/help/#{help_file_name}.#{I18n.locale}"
|
308
|
-
file_name = f and break if File.exist?(f)
|
309
|
-
end
|
310
|
-
file_name
|
311
|
-
end
|
312
|
-
|
313
299
|
########################################################################
|
314
300
|
# Subroutine of add_json_ld_schema for adding one element
|
315
301
|
########################################################################
|
@@ -49,6 +49,8 @@ end
|
|
49
49
|
def collections
|
50
50
|
@records = []
|
51
51
|
all_collections.each do |collection|
|
52
|
+
next if params[:filter] && !collection.match(/#{params[:filter]}/i)
|
53
|
+
|
52
54
|
@records << DcMemory.new({'id' => collection, 'description' => t("helpers.label.#{collection}.tabletitle") })
|
53
55
|
end
|
54
56
|
@records
|
@@ -75,7 +77,7 @@ def all_fields
|
|
75
77
|
'_default' => options[:default]
|
76
78
|
})
|
77
79
|
end
|
78
|
-
# embedded documents
|
80
|
+
# embedded documents
|
79
81
|
document.embedded_relations.each do |a_embedded|
|
80
82
|
embedded = a_embedded.last
|
81
83
|
description = I18n.t("helpers.help.#{params[:id]}.#{embedded.key}")
|
@@ -43,11 +43,15 @@ end
|
|
43
43
|
######################################################################
|
44
44
|
def filter_on
|
45
45
|
table_name = CmsHelper.table_param(params).strip.split(';').first.underscore
|
46
|
+
session[table_name] ||= {}
|
46
47
|
session[table_name][:page] = 1
|
47
48
|
set_session_filter(table_name)
|
48
49
|
url = url_for( controller: 'cmsedit', t: table_name, f: CmsHelper.form_param(params))
|
49
50
|
|
50
|
-
|
51
|
+
respond_to do |format|
|
52
|
+
format.json { render json: { url: url } }
|
53
|
+
format.html { redirect_to url }
|
54
|
+
end
|
51
55
|
end
|
52
56
|
|
53
57
|
########################################################################
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2014+ Damjan Rems
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
######################################################################
|
25
|
+
# DrgcmsControls for DcPage model.
|
26
|
+
######################################################################
|
27
|
+
module DcCategoryControl
|
28
|
+
|
29
|
+
######################################################################
|
30
|
+
# Called when new empty record is created
|
31
|
+
######################################################################
|
32
|
+
def dc_new_record
|
33
|
+
if params[:selected]
|
34
|
+
|
35
|
+
end
|
36
|
+
if params[:from_menu]
|
37
|
+
# find menu and submenu. Menu class is defined in Site.
|
38
|
+
menu_a = params[:id].split(';')
|
39
|
+
menu = dc_get_site.menu_klass.find(menu_a.shift)
|
40
|
+
menu_items_method = "#{dc_get_site.menu_class}_items".underscore
|
41
|
+
menu_i = menu.send(menu_items_method).find(menu_a.shift)
|
42
|
+
while menu_a.size > 0 do menu_i = menu_i.send(menu_items_method).find(menu_a.shift) end
|
43
|
+
# Fill values for form
|
44
|
+
@record.subject = menu_i.caption
|
45
|
+
@record.dc_site_id = menu.dc_site_id
|
46
|
+
@record.menu_id = params[:id]
|
47
|
+
# set update_menu on save parameter
|
48
|
+
params['p__update_menu'] = '1'
|
49
|
+
else
|
50
|
+
@record.design_id = params[:design_id] if params[:design_id]
|
51
|
+
return unless params[:page_id]
|
52
|
+
# inherit some values from currently active page
|
53
|
+
if page = DcPage.find(params[:page_id])
|
54
|
+
@record.design_id = page.design_id
|
55
|
+
@record.menu = page.menu
|
56
|
+
@record.dc_site_id = page.dc_site_id
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/app/controls/dc_report.rb
CHANGED
@@ -132,7 +132,7 @@ end
|
|
132
132
|
# Export data to Excel
|
133
133
|
######################################################################
|
134
134
|
def export_to_excel(report_id)
|
135
|
-
|
135
|
+
dc_form_read if @form.blank?
|
136
136
|
# use report options if present
|
137
137
|
columns = (@form['report'] ? @form['report'] : @form)['result_set']['columns'].sort
|
138
138
|
|
data/app/forms/all_options.yml
CHANGED
data/app/forms/cms_menu.yml
CHANGED
@@ -62,12 +62,13 @@ menu:
|
|
62
62
|
controller: cmsedit
|
63
63
|
icon: more_horiz-o
|
64
64
|
table: dc_simple_menu
|
65
|
-
90:
|
65
|
+
90:
|
66
66
|
caption: helpers.label.dc_category.tabletitle
|
67
67
|
controller: cmsedit
|
68
68
|
icon: list
|
69
69
|
table: dc_category
|
70
|
-
|
70
|
+
|
71
|
+
100:
|
71
72
|
caption: helpers.label.dc_poll.tabletitle
|
72
73
|
controller: cmsedit
|
73
74
|
icon: poll-o
|
@@ -6,6 +6,16 @@ controls: browse_models
|
|
6
6
|
permissions:
|
7
7
|
can_view: admin
|
8
8
|
|
9
|
+
index:
|
10
|
+
actions:
|
11
|
+
10:
|
12
|
+
type: field
|
13
|
+
name: filter
|
14
|
+
field_type: text_field
|
15
|
+
caption: Filter
|
16
|
+
size: 10
|
17
|
+
|
18
|
+
|
9
19
|
result_set:
|
10
20
|
filter: collections
|
11
21
|
|
@@ -19,8 +29,20 @@ result_set:
|
|
19
29
|
10:
|
20
30
|
name: id
|
21
31
|
caption: Collection
|
22
|
-
td_style: 'font-weight: bold;
|
23
|
-
|
32
|
+
td_style: 'font-weight: bold;'
|
33
|
+
|
24
34
|
20:
|
25
35
|
name: description
|
26
36
|
caption: Decription
|
37
|
+
|
38
|
+
script: '
|
39
|
+
$(document).ready( function() {
|
40
|
+
$("#record_filter").keydown( function(e) {
|
41
|
+
if (e.which == "13" || e.which == "9") {
|
42
|
+
let url = "/cmsedit?form_name=dc_browse_models&table=dc_memory&filter=" + this.value;
|
43
|
+
window.location.href = url;
|
44
|
+
e.preventDefault();
|
45
|
+
};
|
46
|
+
});
|
47
|
+
});
|
48
|
+
'
|
data/app/forms/dc_category.yml
CHANGED
@@ -3,8 +3,17 @@
|
|
3
3
|
table: dc_category
|
4
4
|
|
5
5
|
index:
|
6
|
-
filter: name, description,
|
7
|
-
actions:
|
6
|
+
filter: name, description, dc_site_id, parent
|
7
|
+
actions:
|
8
|
+
1: new
|
9
|
+
2: filter
|
10
|
+
10:
|
11
|
+
type: link
|
12
|
+
icon: account_tree-o
|
13
|
+
caption: drgcms.category_as_tree
|
14
|
+
table: dc_category
|
15
|
+
form_name: dc_category_as_tree
|
16
|
+
# controller: cmsedit
|
8
17
|
|
9
18
|
result_set:
|
10
19
|
actions:
|
@@ -36,13 +45,11 @@ form:
|
|
36
45
|
10:
|
37
46
|
name: name
|
38
47
|
type: text_field
|
39
|
-
|
40
|
-
size: 30
|
48
|
+
size: 30
|
41
49
|
20:
|
42
50
|
name: description
|
43
51
|
type: text_field
|
44
|
-
|
45
|
-
size: 100
|
52
|
+
size: 100
|
46
53
|
30:
|
47
54
|
name: ctype
|
48
55
|
type: select
|
@@ -51,8 +58,7 @@ form:
|
|
51
58
|
40:
|
52
59
|
name: order
|
53
60
|
type: text_field
|
54
|
-
|
55
|
-
size: 5
|
61
|
+
size: 5
|
56
62
|
50:
|
57
63
|
name: dc_site_id
|
58
64
|
type: select
|
@@ -65,4 +71,7 @@ form:
|
|
65
71
|
eval: DcCategory.values_for_parent
|
66
72
|
html:
|
67
73
|
include_blank: true
|
74
|
+
70:
|
75
|
+
name: active
|
76
|
+
type: check_box
|
68
77
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
## YAML Template for page
|
2
|
+
---
|
3
|
+
extend: dc_category
|
4
|
+
|
5
|
+
index:
|
6
|
+
actions:
|
7
|
+
10: /
|
8
|
+
|
9
|
+
result_set:
|
10
|
+
type: method
|
11
|
+
eval: categories_as_tree
|
12
|
+
|
13
|
+
form:
|
14
|
+
actions:
|
15
|
+
standard: /
|
16
|
+
1:
|
17
|
+
type: link
|
18
|
+
caption: drgcms.back
|
19
|
+
icon: arrow-back
|
20
|
+
form_name: dc_category_as_tree
|
21
|
+
table: dc_category
|
22
|
+
params:
|
23
|
+
ids:
|
24
|
+
object: params
|
25
|
+
method: ids
|
26
|
+
|
27
|
+
10:
|
28
|
+
type: submit
|
29
|
+
caption: 'drgcms.save&back'
|
30
|
+
form_name: dc_category_as_tree
|
31
|
+
table: dc_category
|
@@ -0,0 +1,51 @@
|
|
1
|
+
## Template for standard options on wizard form
|
2
|
+
form:
|
3
|
+
css: '#dc-form-left {display: block;width: 20%}'
|
4
|
+
actions:
|
5
|
+
1:
|
6
|
+
type: ajax
|
7
|
+
caption: drgcms.cancel
|
8
|
+
icon: cancel
|
9
|
+
method: post
|
10
|
+
form_name: x
|
11
|
+
action: run
|
12
|
+
control: x.steps_cancel
|
13
|
+
params:
|
14
|
+
step: x
|
15
|
+
next_step: x
|
16
|
+
|
17
|
+
10:
|
18
|
+
type: ajax
|
19
|
+
caption: drgcms.back
|
20
|
+
icon: arrow-back
|
21
|
+
method: post
|
22
|
+
form_name: x
|
23
|
+
action: run
|
24
|
+
control: x.steps
|
25
|
+
params:
|
26
|
+
step: x
|
27
|
+
next_step: x
|
28
|
+
|
29
|
+
20:
|
30
|
+
type: ajax
|
31
|
+
caption: drgcms.next
|
32
|
+
icon: arrow-forward
|
33
|
+
method: post
|
34
|
+
form_name: x
|
35
|
+
action: run
|
36
|
+
control: x.steps
|
37
|
+
params:
|
38
|
+
step: x
|
39
|
+
next_step: x
|
40
|
+
|
41
|
+
100:
|
42
|
+
type: ajax
|
43
|
+
caption: drgcms.finish
|
44
|
+
icon: done
|
45
|
+
method: post
|
46
|
+
form_name: x
|
47
|
+
action: run
|
48
|
+
control: x.steps_finish
|
49
|
+
params:
|
50
|
+
step: x
|
51
|
+
next_step: x
|
@@ -0,0 +1,5 @@
|
|
1
|
+
---
|
2
|
+
index: "<p>Urejanje kategorij v drevesnem pogledu. Poiščite vašo kategorijo
|
3
|
+
in kliknite desni gumb na miški za menu.</p>\r\n"
|
4
|
+
form: "<p>Urejanje kategorij v drevesnem pogledu. Poiščite vašo kategorijo
|
5
|
+
in kliknite desni gumb na miški za menu.</p>\r\n"
|
@@ -81,12 +81,26 @@ 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
|
84
|
+
def t_label_for_field(field_name, default='')
|
85
85
|
c = t("helpers.label.#{@form['table']}.#{field_name}", default)
|
86
86
|
c = field_name.capitalize.gsub('_',' ') if c.match( 'translation missing' )
|
87
87
|
c
|
88
88
|
end
|
89
89
|
|
90
|
+
############################################################################
|
91
|
+
# Returns label for field translated to current locale for usage browser header.
|
92
|
+
# Translation is provided by lang.helpers.label.table_name.field_name locale. If
|
93
|
+
# not found method will look in standard drgcms translations.
|
94
|
+
#
|
95
|
+
############################################################################
|
96
|
+
def t_label_for_column(options)
|
97
|
+
label = options['caption'] || options['label']
|
98
|
+
label = (options['name'] ? "helpers.label.#{@form['table']}.#{options['name']}" : '') if label.nil?
|
99
|
+
label = t(label) if label.match(/\./)
|
100
|
+
label = t("drgcms.#{options['name']}") if label.match('helpers.') # standard field names like created_by, updated_at
|
101
|
+
label
|
102
|
+
end
|
103
|
+
|
90
104
|
###########################################################################
|
91
105
|
# When select field is used on form options for select can be provided by
|
92
106
|
# helpers.label.table_name.choices4_name locale. This is how select
|
@@ -374,4 +388,55 @@ def dc_help_body
|
|
374
388
|
(params[:type] == 'index' ? @help['index'] : @help['form']).html_safe
|
375
389
|
end
|
376
390
|
|
391
|
+
############################################################################
|
392
|
+
# Will return code for help button if there is any help text available for the form.
|
393
|
+
############################################################################
|
394
|
+
def dc_help_button(result_set)
|
395
|
+
type = result_set.nil? ? 'form' : 'index'
|
396
|
+
form_name = CmsHelper.form_param(params) || CmsHelper.table_param(params)
|
397
|
+
url = url_for(controller: :dc_common, action: :help, type: type, f: form_name)
|
398
|
+
html = %(<div class="dc-help-icon dc-link-ajax" data-url=#{url}>#{fa_icon('question-circle')}</div>)
|
399
|
+
return html if type == 'form'
|
400
|
+
|
401
|
+
# check if index has any help available
|
402
|
+
help_file_name = @form['help'] || @form['extend'] || form_name
|
403
|
+
help_file_name = DcApplicationController.find_help_file(help_file_name)
|
404
|
+
if help_file_name
|
405
|
+
help = YAML.load_file(help_file_name)
|
406
|
+
return html if help['index']
|
407
|
+
end
|
408
|
+
''
|
409
|
+
end
|
410
|
+
|
411
|
+
############################################################################
|
412
|
+
# Will return html code for steps menu when form with steps is processed.
|
413
|
+
############################################################################
|
414
|
+
def dc_steps_menu_get(parent)
|
415
|
+
yaml = @form['form']['steps']
|
416
|
+
return '' unless yaml
|
417
|
+
|
418
|
+
html = %(<ul id="dc-steps-menu"><h2>#{t('drgcms.steps')}</h2>)
|
419
|
+
control = @form['control'] ? @form['control'] : @form['table']
|
420
|
+
parms = { controller: 'cmsedit', action: 'run', control: "#{control}.steps",
|
421
|
+
table: CmsHelper.table_param(params),
|
422
|
+
form_name: CmsHelper.form_param(params),
|
423
|
+
id: @record.id }
|
424
|
+
|
425
|
+
yaml.sort.each_with_index do |data, i|
|
426
|
+
n = i + 1
|
427
|
+
step = data.last # it's an array
|
428
|
+
url = case params[:step].to_i
|
429
|
+
when n + 1 then url_for(parms.merge({ step: n + 1, next_step: n}))
|
430
|
+
when n then url_for(parms.merge({ step: n, next_step: n}))
|
431
|
+
when n - 1 then url_for(parms.merge({ step: n - 1, next_step: n}))
|
432
|
+
else
|
433
|
+
''
|
434
|
+
end
|
435
|
+
_class = url.present? ? 'dc-link-ajax' : ''
|
436
|
+
_class << (params[:step].to_i == n ? ' active' : '')
|
437
|
+
html << %(<li class="#{_class}" data-url="#{url}">#{step['title']}</li>)
|
438
|
+
end
|
439
|
+
html << '</ul>'
|
440
|
+
end
|
441
|
+
|
377
442
|
end
|