drg_cms 0.6.0.8 → 0.6.1.0

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/drg_cms/drg_cms.js +100 -58
  3. data/app/assets/stylesheets/drg_cms/drg_cms.css +177 -43
  4. data/app/controllers/cmsedit_controller.rb +149 -145
  5. data/app/controllers/dc_application_controller.rb +235 -113
  6. data/app/controllers/dc_common_controller.rb +32 -3
  7. data/app/controls/dc_help_control.rb +126 -0
  8. data/app/controls/dc_report.rb +5 -7
  9. data/app/forms/all_options.yml +10 -4
  10. data/app/forms/cms_menu.yml +7 -1
  11. data/app/forms/dc_category.yml +2 -1
  12. data/app/forms/dc_design.yml +1 -0
  13. data/app/forms/dc_help_1.yml +109 -0
  14. data/app/forms/dc_journal.yml +3 -1
  15. data/app/forms/dc_link.yml +1 -1
  16. data/app/forms/dc_menu.yml +2 -0
  17. data/app/forms/dc_menu_item.yml +1 -0
  18. data/app/forms/dc_page.yml +2 -0
  19. data/app/forms/dc_part.yml +1 -0
  20. data/app/forms/dc_piece.yml +1 -0
  21. data/app/forms/dc_poll.yml +3 -0
  22. data/app/forms/dc_simple_menu.yml +2 -0
  23. data/app/forms/dc_site.yml +2 -6
  24. data/app/forms/dc_user.yml +27 -11
  25. data/app/forms/dc_user_role.yml +3 -0
  26. data/app/helpers/cms_common_helper.rb +69 -4
  27. data/app/helpers/cms_edit_helper.rb +32 -24
  28. data/app/helpers/cms_helper.rb +64 -26
  29. data/app/helpers/cms_index_helper.rb +84 -72
  30. data/app/helpers/dc_application_helper.rb +33 -24
  31. data/app/models/concerns/dc_page_concern.rb +11 -2
  32. data/app/models/concerns/dc_policy_rule_concern.rb +20 -8
  33. data/app/models/concerns/dc_site_concern.rb +56 -44
  34. data/app/models/concerns/dc_user_concern.rb +57 -18
  35. data/app/models/dc_design.rb +29 -19
  36. data/app/models/dc_key_value_store.rb +1 -0
  37. data/app/models/dc_permission.rb +19 -9
  38. data/app/models/dc_policy.rb +25 -14
  39. data/app/models/dc_policy_role.rb +22 -11
  40. data/app/models/dc_temp.rb +1 -1
  41. data/app/models/dc_user_role.rb +2 -2
  42. data/app/models/drgcms_form_fields/embedded.rb +5 -8
  43. data/app/models/drgcms_form_fields/file_field.rb +1 -1
  44. data/app/models/drgcms_form_fields/file_select.rb +2 -2
  45. data/app/models/drgcms_form_fields/hash_field.rb +11 -7
  46. data/app/models/drgcms_form_fields/link_to.rb +2 -2
  47. data/app/models/drgcms_form_fields/method.rb +5 -4
  48. data/app/models/drgcms_form_fields/multitext_autocomplete.rb +1 -1
  49. data/app/models/drgcms_form_fields/select.rb +10 -9
  50. data/app/models/drgcms_form_fields/text_autocomplete.rb +2 -2
  51. data/app/views/cmsedit/edit.html.erb +2 -0
  52. data/app/views/cmsedit/index.html.erb +2 -1
  53. data/app/views/cmsedit/new.html.erb +2 -0
  54. data/app/views/dc_common/_help.html.erb +8 -0
  55. data/app/views/layouts/models.html.erb +2 -1
  56. data/config/locales/drgcms_en.yml +12 -0
  57. data/config/locales/drgcms_sl.yml +15 -0
  58. data/config/locales/models_en.yml +5 -5
  59. data/config/locales/models_sl.yml +7 -6
  60. data/lib/drg_cms.rb +58 -0
  61. data/lib/drg_cms/version.rb +1 -1
  62. metadata +5 -3
  63. data/app/models/__dc_dummy.rb +0 -102
@@ -114,3 +114,18 @@ sl:
114
114
 
115
115
  filters:
116
116
  this_site_only: Dokumenti samo trenutno izbrane strani
117
+
118
+ dc_help:
119
+ help: POMOČ
120
+ title: Urejanje dokumentov pomoči
121
+ project: Projekt
122
+ lang: Jezik
123
+ project_refresh: Osveži
124
+ project_refresh_title: Osveži seznam že pripravljenih dokumentov
125
+ form_name: Forma
126
+ updated_at: Spremenjeno
127
+ 1basic: Osnovno
128
+ 2index: Index
129
+ 3form: Forma
130
+
131
+
@@ -94,7 +94,7 @@ en:
94
94
 
95
95
  dc_user:
96
96
  tabletitle: Users
97
- tab1: Base
97
+ 1base: Base
98
98
 
99
99
  id: Id
100
100
  username: Username
