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
data/lib/drg_cms/version.rb
CHANGED
data/lib/tasks/dc_cleanup.rake
CHANGED
@@ -36,30 +36,29 @@ namespace :drg_cms do
|
|
36
36
|
task :clear_sessions, [:name] => :environment do |t, args|
|
37
37
|
p 'This is just an example how to clear sessions collection. It wont do anything because of next line.'
|
38
38
|
return if true
|
39
|
-
# This should remove all sessions documents created by robots
|
40
|
-
# It is quite a task to compare two dates in mongoid. This should not be problem if it is run daily
|
39
|
+
# This should remove all sessions documents created by robots
|
40
|
+
# It is quite a task to compare two dates in mongoid. This should not be problem if it is run daily
|
41
41
|
ActionDispatch::Session::MongoidStore::Session.all.each do |doc|
|
42
|
-
doc.delete if (doc.created_at == doc.updated_at
|
42
|
+
doc.delete if (doc.created_at == doc.updated_at || doc.updated_at < 100.days.ago)
|
43
43
|
end
|
44
|
-
# or if you want to clear everything older than 1 week
|
44
|
+
# or if you want to clear everything older than 1 week
|
45
45
|
ActionDispatch::Session::MongoidStore::Session.where(:updated_at.lt => 1.week.ago).delete
|
46
|
-
DcSite.collection.database.command(
|
46
|
+
DcSite.collection.database.command(compact: 'sessions')
|
47
47
|
end
|
48
48
|
|
49
49
|
###########################################################################
|
50
50
|
desc 'Clears mongodb session documents created by web robots'
|
51
51
|
task :clear_sessions_from_robots, [:name] => :environment do |t, args|
|
52
|
-
# This should remove all sessions documents created by web robots
|
53
|
-
# ActionDispatch::Session::MongoidStore::Session.where('$where' => 'this.created_at == this.updated_at').limit(1000).each do |doc|
|
52
|
+
# This should remove all sessions documents created by web robots
|
54
53
|
n = 0
|
55
54
|
ActionDispatch::Session::MongoidStore::Session.batch_size(1000).all.each do |doc|
|
56
|
-
if (doc.created_at + 2 > doc.updated_at
|
55
|
+
if (doc.created_at + 2 > doc.updated_at || doc.updated_at < 1.year.ago)
|
57
56
|
doc.delete
|
58
|
-
p "Deleted #{n}" if (n+=1)%1000 == 0
|
57
|
+
p "Deleted #{n}" if (n += 1) % 1000 == 0
|
59
58
|
end
|
60
59
|
end
|
61
60
|
p "Deleted #{n}"
|
62
|
-
DcSite.collection.database.command(
|
61
|
+
DcSite.collection.database.command(compact: 'sessions')
|
63
62
|
end
|
64
63
|
|
65
64
|
###########################################################################
|
@@ -72,16 +71,14 @@ namespace :drg_cms do
|
|
72
71
|
return (p "#{archive_file} exists") if File.exist?(archive_file)
|
73
72
|
|
74
73
|
date_to = Time.local(date[0,4].to_i, date[4,2].to_i, date[6,2].to_i).beginning_of_day
|
75
|
-
n = 0
|
76
|
-
save = ''
|
74
|
+
n, save = 0, ''
|
77
75
|
DcVisit.where(:time.lt => date_to).each do |visit|
|
78
76
|
save << visit.to_json + "\n"
|
79
|
-
#
|
80
|
-
p "Deleted #{n}" if (n+=1)%10000 == 0
|
77
|
+
p "Deleted #{n}" if (n += 1) % 10000 == 0
|
81
78
|
end
|
82
79
|
DcVisit.where(:time.lt => date_to).delete
|
83
|
-
File.
|
84
|
-
DcSite.collection.database.command(
|
80
|
+
File.write(archive_file, save)
|
81
|
+
DcSite.collection.database.command(compact: 'dc_visits')
|
85
82
|
end
|
86
83
|
|
87
84
|
###########################################################################
|
@@ -90,39 +87,20 @@ namespace :drg_cms do
|
|
90
87
|
input = read_input("Just press Enter to start. If you type in anything process won't start.")
|
91
88
|
return unless input.to_s.size == 0
|
92
89
|
today = Time.now.beginning_of_day
|
93
|
-
n = 0
|
94
|
-
save_stat, save_ads = '', ''
|
90
|
+
n, save_stat, save_ads = 0, '', ''
|
95
91
|
DcAd.all.each do |ad|
|
96
|
-
if !ad.active
|
92
|
+
if !ad.active || (ad.valid_to && ad.valid_to < today)
|
97
93
|
save_ads << ad.to_json + "\n"
|
98
94
|
DcAdStat.where(:dc_ad_id => ad._id).each do |stat|
|
99
95
|
save_stat << stat.to_json + "\n"
|
100
|
-
p "Deleted #{n}" if (n+=1)%10000 == 0
|
96
|
+
p "Deleted #{n}" if (n += 1) % 10000 == 0
|
101
97
|
end
|
102
98
|
DcAdStat.where(:dc_ad_id => ad._id).delete
|
103
99
|
end
|
104
100
|
end
|
105
|
-
File.
|
106
|
-
File.
|
107
|
-
DcSite.collection.database.command(
|
101
|
+
File.write("ads_stat_#{Time.now.strftime('%Y%d%m')}.json", save_stat)
|
102
|
+
File.write("ads_#{Time.now.strftime('%Y%d%m')}.json", save_ads)
|
103
|
+
DcSite.collection.database.command(compact: 'dc_ad_stats')
|
108
104
|
end
|
109
|
-
|
110
|
-
=begin
|
111
|
-
###########################################################################
|
112
|
-
desc "Correct error when ad_id ield is used instead of dc_ad_id."
|
113
|
-
task :repair_ad_stats, [:name] => :environment do |t, args|
|
114
|
-
input = read_input("Just press Enter to start. If you type in anything process won't start.")
|
115
|
-
return unless input.to_s.size == 0
|
116
|
-
n = 0
|
117
|
-
p DcAdStat.only(:id).where(:dc_ad_id => nil).to_a.size
|
118
|
-
DcAdStat.where(:dc_ad_id => nil).each do |stat|
|
119
|
-
stat.dc_ad_id = stat.ad_id
|
120
|
-
stat.ad_id = nil
|
121
|
-
stat.save
|
122
|
-
|
123
|
-
p n if (n+=1)%1000 == 0
|
124
|
-
end
|
125
|
-
end
|
126
|
-
=end
|
127
|
-
|
105
|
+
|
128
106
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jquery-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: mongoid
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: kaminari-mongoid
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,7 +159,7 @@ executables: []
|
|
159
159
|
extensions: []
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
|
-
-
|
162
|
+
- CHANGELOG.md
|
163
163
|
- MIT-LICENSE
|
164
164
|
- README.md
|
165
165
|
- Rakefile
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- app/controllers/dc_main_controller.rb
|
218
218
|
- app/controls/browse_models_control.rb
|
219
219
|
- app/controls/cmsedit_control.rb
|
220
|
+
- app/controls/dc_category_control.rb
|
220
221
|
- app/controls/dc_help_control.rb
|
221
222
|
- app/controls/dc_page_control.rb
|
222
223
|
- app/controls/dc_poll_result_control.rb
|
@@ -232,6 +233,7 @@ files:
|
|
232
233
|
- app/forms/dc_browse_fields.yml
|
233
234
|
- app/forms/dc_browse_models.yml
|
234
235
|
- app/forms/dc_category.yml
|
236
|
+
- app/forms/dc_category_as_tree.yml
|
235
237
|
- app/forms/dc_design.yml
|
236
238
|
- app/forms/dc_filter.yml
|
237
239
|
- app/forms/dc_folder_permission.yml
|
@@ -262,15 +264,19 @@ files:
|
|
262
264
|
- app/forms/dc_simple_menu.yml
|
263
265
|
- app/forms/dc_simple_menu_item.yml
|
264
266
|
- app/forms/dc_site.yml
|
267
|
+
- app/forms/dc_steps_template.yml
|
265
268
|
- app/forms/dc_user.yml
|
266
269
|
- app/forms/dc_user_role.yml
|
267
270
|
- app/forms/drgcms_cms.yml
|
271
|
+
- app/forms/help/dc_category_as_tree.en
|
272
|
+
- app/forms/help/dc_category_as_tree.sl
|
268
273
|
- app/forms/json_ld_schema.yml
|
269
274
|
- app/helpers/cms_common_helper.rb
|
270
275
|
- app/helpers/cms_edit_helper.rb
|
271
276
|
- app/helpers/cms_helper.rb
|
272
277
|
- app/helpers/cms_index_helper.rb
|
273
278
|
- app/helpers/dc_application_helper.rb
|
279
|
+
- app/helpers/dc_category_helper.rb
|
274
280
|
- app/models/concerns/dc_page_concern.rb
|
275
281
|
- app/models/concerns/dc_piece_concern.rb
|
276
282
|
- app/models/concerns/dc_policy_rule_concern.rb
|
@@ -449,7 +455,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
449
455
|
- !ruby/object:Gem::Version
|
450
456
|
version: '0'
|
451
457
|
requirements: []
|
452
|
-
rubygems_version: 3.
|
458
|
+
rubygems_version: 3.3.15
|
453
459
|
signing_key:
|
454
460
|
specification_version: 4
|
455
461
|
summary: 'DRG: Rapid web application development tool and CMS for Ruby, Rails and
|
data/History.log
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
|
2
|
-
New features for DRG CMS version up to 0.5.51.1
|
3
|
-
Rails version 5.1 compatibility
|
4
|
-
Ruby version 2.3 is now required
|
5
|
-
select field with multiple can now properly process non BSON array values
|
6
|
-
DRG CMS Form readonly field with readonly : yes option will not be saved to database on save
|
7
|
-
dc_dummy collection will be deprecated and replaced with dc_memory collection. Name was chosen unfortunately
|
8
|
-
DrgForms can now be used for editing YAML settings saved in dc_page document. This enables editing dynamic settings of elements embedded in design
|
9
|
-
cms_edit url can now be used only as cms
|
10
|
-
|
11
|
-
Bugs resolved for DRG CMS version up to 0.5.51.1
|
12
|
-
journal is now able to undelete deleted document
|
13
|
-
|
14
|
-
New features for DRG CMS version up to 0.5.50.4
|
15
|
-
Rails 5.0 compatibility
|
16
|
-
category types can now be defined in dc_big_table under dc_category_type key
|
17
|
-
DrgCms gem routes can now be defined as DrgCms.routes
|
18
|
-
new field tree_select added to DRG CMS Forms. Tree select will be used as data entry field for categories instead of select field with multiple option
|
19
|
-
switch to Rails concern for main model definitions which may be reused.
|
20
|
-
site policy can be inherited from other site
|
21
|
-
menus can now belong to site
|
22
|
-
clear_link method is now a class method of DcPage model and can thus be called directly from other parts of application
|
23
|
-
|
24
|
-
Bugs resolved for DRG CMS version up to 0.5.50.4
|
25
|
-
journal is now able to undelete deleted document
|
26
|
-
|
27
|
-
|
28
|
-
New features for DRG CMS version 0.5.10.14
|
29
|
-
table_style added to result_set DRGCMS Forms option. This allows CSS style like width: 150% which will result in horizontal scroler on table and view more columns on result set.
|
30
|
-
result_set filter now has is empty option allowing to filter fields with null value.
|
31
|
-
filter OFF icon now displays currently active filter when hovered.
|
32
|
-
request_process field added to dc_site collection. It allowis for site to have different requests processing as defined in rails routes file. Single rails instance can now mix single document sites with complex sites.
|
33
|
-
multiple option is added to DRGCMS Forms select_field.
|
34
|
-
is_email? class method added to dc_user model.
|
35
|
-
form generator has now list of all model fields added at the end of generated form. Field names can be used as template in YAML translation file.
|
36
|
-
dc_choices4_field method implemented. It returns choices that are defined in localization files.
|
37
|
-
categories field changed from multitext_autocomplete to select field with multiple options.
|
38
|
-
a poll form can now be surrounded by div tag thus allowing for additional styling of polls
|
39
|
-
drgcms_controlls files can now also be defined only as control files.
|
40
|
-
journal documents can now be filtered by document id
|
41
|
-
CMS menu redesigned. Instead of pulldown menus are now displayed fixed on the left side of edit area
|
42
|
-
|
43
|
-
Bugs resolved for DRG CMS version 0.5.10.14
|
44
|
-
prevent double form submit when browser is restarted.
|
45
|
-
when user has no role defined guest role is automatically applied
|
46
|
-
dc_cleanup rake task deletes 1000 session documents created by robots at once instead of all which ended in error if number of documents was higher then 100.000
|
47
|
-
|
48
|
-
|
49
|
-
New features for DRG CMS version 0.5.10
|
50
|
-
|
51
|
-
jQuery javascript library forced to jQuery2
|
52
|
-
Choices for select fields are now UTF-8 sorted since MongoDB does not provide utf sorting.
|
53
|
-
Placeholder text added for text_autocomplete field. It can also be defined in form field html options.
|
54
|
-
Filters option can now have "like" keyword for fields that are not defined on form. For example created_by like user_id.
|
55
|
-
|
56
|
-
Bugs resolved for DRG CMS version 0.5.10
|
57
|
-
|
58
|
-
jQuery migrate udated to version 1.3. This was required by jquery-rails gem which included latest version of jQuery which resulted in an runtime error.
|
59
|
-
Call before_new callback only when new empty record has been created.
|
60
|
-
|
61
|
-
--
|
62
|
-
|
63
|
-
New features for DRG CMS version 0.5.9
|
64
|
-
|
65
|
-
Main CMS menu was becoming to large and was divided into two menus.
|
66
|
-
Result set browse filter data entry redesigned. Values can now be entered directly on actions area. Value of entered fied is also retained beetwen calls.
|
67
|
-
New DcInternals model introduced. It will be used for accessing internal variables.
|
68
|
-
DRG Forms has new option columns. Option defines number of columns per tab or fields. Field option also got colspan option indicating over how many columns field spans.
|
69
|
-
DRG Forms field size can now also be defined on same level as field type. Before it was defined in html sublevel.
|
70
|
-
|
71
|
-
Bugs resolved for DRG CMS version 0.5.9
|
72
|
-
|
73
|
-
Improved readonly display of select and text_autocomplete DRG Forms fields.
|
74
|
-
Text_autocomplete field is set to nil when content of field is deleted.
|
75
|
-
|
76
|
-
--
|
77
|
-
|
78
|
-
New features for DRG CMS version 0.5.8
|
79
|
-
|
80
|
-
Browsing array of hashes is now possible with DRG Forms
|
81
|
-
Simple browsing of all defined models and field definitions added to CMS System menu
|
82
|
-
new result_set options table_style, table_class, tr_style, tr_class, td_style, td_class. Welcome colors to result_set browser
|
83
|
-
result_set has been renewed for more modern design. Header elements have now sorting icons
|
84
|
-
dblclick and click actions can now be defined on result set and can fire any action when clicked or double clicked on result set row.
|
85
|
-
|
86
|
-
Bugs resolved for DRG CMS version 0.5.8
|
87
|
-
|
88
|
-
associated menu can now be selected on dc_page form also for non dc_simple_menu menus
|
89
|
-
|
90
|
-
--
|
91
|
-
|
92
|
-
New features for DRG CMS version 0.5.7
|
93
|
-
|
94
|
-
single site document. All data for the site can be saved to single dc_site document and processed by dc_single_sitedoc_request
|
95
|
-
site parts can now also be saved and collected from dc_site document
|
96
|
-
CMS menu done right
|
97
|
-
Page title is now set from dc_page_renderer default method
|
98
|
-
|
99
|
-
Bugs resolved for DRG CMS version 0.5.7
|
100
|
-
|
101
|
-
Corrected bug when multitext_autocomplete field was not displaying right values when displayed readonly
|
102
|
-
|
103
|
-
dc_choices4 now checks if model has active field defined and returns only choices of documents that have active field value set to true
|
104
|
-
|
105
|
-
Design and page edit icons are now displayed only when design or page documents are available
|
106
|
-
|
107
|
-
return_to from drgcms_control was not properly handled
|
108
|
-
|
109
|
-
Mouse cursor now changes to pointer when moved over ajax link
|