drg_cms 0.6.1.9 → 0.7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/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
data/app/models/dc_json_ld.rb
CHANGED
@@ -37,21 +37,21 @@
|
|
37
37
|
#
|
38
38
|
########################################################################
|
39
39
|
class DcJsonLd
|
40
|
-
|
41
|
-
|
40
|
+
include Mongoid::Document
|
41
|
+
include Mongoid::Timestamps
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
field :name, type: String
|
44
|
+
field :type, type: String
|
45
|
+
field :data, type: String
|
46
|
+
field :active, type: Boolean, default: true
|
47
47
|
|
48
|
-
|
48
|
+
embeds_many :dc_json_lds, :cyclic => true
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
field :created_by, type: BSON::ObjectId
|
51
|
+
field :updated_by, type: BSON::ObjectId
|
52
|
+
|
53
|
+
validates :name, presence: true
|
54
|
+
validates :type, presence: true
|
55
55
|
|
56
56
|
##########################################################################
|
57
57
|
# Returns JSON LD data as YAML
|
@@ -71,29 +71,6 @@ def get_json_ld(parent_data)
|
|
71
71
|
yaml
|
72
72
|
end
|
73
73
|
|
74
|
-
########################################################################
|
75
|
-
# Searches forms path for file_name and returns full file name or nil if not found.
|
76
|
-
#
|
77
|
-
# @param [String] Form file name. File name can be passed as gem_name.filename. This can
|
78
|
-
# be useful when you are extending form but want to retain same name as original form
|
79
|
-
# For example. You are extending dc_user form from drg_cms gem and want to
|
80
|
-
# retain same dc_user name. This can be done by setting drg_cms.dc_user to extend option.
|
81
|
-
#
|
82
|
-
# @return [String] Form file name including path or nil if not found.
|
83
|
-
########################################################################
|
84
|
-
def self.dc_find_form_file(form_file)
|
85
|
-
form_path=nil
|
86
|
-
if form_file.match(/\.|\//)
|
87
|
-
form_path,form_file=form_file.split(/\.|\//)
|
88
|
-
end
|
89
|
-
DrgCms.paths(:forms).reverse.each do |path|
|
90
|
-
f = "#{path}/#{form_file}.yml"
|
91
|
-
return f if File.exist?(f) and (form_path.nil? or path.to_s.match(/\/#{form_path}\//i))
|
92
|
-
end
|
93
|
-
p "Form file #{form_file} not found!"
|
94
|
-
nil
|
95
|
-
end
|
96
|
-
|
97
74
|
########################################################################
|
98
75
|
# Find document by ids when document are embedded into main d even if embedded
|
99
76
|
#
|
@@ -105,9 +82,9 @@ end
|
|
105
82
|
def self.find_document_by_ids(tables, ids)
|
106
83
|
collection = tables.split(';').first.classify.constantize
|
107
84
|
ar_ids = ids.split(';')
|
108
|
-
# Find top document
|
85
|
+
# Find top document
|
109
86
|
document = collection.find(ar_ids.shift)
|
110
|
-
# Search for embedded document
|
87
|
+
# Search for embedded document
|
111
88
|
ar_ids.each {|id| document = document.dc_json_lds.find(id) }
|
112
89
|
document
|
113
90
|
end
|
@@ -116,7 +93,7 @@ end
|
|
116
93
|
# Returns possible options for type select field on form.
|
117
94
|
#########################################################################
|
118
95
|
def self.choices4_type()
|
119
|
-
yaml = YAML.load_file(
|
96
|
+
yaml = YAML.load_file( CmsHelper.form_file_find('json_ld_schema') )
|
120
97
|
|
121
98
|
yaml.inject([]) {|result, schema_name| result << schema_name.first }
|
122
99
|
end
|
@@ -125,7 +102,7 @@ end
|
|
125
102
|
# Create menu to add schema element. Called from DRGCMS Form action.
|
126
103
|
#########################################################################
|
127
104
|
def self.add_schema_menu(parent)
|
128
|
-
yaml = YAML.load_file(
|
105
|
+
yaml = YAML.load_file( CmsHelper.form_file_find('json_ld_schema') )
|
129
106
|
if (level = parent.params['ids'].split(';').size) == 1
|
130
107
|
# select only top level elements
|
131
108
|
yaml.delete_if { |schema_name, schema_data| schema_data['level'].nil? }
|
@@ -139,7 +116,7 @@ def self.add_schema_menu(parent)
|
|
139
116
|
end
|
140
117
|
yaml = _yaml
|
141
118
|
end
|
142
|
-
# create menu code
|
119
|
+
# create menu code
|
143
120
|
html = '<ul>'
|
144
121
|
yaml.each do |schema_name, schema_data|
|
145
122
|
next if level == 1 and schema_data['level'].nil?
|
@@ -149,4 +126,4 @@ def self.add_schema_menu(parent)
|
|
149
126
|
html << '</ul>'
|
150
127
|
end
|
151
128
|
|
152
|
-
end
|
129
|
+
end
|
@@ -66,30 +66,28 @@ class DatePicker < DrgcmsField
|
|
66
66
|
###########################################################################
|
67
67
|
def render
|
68
68
|
value = @record.try(@yaml['name']) ? I18n.localize(@record[@yaml['name']].to_date) : nil
|
69
|
-
#return ro_standard( @parent.dc_format_value(value)) if @readonly
|
70
|
-
|
71
|
-
@yaml['options'] ||= {}
|
72
69
|
set_initial_value
|
73
70
|
@yaml['html']['size'] ||= @yaml['size'] || 10
|
74
71
|
@yaml['html']['value'] ||= value
|
75
72
|
@yaml['html']['autocomplete'] ||= 'off'
|
76
73
|
@yaml['html']['class'] = @yaml['html']['class'].to_s + ' date-picker'
|
77
74
|
|
78
|
-
@yaml['options']
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
options = options_to_hash(@yaml['options'])
|
76
|
+
options['lang'] ||= I18n.locale.to_s
|
77
|
+
options['format'] ||= t('datetimepicker.formats.date')
|
78
|
+
options['timepicker'] = false
|
79
|
+
options['scrollMonth'] ||= false
|
80
|
+
options['scrollInput'] ||= false
|
83
81
|
|
84
82
|
record = record_text_for(@yaml['name'])
|
85
83
|
@html << @parent.text_field(record, @yaml['name'], @yaml['html'])
|
86
|
-
@js << %
|
84
|
+
@js << %(
|
87
85
|
$(document).ready(function() {
|
88
|
-
$("##{record}_#{@yaml['name']}").datetimepicker(
|
89
|
-
#{hash_to_options(
|
86
|
+
$("##{record}_#{@yaml['name']}").datetimepicker({
|
87
|
+
#{hash_to_options(options)}
|
90
88
|
});
|
91
89
|
});
|
92
|
-
|
90
|
+
) unless @readonly
|
93
91
|
|
94
92
|
self
|
95
93
|
end
|
@@ -30,12 +30,12 @@ module DrgcmsFormFields
|
|
30
30
|
# * +name:+ Field name (required)
|
31
31
|
# * +options:+ options which apply to date_picker field. All options can be found here http://xdsoft.net/jqplugins/datetimepicker/ .
|
32
32
|
# Options can be defined in single line like:
|
33
|
-
# * options: 'step: 15,inline: true,lang:
|
33
|
+
# * options: 'step: 15,inline: true,lang: sl' or
|
34
34
|
#
|
35
35
|
# * options:
|
36
36
|
# * step: 15
|
37
37
|
# * inline: true
|
38
|
-
# * lang:
|
38
|
+
# * lang: sl
|
39
39
|
#
|
40
40
|
# * +html:+ html options which apply to date_time_picker field (optional)
|
41
41
|
#
|
@@ -52,27 +52,26 @@ class DatetimePicker < DrgcmsField
|
|
52
52
|
###########################################################################
|
53
53
|
def render
|
54
54
|
value = @record.try(@yaml['name']) ? I18n.localize(@record[@yaml['name']].localtime) : nil
|
55
|
-
#return ro_standard( @parent.dc_format_value(value)) if @readonly
|
56
|
-
|
57
|
-
@yaml['options'] ||= {}
|
58
55
|
set_initial_value
|
56
|
+
|
59
57
|
@yaml['html']['size'] ||= @yaml['size'] || 14
|
60
58
|
@yaml['html']['value'] ||= value if @record[@yaml['name']]
|
61
59
|
@yaml['html']['autocomplete'] ||= 'off'
|
62
60
|
@yaml['html']['class'] = @yaml['html']['class'].to_s + ' date-picker'
|
63
61
|
|
64
|
-
@yaml['options']
|
65
|
-
|
62
|
+
options = options_to_hash(@yaml['options'])
|
63
|
+
options['lang'] ||= I18n.locale.to_s
|
64
|
+
options['format'] ||= t('datetimepicker.formats.datetime')
|
66
65
|
|
67
66
|
record = record_text_for(@yaml['name'])
|
68
67
|
@html << @parent.text_field(record, @yaml['name'], @yaml['html'])
|
69
|
-
@js << %
|
68
|
+
@js << %(
|
70
69
|
$(document).ready(function() {
|
71
|
-
$("##{record}_#{@yaml['name']}").datetimepicker(
|
72
|
-
#{hash_to_options(
|
70
|
+
$("##{record}_#{@yaml['name']}").datetimepicker({
|
71
|
+
#{hash_to_options(options)}
|
73
72
|
});
|
74
73
|
});
|
75
|
-
|
74
|
+
) unless @readonly
|
76
75
|
|
77
76
|
self
|
78
77
|
end
|
@@ -250,16 +250,58 @@ end
|
|
250
250
|
# options:
|
251
251
|
# height: 400
|
252
252
|
# width: 800
|
253
|
-
# toolbar: "
|
253
|
+
# toolbar: "basic"
|
254
254
|
#
|
255
|
-
# => "height:400, width:800, toolbar:'basic'"
|
255
|
+
# => "height:400, width:800, toolbar: 'basic'"
|
256
256
|
#
|
257
257
|
# Return:
|
258
258
|
# String: Options formated as javascript options.
|
259
259
|
#
|
260
260
|
####################################################################
|
261
|
-
def hash_to_options(
|
262
|
-
|
261
|
+
def hash_to_options(options)
|
262
|
+
c = ''
|
263
|
+
options.each do |key, option|
|
264
|
+
c << "#{key} : "
|
265
|
+
c << case
|
266
|
+
when option.to_s.match(/function/i) then option
|
267
|
+
when option.class == String then "\"#{option}\""
|
268
|
+
else option.to_s
|
269
|
+
end
|
270
|
+
c << ",\n"
|
271
|
+
end
|
272
|
+
c
|
273
|
+
end
|
274
|
+
|
275
|
+
####################################################################
|
276
|
+
# Options may be defined on form as hash or as string. This method will
|
277
|
+
# ensure conversion of options into hash.
|
278
|
+
#
|
279
|
+
# Parameters:
|
280
|
+
# [String or Hash] : Form options
|
281
|
+
#
|
282
|
+
# Form example: As used in forms
|
283
|
+
# options:
|
284
|
+
# height: 400
|
285
|
+
# width: 800
|
286
|
+
# toolbar: "'basic'"
|
287
|
+
# or
|
288
|
+
#
|
289
|
+
# options: "height:400, width:800, toolbar:'basic'"
|
290
|
+
#
|
291
|
+
# Return:
|
292
|
+
# Hash: Options as Hash
|
293
|
+
####################################################################
|
294
|
+
def options_to_hash(options)
|
295
|
+
return {} if options.nil?
|
296
|
+
return options unless options.class == String
|
297
|
+
|
298
|
+
options.chomp.split(',').inject({}) do |r, e|
|
299
|
+
key, value = e.chomp.split(':')
|
300
|
+
value.strip!
|
301
|
+
value = value[1..value.size - 2] if value[0] =~ /\'|\"/
|
302
|
+
r[key.strip] = value
|
303
|
+
r
|
304
|
+
end
|
263
305
|
end
|
264
306
|
|
265
307
|
####################################################################
|
@@ -56,7 +56,7 @@ def render
|
|
56
56
|
@record[@yaml['name']] = @yaml['html']['value'] if @yaml['html']['value']
|
57
57
|
|
58
58
|
@html << @parent.hidden_field('record', @yaml['name']) # retain field as hidden field
|
59
|
-
@html <<
|
59
|
+
@html << %(<div class="dc-readonly" id="record_#{@yaml['name']}_">)
|
60
60
|
|
61
61
|
@html << if @yaml['eval']
|
62
62
|
if @yaml['eval'].match(/dc_name4_id|dc_name_for_id/)
|
@@ -146,8 +146,8 @@ def add_view_code
|
|
146
146
|
|
147
147
|
table, form_name = @yaml['view'].split(/\ |\,/).delete_if { |e| e.blank? }
|
148
148
|
url = @parent.url_for(controller: 'cmsedit', id: data, action: :edit, table: table, form_name: form_name, readonly: true, window_close: 1 )
|
149
|
-
icon = @parent.
|
150
|
-
%(<span class="dc-window-open" data-url="#{url}"
|
149
|
+
icon = @parent.mi_icon('eye-o md-18')
|
150
|
+
%(<span class="dc-window-open" data-url="#{url}"> #{icon}</span>)
|
151
151
|
end
|
152
152
|
|
153
153
|
###########################################################################
|
@@ -114,7 +114,7 @@ def render
|
|
114
114
|
style: "vertical-align: top;", 'data-table' => @yaml['with_new'] )
|
115
115
|
end
|
116
116
|
# with edit icon
|
117
|
-
if @yaml['with_edit'] && @record[@yaml['name']].present?
|
117
|
+
if @yaml['with_edit'] && @record && @record[@yaml['name']].present?
|
118
118
|
@html << ' ' + @parent.fa_icon('edit-o', class: 'in-edit-add', title: t('drgcms.edit'),
|
119
119
|
style: "vertical-align: top;", 'data-table' => @yaml['with_edit'], 'data-id' => @record[@yaml['name']] )
|
120
120
|
end
|
@@ -148,7 +148,7 @@ $(document).ready(function() {
|
|
148
148
|
change: function (event, ui) {
|
149
149
|
#{not_id_code}
|
150
150
|
if (ui.item == null) return;
|
151
|
-
$("##{record}_#{@yaml['name']}").val(ui.item.id);
|
151
|
+
$("##{record}_#{@yaml['name']}").val(ui.item.id).trigger('change');
|
152
152
|
},
|
153
153
|
|
154
154
|
minLength: 2
|
@@ -83,6 +83,7 @@ $(document).ready(function() {
|
|
83
83
|
$('##{@yaml['name']}_').change( function() {
|
84
84
|
if ($(this).val().toString().length > 0) {
|
85
85
|
$('##{record}_#{@yaml['name']}').val( $(this).val() );
|
86
|
+
$('##{record}_#{@yaml['name']}').trigger("change");
|
86
87
|
}
|
87
88
|
$('##{record}_#{@yaml['name']}').focus();
|
88
89
|
});
|
@@ -59,6 +59,7 @@ class TreeSelect < Select
|
|
59
59
|
###########################################################################
|
60
60
|
def make_tree(parent)
|
61
61
|
return '' unless @choices[parent.to_s]
|
62
|
+
|
62
63
|
@html << '<ul>'
|
63
64
|
choices = if @choices[parent.to_s].first[3] != 0
|
64
65
|
@choices[parent.to_s].sort_by {|e| e[3].to_i } # sort by order if first is not 0
|
@@ -66,16 +67,16 @@ def make_tree(parent)
|
|
66
67
|
@choices[parent.to_s].sort_alphabetical_by(&:first) # use UTF-8 sort
|
67
68
|
end
|
68
69
|
choices.each do |choice|
|
69
|
-
data = [ %
|
70
|
+
data = [ %("selected" : #{choice.last ? 'true' : 'false'} ) ]
|
70
71
|
# only for parent objects
|
71
72
|
if @choices[ choice[1].to_s ]
|
72
|
-
|
73
|
+
# parent is not selectable
|
73
74
|
data << '"disabled" : true' unless @parent.dc_dont?(@yaml['parent_disabled'], true)
|
74
|
-
|
75
|
+
# parents are opened on start
|
75
76
|
data << '"opened" : true' unless @parent.dc_dont?(@yaml['parent_opened'], true)
|
76
77
|
end
|
77
78
|
# data-jstree must be singe quoted
|
78
|
-
@html << %
|
79
|
+
@html << %(<li data-id="#{choice[1]}" data-jstree='{#{data.join(' , ')}}'>#{choice.first}\n)
|
79
80
|
# call recursively for children
|
80
81
|
make_tree(choice[1]) if @choices[ choice[1].to_s ]
|
81
82
|
@html << "</li>"
|
@@ -87,25 +88,24 @@ end
|
|
87
88
|
# Render tree_select field html code
|
88
89
|
###########################################################################
|
89
90
|
def render
|
90
|
-
#return ro_standard if @readonly
|
91
91
|
set_initial_value('html','value')
|
92
92
|
require 'sort_alphabetical'
|
93
93
|
|
94
94
|
record = record_text_for(@yaml['name'])
|
95
95
|
clas = 'tree-select' + (@readonly ? ' dc-readonly' : '')
|
96
96
|
@html << "<div id=\"#{@yaml['name']}\" class=\"#{clas}\" #{set_style()} >"
|
97
|
-
# Fill @choices hash. The key is parent object id
|
97
|
+
# Fill @choices hash. The key is parent object id
|
98
98
|
@choices = {}
|
99
99
|
choices_in_eval(@yaml['eval']).each do |data|
|
100
100
|
@choices[ data[2].to_s ] ||= []
|
101
101
|
@choices[ data[2].to_s ] << (data << false)
|
102
102
|
end
|
103
|
-
# put current values hash with. To speed up selection when there is a lot of categories
|
103
|
+
# put current values hash with. To speed up selection when there is a lot of categories
|
104
104
|
current_values = {}
|
105
105
|
current = @record[@yaml['name']] || []
|
106
106
|
current = [current] unless current.class == Array # non array fields
|
107
|
-
current.each {|e| current_values[e.to_s] = true}
|
108
|
-
# set third element of @choices when selected
|
107
|
+
current.each { |e| current_values[e.to_s] = true }
|
108
|
+
# set third element of @choices when selected
|
109
109
|
@choices.keys.each do |key|
|
110
110
|
0.upto( @choices[key].size - 1 ) do |i|
|
111
111
|
choice = @choices[key][i]
|
@@ -114,16 +114,16 @@ def render
|
|
114
114
|
end
|
115
115
|
make_tree(nil)
|
116
116
|
@html << '</div>'
|
117
|
-
# add hidden communication field
|
117
|
+
# add hidden communication field
|
118
118
|
@html << @parent.hidden_field(record, @yaml['name'], value: current.join(','))
|
119
|
-
# save multiple indicator for data processing on return
|
119
|
+
# save multiple indicator for data processing on return
|
120
120
|
@html << @parent.hidden_field(record, "#{@yaml['name']}_multiple", value: 1) if @yaml['multiple']
|
121
|
-
# javascript to update hidden record field when tree looses focus
|
122
|
-
readonly_code = %
|
121
|
+
# javascript to update hidden record field when tree looses focus
|
122
|
+
readonly_code = %(
|
123
123
|
,
|
124
124
|
"conditionalselect" : function (node) {
|
125
125
|
return false; }
|
126
|
-
|
126
|
+
)
|
127
127
|
|
128
128
|
@js =<<EOJS
|
129
129
|
$(function(){
|
@@ -131,7 +131,7 @@ $(function(){
|
|
131
131
|
"checkbox" : {"three_state" : false},
|
132
132
|
"core" : { "themes" : { "icons": false },
|
133
133
|
"multiple" : #{@yaml['multiple'] ? 'true' : 'false'} },
|
134
|
-
"plugins" : ["checkbox","conditionalselect"]
|
134
|
+
"plugins" : ["checkbox", "conditionalselect"]
|
135
135
|
#{@readonly ? readonly_code : ''}
|
136
136
|
});
|
137
137
|
});
|
@@ -155,13 +155,14 @@ end
|
|
155
155
|
###########################################################################
|
156
156
|
def self.get_data(params, name)
|
157
157
|
return nil if params['record'][name].blank?
|
158
|
-
|
158
|
+
|
159
159
|
result = params['record'][name].split(',')
|
160
|
-
result.delete_if
|
160
|
+
result.delete_if(&:blank?)
|
161
161
|
return nil if result.size == 0
|
162
|
-
|
162
|
+
|
163
|
+
# convert to BSON objects if is BSON object ID
|
163
164
|
result = result.map{ |e| BSON::ObjectId.from_string(e) } if BSON::ObjectId.legal?(result.first)
|
164
|
-
# return only first element if multiple values select was not
|
165
|
+
# return only first element if multiple values select was not allowed
|
165
166
|
params['record']["#{name}_multiple"] == '1' ? result : result.first
|
166
167
|
end
|
167
168
|
|
@@ -68,9 +68,10 @@ end
|
|
68
68
|
# dc_render(:dc_common_renderer, method: 'google_analytics', code: 'UA-12345678-9')
|
69
69
|
########################################################################
|
70
70
|
def google_analytics
|
71
|
+
html = ''
|
71
72
|
ga_acc = @opts[:code] || @opts[:ga_acc]
|
72
|
-
|
73
|
-
|
73
|
+
if ga_acc && ga_acc != '/'
|
74
|
+
html << %(
|
74
75
|
<!-- Google analytics. -->
|
75
76
|
<script type="text/javascript">
|
76
77
|
(function(i,s,o,g,r,a,m){
|
@@ -86,7 +87,23 @@ def google_analytics
|
|
86
87
|
ga('send', 'pageview')
|
87
88
|
}
|
88
89
|
</script>
|
89
|
-
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
93
|
+
ga4_acc = @opts[:code4] || @opts[:ga4_acc]
|
94
|
+
if ga4_acc && ga4_acc != '/'
|
95
|
+
html << %(
|
96
|
+
<!-- Global site tag (gtag.js) - Google Analytics -->
|
97
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=#{ga4_acc}"></script>
|
98
|
+
<script>
|
99
|
+
window.dataLayer = window.dataLayer || [];
|
100
|
+
function gtag(){dataLayer.push(arguments);}
|
101
|
+
gtag('js', new Date());
|
102
|
+
|
103
|
+
gtag('config', '#{ga4_acc}');
|
104
|
+
</script>)
|
105
|
+
end
|
106
|
+
|
90
107
|
html.html_safe
|
91
108
|
end
|
92
109
|
|
@@ -1,17 +1,24 @@
|
|
1
|
+
<div id="dc-form-container">
|
2
|
+
<div id="dc-form-left">
|
3
|
+
<%= dc_form_left %>
|
4
|
+
</div>
|
1
5
|
|
2
|
-
|
3
|
-
<%=
|
4
|
-
<%=
|
6
|
+
<div id="dc-form-right">
|
7
|
+
<%= dc_flash_messages %>
|
8
|
+
<%= dc_error_messages_for @record %>
|
9
|
+
<%= dc_warning_messages_for @record %>
|
5
10
|
|
6
|
-
<div class="dc-form-frame">
|
11
|
+
<div class="dc-form-frame">
|
12
|
+
<% fields = dc_fields_for_form %>
|
13
|
+
<%= dc_actions_for_form 'top' %>
|
7
14
|
|
8
|
-
|
9
|
-
|
10
|
-
<%= dc_fields_for_form %>
|
11
|
-
<%= dc_document_statistics %>
|
15
|
+
<%= fields %>
|
16
|
+
<%= dc_document_statistics %>
|
12
17
|
|
13
|
-
|
14
|
-
</div>
|
18
|
+
<%= dc_actions_for_form 'bottom' %>
|
19
|
+
</div>
|
15
20
|
|
16
|
-
<%= javascript_tag(@js) unless @js.blank? %>
|
17
|
-
<% unless @css.blank? %><style
|
21
|
+
<%= javascript_tag(@js) unless @js.blank? %>
|
22
|
+
<% unless @css.blank? %><style><%= @css %></style><% end %>
|
23
|
+
</div>
|
24
|
+
</div>
|
@@ -1,9 +1,13 @@
|
|
1
|
-
|
2
|
-
<%= dc_table_title dc_edit_title() %>
|
1
|
+
<% dc_form_update %>
|
3
2
|
|
4
|
-
<%=
|
5
|
-
|
6
|
-
<%=
|
7
|
-
|
3
|
+
<div <%= dc_form_id %>>
|
4
|
+
<%= dc_head_for_form %>
|
5
|
+
<%= dc_table_title dc_edit_title() %>
|
6
|
+
|
7
|
+
<%= form_tag( @form_params, method: :put, id: CmsHelper.form_param(params) || CmsHelper.table_param(params),
|
8
|
+
class: 'cmsform', multipart: @form['form']['multipart'], window_close: params[:window_close] ) do %>
|
9
|
+
<%= render partial: 'form' %>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
8
12
|
|
9
13
|
<div id="popup" style="display: none;"></div>
|
@@ -1,12 +1,14 @@
|
|
1
|
-
|
1
|
+
<% dc_form_update %>
|
2
|
+
|
3
|
+
<div <%= dc_form_id %> class="dc-form-frame">
|
2
4
|
<%= dc_title_for_index @records %>
|
3
5
|
|
4
6
|
<%= dc_actions_for_index %>
|
5
7
|
<%= dc_div_filter %>
|
6
8
|
<%= dc_flash_messages %>
|
7
|
-
<div id=
|
9
|
+
<div id="result"> <%= render partial: 'result' %></div>
|
8
10
|
</div>
|
9
11
|
|
10
12
|
<%= javascript_tag(@js) unless @js.blank? %>
|
11
|
-
<% unless @css.blank? %><style
|
13
|
+
<% unless @css.blank? %><style><%= @css %></style><% end %>
|
12
14
|
<div id="popup" style="display: none;"></div>
|
@@ -1,8 +1,12 @@
|
|
1
|
-
|
1
|
+
<% dc_form_update %>
|
2
2
|
|
3
|
-
<%=
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
<div <%= dc_form_id %>>
|
4
|
+
<%= dc_table_title dc_new_title %>
|
5
|
+
|
6
|
+
<%= form_tag(@form_params, method: :post, id: CmsHelper.form_param(params) || CmsHelper.table_param(params),
|
7
|
+
class: 'cmsform', multipart: @form['form']['multipart']) do %>
|
8
|
+
<%= render partial: 'form' %>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
7
11
|
|
8
12
|
<div id="popup" style="display: none;"></div>
|
@@ -8,6 +8,7 @@
|
|
8
8
|
<% if @commnets %>
|
9
9
|
<button onclick="location.href='#comments'; return false;"><%= t('drgcms.dc_help.comments_button') %></button>
|
10
10
|
<% end %>
|
11
|
+
<div style="float: right"><%= fa_icon('close', class: 'dc-link') %></div>
|
11
12
|
</div>
|
12
13
|
|
13
14
|
<div class="help-body"><%= dc_help_body if @help %></div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<title><%= @page_title %></title>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
6
|
<%= stylesheet_link_tag "application", media: 'all' %>
|
7
|
-
<style
|
7
|
+
<style media="all"><%= "#{@site.css if @site}#{@design.css if @design}\n#{@page.css if @page}".html_safe %></style>
|
8
8
|
<%= @site.header.html_safe %>
|
9
9
|
<%= javascript_include_tag "application" %>
|
10
10
|
<%= csrf_meta_tags %>
|
@@ -75,7 +75,11 @@ en:
|
|
75
75
|
filter: Filter
|
76
76
|
refresh: Refresh
|
77
77
|
back: Back
|
78
|
+
next: Next
|
79
|
+
finish: Finish
|
80
|
+
steps: Steps
|
78
81
|
close: Close
|
82
|
+
cancel: Cancel
|
79
83
|
delete: Delete
|
80
84
|
enable: Enable
|
81
85
|
disable: Disable
|
@@ -98,6 +102,7 @@ en:
|
|
98
102
|
updated_by: Updated by
|
99
103
|
created_at: Created at
|
100
104
|
updated_at: Updated at
|
105
|
+
active: Active
|
101
106
|
new_record: New record
|
102
107
|
|
103
108
|
filter_poll: Filter
|
@@ -108,6 +113,8 @@ en:
|
|
108
113
|
choices4_filter_operators: 'Equal to:eq,Contains:like,Greater then:gt,Less then:lt,Is empty:empty'
|
109
114
|
|
110
115
|
browse_collections: Browse all collections
|
116
|
+
category_has_subs: Category can't be deleted, because it contains sub-elements.
|
117
|
+
category_as_tree: Edit in treeview
|
111
118
|
|
112
119
|
dc_journal:
|
113
120
|
zero_selected: No data selected!
|
@@ -75,7 +75,11 @@ sl:
|
|
75
75
|
filter: Filter
|
76
76
|
refresh: Osveži
|
77
77
|
back: Nazaj
|
78
|
+
next: Naprej
|
79
|
+
steps: Koraki
|
80
|
+
finish: Zaključek
|
78
81
|
close: Zapri
|
82
|
+
cancel: Preklic
|
79
83
|
delete: Izbris
|
80
84
|
enable: Omogoči
|
81
85
|
disable: Onemogoči
|
@@ -98,6 +102,7 @@ sl:
|
|
98
102
|
updated_by: Spremenil
|
99
103
|
created_at: Ustvarjeno
|
100
104
|
updated_at: Spremenjeno
|
105
|
+
active: Aktiven
|
101
106
|
new_record: Nov zapis
|
102
107
|
|
103
108
|
filter_poll: Filter
|
@@ -108,6 +113,8 @@ sl:
|
|
108
113
|
choices4_filter_operators: 'Je enak:eq,Vsebuje:like,Je večji od:gt,Je manjši od:lt,Je prazen:empty'
|
109
114
|
|
110
115
|
browse_collections: Brskanje po definicijah zbirk
|
116
|
+
category_has_subs: Kategorije ni mogoče izbrisati, ker vsebuje podrejene elemente.
|
117
|
+
category_as_tree: Uredi v drevesnem pogledu
|
111
118
|
|
112
119
|
dc_journal:
|
113
120
|
zero_selected: Ni izbranih podatkov!
|
data/drg_cms.gemspec
CHANGED
@@ -15,18 +15,18 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.summary = 'DRG: Rapid web application development tool and CMS for Ruby, Rails and MongoDB'
|
16
16
|
s.description = 'DRG, development tool for rapid building of in-house (Intranet, private cloud) applications as well as CMS for creating complex, data-entry intensive web sites.'
|
17
17
|
s.license = 'MIT'
|
18
|
-
s.files = Dir['{app,config,db,lib}/**/*'] + %w[MIT-LICENSE Rakefile README.md
|
18
|
+
s.files = Dir['{app,config,db,lib}/**/*'] + %w[MIT-LICENSE Rakefile README.md CHANGELOG.md drg_cms.gemspec]
|
19
19
|
s.test_files = Dir['test/**/*']
|
20
20
|
|
21
21
|
s.required_ruby_version = '>= 2.7'
|
22
22
|
|
23
|
-
s.add_dependency 'rails'
|
23
|
+
s.add_dependency 'rails'#, '~> 6.1'
|
24
24
|
s.add_dependency 'jquery-rails'
|
25
25
|
s.add_dependency 'jquery-ui-rails'
|
26
26
|
s.add_dependency 'non-stupid-digest-assets'
|
27
27
|
|
28
28
|
s.add_dependency 'bcrypt' #, '~> 3.0.0'
|
29
|
-
s.add_dependency 'mongoid'
|
29
|
+
s.add_dependency 'mongoid'#, '~> 7'
|
30
30
|
|
31
31
|
s.add_dependency 'kaminari-mongoid'
|
32
32
|
s.add_dependency 'kaminari-actionview'
|