@@ -116,8 +116,8 @@ en:
116
116
  valid_from: Valid from
117
117
  valid_to: Valid to
118
118
  updated_by: Updated by
119
- type: Type
120
- members: Members
119
+ group: Is group
120
+ member: Member in groups
121
121
  dc_user_roles: Roles
122
122
  password: Password
123
123
  password_confirmation: Confirm password
@@ -620,8 +620,8 @@ en:
620
620
  valid_from: Account is valid from
621
621
  valid_to: Account is valid until
622
622
  updated_by: Account last updated by
623
- type: Type of user account
624
- members: Members (if type is group)
623
+ group: This is group account
624
+ member: User is member in selected groups
625
625
  dc_user_roles: Roles for this user
626
626
  password: Password
627
627
  password_confirmation: Password confirmation
@@ -86,19 +86,20 @@ sl:
86
86
 
87
87
  dc_user:
88
88
  tabletitle: Uporabniki
89
- tab1: Osnova
89
+ 1base: Osnova
90
90
 
91
91
  id: Id
92
92
  username: Uporabnik
93
93
  title: Titula
94
94
  first_name: Ime
95
+ middle_name: Srednje ime
95
96
  last_name: Priimek
96
97
  name: Naziv
97
98
  address: Naslov
98
99
  post: Pošta
99
100
  country: Država
100
101
  phone: Telefon
101
- email: e-Pošta
102
+ email: e-Naslov
102
103
  picture: Slika
103
104
  birthdate: Datum rojstva
104
105
  about: Več o
@@ -107,8 +108,8 @@ sl:
107
108
  valid_from: Velja od
108
109
  valid_to: Velja do
109
110
  updated_by: Spremenil
110
- type: Vrsta
111
- members: Člani
111
+ group: Je skupina
112
+ member: Član v skupinah
112
113
  dc_user_roles: Uporabniške vloge
113
114
  password: Geslo
114
115
  password_confirmation: Potrdi geslo
@@ -639,8 +640,8 @@ sl:
639
640
  valid_from: Začetni datum veljavnosti
640
641
  valid_to: Končni datum veljavnosti
641
642
  updated_by: Spremenil
642
- type: Vrsta uporabniškega računa
643
- members: Člani (če skupina uporabnikov)
643
+ group: Račun predstavlja uporabniško skupino
644
+ member: Seznam skupin za uporabnika
644
645
  dc_user_roles: Vloge, ki pripadajo temu uporabniku
645
646
  password: Geslo
646
647
  password_confirmation: Še enkrat vpišite geslo
data/lib/drg_cms.rb CHANGED
@@ -118,6 +118,63 @@ def self.from_root(file=nil)
118
118
  File.expand_path("../../#{file}", __FILE__).to_s
119
119
  end
120
120
 
121
+ ####################################################################
122
+ # Checks if any errors exist on document and writes error log. It can also
123
+ # crash if requested. This is mostly usefull in development for debuging
124
+ # model errors or when updating multiple collections and each save must be
125
+ # checked if succesfull.
126
+ #
127
+ # @param [Document] Document object which will be checked
128
+ # @param [Boolean] If true method should end in runtime error. Default = false.
129
+ #
130
+ # @return [String] Error messages or empty string if everything is OK.
131
+ #
132
+ # @Example Check for error when data is saved.
133
+ # model.save
134
+ # if (msg = DrgCms.model_check(model) ).size > 0
135
+ # p msg
136
+ # error process ......
137
+ # end
138
+ #
139
+ ####################################################################
140
+ def self.model_check(document, crash = false)
141
+ return nil unless document.errors.any?
142
+
143
+ msg = ""
144
+ document.errors.each do |attribute, errors_array|
145
+ msg << "#{attribute}: #{errors_array}\n"
146
+ end
147
+ #
148
+ if crash and msg.size > 0
149
+ msg = "Validation errors in #{document.class}:\n" + msg
150
+ pp msg
151
+ Rails.logger.error(msg)
152
+ raise "Validation error. See log for more information."
153
+ end
154
+ msg
155
+ end
156
+
157
+ ####################################################################
158
+ # Clear cache. If key is specified only this key will be deleted.
159
+ #
160
+ # @param [String] Optional key to be deleted
161
+ ####################################################################
162
+ def self.cache_clear(key = nil)
163
+ return Rails.cache.clear if key.nil?
164
+
165
+ if ((Rails.application.config.cache_store.first == :redis_cache_store) rescue false)
166
+ Rails.cache.redis.del(key)
167
+ else
168
+ Rails.cache.delete_matched("#{key}*")
169
+ end
170
+ end
171
+
172
+ def self.__cache_clear(key = nil)
173
+ return Rails.cache.clear if key.nil?
174
+
175
+ Rails.cache.delete_matched("#{key}*")
176
+ end
177
+
121
178
  ###############################################################################
122
179
  # All Routes required by DrgCms.
123
180
  #
@@ -138,6 +195,7 @@ def self.routes
138
195
  match 'dc_common/paste_clipboard' => :paste_clipboard, via: [:get, :post]
139
196
  put 'dc_common/restore_from_journal' => :restore_from_journal
140
197
  get 'dc_common/add_json_ld_schema' => :add_json_ld_schema
198
+ get 'dc_common/help' => :help
141
199
  end
142
200
  match 'elfinder' => 'dc_elfinder#connector', via: [:get, :post]
143
201
  match 'cmsedit/run' => 'cmsedit#run', via: [:get, :put, :post]
@@ -23,5 +23,5 @@
23
23
 
24
24
  # drg_cms gem version
25
25
  module DrgCms #:nodoc:
26
- VERSION = '0.6.0.8'.freeze
26
+ VERSION = '0.6.1.0'.freeze
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drg_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.8
4
+ version: 0.6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damjan Rems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-20 00:00:00.000000000 Z
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -210,6 +210,7 @@ files:
210
210
  - app/controllers/dc_common_controller.rb
211
211
  - app/controllers/dc_main_controller.rb
212
212
  - app/controls/browse_models_control.rb
213
+ - app/controls/dc_help_control.rb
213
214
  - app/controls/dc_page_control.rb
214
215
  - app/controls/dc_poll_result_control.rb
215
216
  - app/controls/dc_report.rb
@@ -228,6 +229,7 @@ files:
228
229
  - app/forms/dc_filter.yml
229
230
  - app/forms/dc_folder_permission.yml
230
231
  - app/forms/dc_gallery.yml
232
+ - app/forms/dc_help_1.yml
231
233
  - app/forms/dc_ident.yml
232
234
  - app/forms/dc_journal.yml
233
235
  - app/forms/dc_json_ld.yml
@@ -262,7 +264,6 @@ files:
262
264
  - app/helpers/cms_helper.rb
263
265
  - app/helpers/cms_index_helper.rb
264
266
  - app/helpers/dc_application_helper.rb
265
- - app/models/__dc_dummy.rb
266
267
  - app/models/concerns/dc_page_concern.rb
267
268
  - app/models/concerns/dc_piece_concern.rb
268
269
  - app/models/concerns/dc_policy_rule_concern.rb
@@ -361,6 +362,7 @@ files:
361
362
  - app/views/cmsedit/index.html.erb
362
363
  - app/views/cmsedit/login.html.erb
363
364
  - app/views/cmsedit/new.html.erb
365
+ - app/views/dc_common/_help.html.erb
364
366
  - app/views/dc_common/_iframe_edit.html.erb
365
367
  - app/views/dc_common/paste_clipboard.html.erb
366
368
  - app/views/layouts/__cmsedit.html.erb
@@ -1,102 +0,0 @@
1
- #--
2
- # Copyright (c) 2012+ 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
- # == Schema information
26
- #
27
- # Collection name: dc_dummy : Collection name used when form does not belong to database model.
28
- #
29
- # _id BSON::ObjectId _id
30
- #
31
- # Which is not collection at all. DcDummy model is used for entering data on forms
32
- # where data will not be saved to database but will instead be processed by custom
33
- # made routine. For example entering begin and end date on report.
34
- #
35
- # Example (as used in forms):
36
- #
37
- # table: dc_dummy
38
- # title: Enter time period
39
- #
40
- # form:
41
- # actions:
42
- # 1:
43
- # type: ajax
44
- # method: post
45
- # controller: reports
46
- # action: do_some_report
47
- # caption: Run report
48
- #
49
- # fields:
50
- # 10:
51
- # name: date_start
52
- # type: date_picker
53
- # caption: Start date
54
- # 20:
55
- # name: date_end
56
- # type: date_picker
57
- # caption: End date
58
- #
59
- # And suppose your report saved data to file named public/report.pdf.
60
- # Put this line at the end of do_some_report method:
61
- #
62
- # render inline: { :window_report => '/report.pdf' }.to_json, formats: 'js'
63
- #
64
- # As result report.pdf file will be opened in new browser window.
65
- ########################################################################
66
- class DcDummy
67
- include Mongoid::Document
68
-
69
- ########################################################################
70
- # Respond_to should always return true.
71
- ########################################################################
72
- def respond_to?(m)
73
- true
74
- end
75
-
76
- ########################################################################
77
- # Redefine send method. Send is used to assign value by cmsedit controller.
78
- ########################################################################
79
- def send(field,value=nil)
80
- if field.to_s.match('=')
81
- field.chomp!('=')
82
- @internals ||= {}
83
- @internals[field] = value
84
- end
85
- end
86
-
87
- ########################################################################
88
- # Method missing will return value if value defined by m parameter is saved to
89
- # @internals array or will assign new value to @internals hash if m matches '='.
90
- ########################################################################
91
- def method_missing(m, *args, &block) #:nodoc:
92
- @internals ||= {}
93
- m = m.to_s
94
- if m.match('=')
95
- m.chomp!('=')
96
- @internals[m] = args.first
97
- else
98
- @internals[m]
99
- end
100
- end
101
-
102
- end