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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +260 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +9 -5
  5. data/app/assets/javascripts/drg_cms/drg_cms.js +69 -32
  6. data/app/assets/javascripts/drg_cms_application.js +0 -2
  7. data/app/assets/javascripts/drg_cms_cms.js +2 -3
  8. data/app/assets/stylesheets/drg_cms/drg_cms.css +89 -26
  9. data/app/assets/stylesheets/drg_cms/jstree.css +32 -27
  10. data/app/assets/stylesheets/drg_cms/select-multiple.css +4 -2
  11. data/app/controllers/cmsedit_controller.rb +9 -111
  12. data/app/controllers/dc_application_controller.rb +100 -23
  13. data/app/controllers/dc_common_controller.rb +10 -24
  14. data/app/controls/browse_models_control.rb +3 -1
  15. data/app/controls/cmsedit_control.rb +5 -1
  16. data/app/controls/dc_category_control.rb +61 -0
  17. data/app/controls/dc_report.rb +1 -1
  18. data/app/forms/all_options.yml +2 -0
  19. data/app/forms/cms_menu.yml +3 -2
  20. data/app/forms/dc_browse_models.yml +24 -2
  21. data/app/forms/dc_category.yml +17 -8
  22. data/app/forms/dc_category_as_tree.yml +31 -0
  23. data/app/forms/dc_steps_template.yml +51 -0
  24. data/app/forms/help/dc_category_as_tree.en +4 -0
  25. data/app/forms/help/dc_category_as_tree.sl +5 -0
  26. data/app/helpers/cms_common_helper.rb +66 -1
  27. data/app/helpers/cms_edit_helper.rb +230 -121
  28. data/app/helpers/cms_helper.rb +74 -17
  29. data/app/helpers/cms_index_helper.rb +40 -37
  30. data/app/helpers/dc_application_helper.rb +37 -76
  31. data/app/helpers/dc_category_helper.rb +129 -0
  32. data/app/models/dc_category.rb +50 -24
  33. data/app/models/dc_journal.rb +2 -2
  34. data/app/models/dc_json_ld.rb +18 -41
  35. data/app/models/drgcms_form_fields/date_picker.rb +10 -12
  36. data/app/models/drgcms_form_fields/datetime_picker.rb +10 -11
  37. data/app/models/drgcms_form_fields/drgcms_field.rb +46 -4
  38. data/app/models/drgcms_form_fields/readonly.rb +1 -1
  39. data/app/models/drgcms_form_fields/select.rb +2 -2
  40. data/app/models/drgcms_form_fields/text_autocomplete.rb +2 -2
  41. data/app/models/drgcms_form_fields/text_with_select.rb +1 -0
  42. data/app/models/drgcms_form_fields/tree_select.rb +20 -19
  43. data/app/renderers/dc_common_renderer.rb +20 -3
  44. data/app/views/cmsedit/_form.html.erb +19 -12
  45. data/app/views/cmsedit/edit.html.erb +10 -6
  46. data/app/views/cmsedit/index.html.erb +5 -3
  47. data/app/views/cmsedit/new.html.erb +9 -5
  48. data/app/views/dc_common/_help.html.erb +1 -0
  49. data/app/views/layouts/content.html.erb +1 -1
  50. data/config/locales/drgcms_en.yml +7 -0
  51. data/config/locales/drgcms_sl.yml +7 -0
  52. data/drg_cms.gemspec +3 -3
  53. data/lib/drg_cms/version.rb +1 -1
  54. data/lib/tasks/dc_cleanup.rake +20 -42
  55. metadata +18 -12
  56. data/History.log +0 -109
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83e7b1464f53b988b2bbfb9b9b4069bea725c33bcbe5d8a107293696059742f8
4
- data.tar.gz: e969b7a61d4b837fecc35f476d72c1f421a54dd86cee95e646a299c320f9298e
3
+ metadata.gz: 02d39a65170a68812cc184efecaa6e53f0b0360c4133311e463a1e213005bda1
4
+ data.tar.gz: 334d0446b894f7063a503fbb1dcb8fb69b54c128ea7ac8f21da941205a808da4
5
5
  SHA512:
6
- metadata.gz: c2d0ecc9d8ec2a18a03f14dee87e62f4b51d12a653de943c67a3ddfa6ad578679e3511b3f89b86a9c2c75509e59f230dde4e0946049c3567e087a193d59e02c3
7
- data.tar.gz: 444d5c7f43362cf4466979d47ce3bbb9cd2afa74702a94d10d08947b34d8cf6a533e0f555cc3d734f38a7060b544cd899ad4cffce235957623e2bcc680e07b65
6
+ metadata.gz: 613591551d270da4a2ac32e6b9215d1985b50f209231a9c6d00ddedae95775a08386c7d89fffe5fd536d440b58e69d53659a653925c486e5e5c0c273902e3644
7
+ data.tar.gz: 979c3b634d3a1ed71e7e0dab7f1aff20bc4ccd34df5f2695f05855beb833c3f716b342893ac638096d2fb5419dc87649751ebb85b8ca1905fe53c053af104284
data/CHANGELOG.md ADDED
@@ -0,0 +1,260 @@
1
+ See [GitHub Releases](https://github.com/drgcms/drg-cms/releases) for all future releases
2
+
3
+ ## Changes
4
+
5
+ ## [0.7.0.2] - october 2022
6
+ ### New features
7
+ - mongoid 8 gem and MongoDB 6.0 are tested and used in production
8
+ - jquery 3 enabled in cms editor window
9
+ - local caching results of dc_user_can_view method gains huge speedups. Especially on huge menus
10
+ - categories can now be edited in a tree view. Example of usage of type: method option in result_set
11
+
12
+ ## Bugs resolved:
13
+ - redirect_to method requires **allow_other_host: true** option when redirecting to other host. Requirement of Rails 7
14
+ - options option for configuring form elements, which are created from javascript objects, are now properly parsed when set as json or yaml parameters
15
+
16
+ ## [0.6.1.11] - june 2022
17
+ ### New features
18
+ - DRG CMS is tested and running against Ruby 3.1 and Rails 7 in production
19
+ - enable wizard like form. Wizard forms extend other forms and select fields to be processed step by step. It paints steps panel on the left side of the form and add next and previous action buttons to top of form. Document processing and saving must be done in control file
20
+ - ensure help button is displayed on the form only when there is a help text available
21
+ - attribute data-validate html option added. When set to true HTML5 form validations will be ignored on action button clicked. When you have close button on dialog, and you can not close it, because form validations must be met
22
+ - when check is used to select documents for processing only document ids are send as parameters. Before that they were send as 'check-id'
23
+ - standard fields like created_by, created_at, active, updated_at, updated_by no longer need to be localized for each model
24
+ - google analytics GA4 support added
25
+ - text_with_select and hidden_field DRG Form fields now trigger change event, when the value is changed
26
+ - simplify display of footer record in documents browser. It can now be of Array type. Array columns are in same order as fields defined on form
27
+ - model may now define set_history method, which will be called on standard CRUD operations. The idea is to save some extra data in the set history method, which can be later used for revision.
28
+ - html_field (ck_editor) value is now saved to parameters on ajax action.
29
+
30
+ ## Bugs resolved:
31
+ - in some cases journal of current document was not displayed properly
32
+
33
+ ## [0.6.1.9] - march 2022
34
+ ### New features
35
+ The biggest new feature in this version is trying to match application design to Material design recommendations and replacing the FontAwesome icon fonts with Material design icon set.
36
+
37
+ Other features:
38
+ - form_name and table parameters can be replaced by f and t parameter. This will shorten URL's in menus.
39
+ - new action **type: popup** is added to available actions. This action will load the form into a popup window. Other options are the same as for window or link type.
40
+ - column (field) in result set can now be painted from Rails helper method and not only from method defined in model
41
+
42
+ ## [0.6.1.5] - december 2021
43
+ ### New features
44
+ - process_ajax_result function has two new options. **parenturl** will change URL on parent dialog and **popup_url** which will popup window and load url address into it
45
+ - application locale setting can finally be set by url. Put **&locale=en** into url and all subsequently calls to application will be english localized. To reset to default locale just pass empty **&locale=** parameter
46
+ - comment DRG Form field type has now html option which will add html attributes to comment text
47
+ - result_set data can now be drawn by custom method with new option **type:**. Option defines type of element which will be used for painting result_set data.<br>
48
+ **type: default** or omitted. The default (cms_edit/index) painting is used.<br>
49
+ **type: method**; supports one additional option<br>
50
+ &nbsp; **eval: my_method_name**; will call (helper) method my_method_name and use its return to paint result_set dialog
51
+
52
+ ## [0.6.1.4] - september 2021
53
+ ### New features
54
+ - requirements updated to Rails 6.1 and Ruby 2.7
55
+ - enable Redis caching for fundamental collections. Permissions, site, page and design collections documents. Documents from these collections are usually read on every page load
56
+ - document history (journal) shortcut is added to document info icon
57
+ - embedded documents are now automatically resized to content height
58
+ - help system manager is ready and is located CMS advanced menu. Every DRG Form can have it's help file in help directory. Help dialog can be called from icon in form dialog title
59
+ - form name added as id to form dialog, so fields on a form can be selected according to form name
60
+ - process_json_request has new focus option, which will transfer focus to defined field on ajax call return
61
+ - readonly form can have embedded form which are not readonly. By default readonly embedded forms are also readonly. Readonly form can also have specific actions available. Again by default actions (except back) are not available on readonly forms
62
+ - check option is added to result set actions. This enables selection of documents and processing selected documents with ajax index action
63
+ - more user friendly mobile experience
64
+
65
+ ## [0.6.0.8] - december 2020
66
+ ### New features
67
+ - form field can also be defined as mongoid model method, not just fields defined in mongoid model (which is basically equal)
68
+ - result column value can be obtained by method defined in a mongoid model
69
+ - permissions can now be namespaced. In your application you may start all collection names with same first 3 characters and define eg. dc_* permission, which will set permissions for all collections with name starting with dc_.
70
+ - dc_temp collection has new order field so result can be ordered
71
+ - embedded DRG Form field has now three options for load. default loads embedded form on form load, always loads (refreshes) embedded form each time parent tab is clicked and delay which loads embedded form when parent tab is selected for the first time
72
+ - close action added to form edit options. It will call window.close() javascript code. Can be used when window was opened with window action type
73
+ - new DRG Forms field type method defined. Will call any method and display returned HTML code
74
+ - form dialog name can now be set dynamically
75
+ - dc_format_value won't output 0 if 'z' is present in format parameter.
76
+ - line: top and line: bottom parameters will paint horizontal line on a form
77
+ - reports made easy with help of prawn gem. Reports are treated like controls and consist of form for selecting data and displaying result, printing report and exporting to spreadsheet
78
+ - form fields have got default option which can also be evaluated (eg. Time.now)
79
+ - polls can now have javascript code defined. Radio buttons added to polls.
80
+ - by default result browser can be sorted by any column (field) defined in result_set options. Default can be disabled by adding sort: n option to field
81
+ - result set width option can be set as none or hidden. Used for report which doesn't display field and only exports it to Excel
82
+ - run action now checks if user has permissions to run
83
+ - result set column sorting can be disabled by defining sort: n option
84
+ - poll results may (must) now be confirmed
85
+ - Exo variable font is now being used as default font
86
+
87
+ ## [0.6.0.6] - june 2020
88
+ ### New features
89
+ - index section has got select_field and deny_field option, for granular selection of fields displayed on result set browser
90
+ - new DcTemp model is available for browsing temporary data. Unlike DcMemory model, data is saved to database and can persist until clear is requested
91
+ - CSS code can now be added to DRG Form on top level or on field level with css option
92
+ - javascript code can now be part of DRG Form definition or can be loaded from external js file
93
+ - readonly number field is now displayed formatted when format is specified
94
+ - date_picker and datetime_picker have autocomplete code turned to off by default
95
+ - ajax action in embedded form field can now update form field on parent form
96
+ - embedded DRG Form field can now be used for browsing foreign collection with has_many relation
97
+ - embedded DRG Form field can now pass additional parameters to called Form
98
+ - recommended control files location is now app/controls folder. app/controllers/drgcms_controls locations will be deprecated
99
+ - dc_poll_result model created to save polls result by calling dc_poll.save_results
100
+ - all action buttons (on index, result and edit form) can now be of type link,ajax,submit and window. They can all be called with additional parameters and be either enabled or disabled
101
+ - index actions can now hold additional input fields (ex. for additional filter fields)
102
+ - cmsedit controller has got additional run action, which can be used with ajax actions to directly call any method in controls or any class file.
103
+ - checkbox and select fields can now be properly set from ajax call. When return of set select field is array select field choices are set
104
+ - choices of select field can now depend on value of another field. <b>depend: other_field_name_on_form</b> option forces select field to dynamically update its choices when depend field changes it's value
105
+ - head option added to form. Head is drawn at the top of the form and may display values from fields (methods) from current document, comment or evaluated text data. Definition of head fields is similar to entry fields.
106
+ - new delayed option added to embedded DRG Form field. If set to true embedded form is loaded delayed when tab holding embedded field is selected. This minimizes database access when lots of embedded forms is located on tabs
107
+ - DRG Form can now be dynamically updated by defining dc_update_form method in control file
108
+ - dc_update_method is called after form file has been read and before form processing. Thus whole form can be changed or programmatically created
109
+ - display of readonly fields is mostly improved by using readonly HTML5 keyword
110
+ - new radio DRG Form field for implementing radio button fields entry fields
111
+ - new file_field DRG Form field for classic file upload
112
+ - new action DRG Form field can be used to put action anywhere between for entry fields
113
+
114
+ ## [0.6.0.3] - january 2020
115
+ ### New features
116
+ - Rails 6 compatible
117
+ - jQuery 3 used as jquery javascript library in production
118
+ - SEO optimizations added to dc_page and can be easily added to any document model
119
+ - json_ld_structure skeleton can be easily added to any document model
120
+ - DRGCMS form can be used to browse any array not only mongodb collections
121
+ - form actions can be disabled when editing data. For now only on new document
122
+ - gallery can be added to document by adding boolean field to model and adding dc _render(:dc_gallery) to document renderer
123
+ - parent_disabled and parent_opened options added to tree_view DRG CMS form field.
124
+ - fa-icons can now be rendered as menu item caption
125
+ - renderers moved to app/renderers directory
126
+ - all pictures embedded in document body must have alt data set
127
+ - DRG CMS form can now include other form
128
+ - ajax call result can now be evaluated as javascript code
129
+ - autocomplete field can now return field value which is not an id field
130
+ - CMS toggle polished. When clicked on left half of toggle current position on display is preserved
131
+ - filter condition can now be set, by clicking on column sort icon.
132
+
133
+ ## [0.5.52.14] - may 2019
134
+ ### New features
135
+ - rows an columns on DRG Forms are now created as divs instead of tables
136
+ - file_select DRG Forms field has picture preview on the side
137
+ - DRG Forms table displaying result set can detect @record_footer variable and if set, draws additional row at the end of result set. This can be used for displaying total row data
138
+ - icon position on action button created by dc_link_to method, can now be positioned first or after button caption
139
+ - DRG Form embedded field can now be used to browse any collection, not only embedded collections
140
+ - menu items can be created dynamically. For example login/logout can be embedded in menu. Menu item can also contain just horizontal line as separator
141
+ - DRG Form fields can have HTML5 style validation defined in HTML section. Validations are performed not only on form submit but also on ajax calls
142
+ - number_field added to DRG Forms. Number fields can have fixed decimal places, thousands delimiters and are aligned to right
143
+ - routes needed by DrgCms are now defined by DrgCms.routes method which can be used in routes.rb
144
+ - new forms field <b>tree_select</b>
145
+ - new forms field <b>numeric_field</b>
146
+ - base DRG_CRM models (dc_site, dc_page, dc_piece, dc_user, dc_olicy_rule) are now defined as concerns.
147
+ - dc_site can now inherit policy from other site and thus simplify policy definitions when multiple sites with same users are used on single Rails instance.
148
+ - dc_memory model replaces dc_dummy model for editing non DB data
149
+ - cms_edit controller is aliased as cms
150
+ - menu item may now be calculated when picture values is preceded with @
151
+ - horizontal menu can be added to menu by defining < hr > in caption
152
+ - iframe options added to dc_page model
153
+ - default data for testing created
154
+ - formname keyword change to form_name
155
+ - table elements replaced by div elements for form. Thus editing data is more flexible on tablets or even mobiles,
156
+ - image preview added to file_select field. Can be omitted with preview: no option
157
+ - result table can now have @record_footer record which defines values for footer displayed on the bottom of result table
158
+ - embedded field can embed other forms not just field embedded in model. Name option must match table option.
159
+ - html 5 validations can be added to form fields in html option
160
+ - popup message can be displayed as result of ajax call from form
161
+ - dc_name4_id can return value of any method defined in model
162
+ - removed url collection created for adding removed url-s to sitemap
163
+ - dc_check_user_still_valid method added to check if user data saved to session is still valid every defined period of time,
164
+ - DRG CMS form fields source code refactored. Code for every field is now defined in its own file
165
+
166
+ ### Bugs resolved
167
+ - dc_before_edit callback was not working as expected
168
+ - lots of small bugs resolved
169
+
170
+ ## [0.5.52.4] - march 2018
171
+ ### New features
172
+ - Ruby 2.4 is required
173
+ - Rails 5.2 compatibility requirements met
174
+ - dc_page document has new fields for defining and displaying iframe
175
+ - CMS menu has link option which defines direct url link
176
+ - DRG Form data entry fields are now built of div elements instead of table elements
177
+ - text_with_autocomplete can now return value which is not dependent on relation in another collection
178
+ - data entry form is automatically resized to full size when tab is selected.
179
+
180
+ ### Bugs resolved
181
+ - tree_select field returns BSON objects when BSON object is selected and array when multiple options are selected. It was returning strings before.
182
+ - refactoring formname DRG Forms option to form_name
183
+
184
+ ## [0.5.51] - september 2017
185
+ ### New features
186
+ - Rails version 5.1 compatibility
187
+ - Ruby version 2.3 is now required
188
+ - select field with multiple can now properly process non BSON array values
189
+ - DRG CMS Form readonly field with readonly : yes option will not be saved to database on save
190
+ - dc_dummy collection will be deprecated and replaced with dc_memory collection. Name was chosen unfortunately
191
+ - DrgForms can now be used for editing YAML settings saved in dc_page document. This enables editing dynamic settings of elements embedded in design
192
+
193
+ ## [0.5.50] - may 2017
194
+ ### New features
195
+ - Rails 5.0 compatibility
196
+ - category types can now be defined in dc_big_table under dc_category_type key
197
+ - DrgCms gem routes can now be defined as DrgCms.routes
198
+ - 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
199
+ - switch to Rails concern for main model definitions which may be reused
200
+ - site policy can be inherited from other site
201
+ - menus can now belong to site
202
+ - clear_link method is now a class method of DcPage model and can thus be called directly from other parts of application
203
+
204
+ ### Bugs resolved
205
+ - documents can now be undeleted from journal
206
+
207
+ ## [0.5.10] - february 2017
208
+ ### New features
209
+ - browsing array of hashes is now possible with DRG Forms
210
+ - simple browsing of all defined models and field definitions added to CMS System menu
211
+ - new result_set options table_style, table_class, tr_style, tr_class, td_style, td_class. Welcome colors to result_set browser
212
+ - result_set has been renewed for more modern design. Header elements have now sorting icons
213
+ - 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
214
+ - main CMS menu was becoming to large and was divided into two menus
215
+ - 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
216
+ - new DcInternals model introduced. It will be used for accessing internal variables
217
+ - 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
218
+ - DRG Forms field size can now also be defined on same level as field type. Before it was defined in html sublevel
219
+ - jQuery javascript library forced to jQuery2
220
+ - choices for select fields are now UTF-8 sorted since MongoDB does not provide utf sorting
221
+ - placeholder text added for text_autocomplete field. It can also be defined in form field html options
222
+ - filters option can now have "like" keyword for fields that are not defined on form. For example created_by like user_id
223
+ - 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.
224
+ - result_set filter now has is empty option allowing to filter fields with null value.
225
+ - filter OFF icon now displays currently active filter when hovered.
226
+ - 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.
227
+ - multiple option is added to DRGCMS Forms select_field.
228
+ - is_email? class method added to dc_user model.
229
+ - 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.
230
+ - dc_choices4_field method implemented. It returns choices that are defined in localization files.
231
+ - categories field changed from multitext_autocomplete to select field with multiple options.
232
+ - a poll form can now be surrounded by div tag thus allowing for additional styling of polls
233
+ - drgcms_controlls files can now also be defined only as control files.
234
+ - journal documents can now be filtered by document id
235
+ - CMS menu redesigned. Instead of pulldown menus are now displayed fixed on the left side of edit area
236
+
237
+ ### Bugs resolved
238
+ - associated menu can now be selected on dc_page form also for non dc_simple_menu menus
239
+ - improved readonly display of select and text_autocomplete DRG Forms fields.
240
+ - text_autocomplete field is set to nil when content of field is deleted.
241
+ - 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.
242
+ - call before_new callback only when new empty record has been created.
243
+ - prevent double form submit when browser is restarted.
244
+ - when user has no role defined guest role is automatically applied
245
+ - 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
246
+
247
+
248
+ ## [0.5.7] - november 2015
249
+ ### New features
250
+ - single site document. All data for the site can be saved to single dc_site document and processed by dc_single_sitedoc_request
251
+ - site parts can now also be saved and collected from dc_site document
252
+ - CMS menu done right
253
+ - Page title is now set from dc_page_renderer default method
254
+
255
+ ### Bugs resolved
256
+ - Corrected bug when multitext_autocomplete field was not displaying right values when displayed readonly
257
+ - dc_choices4 now checks if model has active field defined and returns only choices of documents that have active field value set to true
258
+ - design and page edit icons are now displayed only when design or page documents are available
259
+ - return_to from drgcms_control was not properly handled
260
+ - mouse cursor now changes to pointer when moved over ajax link
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012-2018 Damjan Rems
1
+ Copyright 2012-2022 Damjan Rems
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -9,7 +9,7 @@ Minimal database experience and only basic programming skills are needed
9
9
  to create a data entry program. You can do it in 6 simple steps.
10
10
 
11
11
  Step 1: Create Model<br>
12
- Step 2: Generate Form<br>
12
+ Step 2: Generate DRG Form<br>
13
13
  Step 3: Edit Form<br>
14
14
  Step 4: Define Labels and Help Text<br>
15
15
  Step 5: Create Controls File (if required)<br>
@@ -46,14 +46,14 @@ validates :duration, presence: true
46
46
  end
47
47
  ```
48
48
 
49
- <b>Form:</b> Form file is a text file, written in the YAML markup language. It consists
49
+ <b>Form:</b> DRG Form file is a text file, written in the YAML markup language. It consists
50
50
  of three main parts.<br>
51
51
 
52
- <b>index:</b> Which defines actions usually performed on database documents or
52
+ <b>index:</b> Which defines actions performed on database documents or
53
53
  set of document.<br>
54
54
  <b>result_set:</b> Defines set of documents, document fields and actions
55
55
  which can be performed on a document.<br>
56
- <b>form:</b> Defines data entry fields for editing and viewing the document.<br>
56
+ <b>form:</b> Defines data entry fields for editing and viewing a single document.<br>
57
57
 
58
58
  Example of form file for Note model app/forms/note.yaml
59
59
 
@@ -171,6 +171,10 @@ end
171
171
 
172
172
  end
173
173
  ```
174
+ <br>
175
+
176
+ Visit [gallery](https://www.drgcms.org/gallery) of DRG Forms
177
+ usage in production.
174
178
 
175
179
  ## Features
176
180
  DRG CMS uses Ruby on Rails, one of the most popular frameworks for
@@ -210,7 +214,7 @@ Compatibility
210
214
  -------------
211
215
 
212
216
  DRG CMS is being actively developed since 2012 and has been live tested in production
213
- since beginning. It runs against latest technology Ruby (3.0), Rails (6.1)
217
+ since beginning. It runs against latest technology Ruby (3.1), Rails (7.0)
214
218
  and MongoDB (5.0) and had so far little or no problems advancing to latest versions
215
219
  of required programs.
216
220
 
@@ -67,7 +67,12 @@ update_embedded_on_tab_select = function(div_name) {
67
67
  * Return false when confirmation is not required
68
68
  *******************************************************************/
69
69
  confirmation_is_cancled = function(object) {
70
- var confirmation = object.getAttribute("data-confirm");
70
+ let confirmation = '';
71
+ if ($.type(object) === "string") {
72
+ confirmation = object;
73
+ } else {
74
+ confirmation = object.getAttribute("data-confirm");
75
+ }
71
76
  // if confirmation required
72
77
  if (confirmation !== null) {
73
78
  if (!confirm(confirmation)) {return true;}
@@ -81,8 +86,8 @@ confirmation_is_cancled = function(object) {
81
86
  * methodname and depend field value to obtain new values for select field.
82
87
  *******************************************************************/
83
88
  update_select_depend = function(select_name, depend_name, method) {
84
- var select_field = $('#'+select_name);
85
- var depend_field = $('#'+depend_name);
89
+ let select_field = $('#' + select_name);
90
+ let depend_field = $('#' + depend_name);
86
91
 
87
92
  $.ajax({
88
93
  url: "/dc_common/autocomplete",
@@ -133,7 +138,20 @@ format_number_field = function(e) {
133
138
  if (delimiter !== '') whole = ar.join(delimiter);
134
139
  e.val(whole + separator + dec + currency);
135
140
  };
136
-
141
+
142
+ /*******************************************************************
143
+ * Dynamically loads javascript file from filesystem
144
+ *******************************************************************/
145
+ function load_script( url, callback ) {
146
+ let script = document.createElement( "script" )
147
+ script.type = "text/javascript";
148
+ script.src = url;
149
+ script.onload = function() {
150
+ callback()
151
+ };
152
+ document.head.appendChild(script);
153
+ }
154
+
137
155
  /*******************************************************************
138
156
  * Activate jquery UI tooltip. This needs jquery.ui >= 1.9
139
157
  *******************************************************************/
@@ -199,8 +217,10 @@ process_json_result = function(json) {
199
217
 
200
218
  /**** update fields on form ****/
201
219
  case 'record':
202
- let name = key.replace('record_','record[') + ']';
203
- field = $('[name="' + name + '"]');
220
+ //let name = key.replace('record_','record[') + ']';
221
+ //field = $('[name="' + name + '"]');
222
+ field = $('#' + key);
223
+ // console.log(field);
204
224
  // checkbox field
205
225
  if (field.is(':checkbox')) {
206
226
  field.prop('checked', value);
@@ -258,6 +278,13 @@ process_json_result = function(json) {
258
278
  opacity: 0, position: ['auto', 20],
259
279
  closeClass: 'dc-link' });
260
280
  }
281
+ // resize parent iframe if smaller then 500px to ensure popup some space
282
+ let document_height = document.body.scrollHeight;
283
+ if (document_height < 500) {
284
+ let frame = window.frameElement
285
+ if (frame === null) frame = document.body;
286
+ frame.style.height = '500px';
287
+ }
261
288
  break;
262
289
 
263
290
  /**** update div ****/
@@ -554,20 +581,20 @@ $(document).ready( function() {
554
581
  *******************************************************************/
555
582
  $('.dc-check-all').on('click',function(e) {
556
583
  let checkboxes = $('.dc-check');
557
- if ($(this).hasClass('fa-check-square-o')) {
584
+ if ($(this).hasClass('mi-check_box')) {
558
585
  // check all checkboxes
559
586
  checkboxes.each( function() {
560
587
  $(this).prop('checked', true);
561
588
  $(this).parent().closest('div').addClass('dc-checked');
562
589
  });
563
- $(this).removeClass('fa-check-square-o').addClass('fa-square-o');
590
+ $(this).removeClass('mi-check_box').addClass('mi-check_square');
564
591
  } else {
565
592
  // uncheck all checkboxes
566
593
  checkboxes.each( function() {
567
594
  $(this).prop('checked', false);
568
595
  $(this).parent().closest('div').removeClass('dc-checked');
569
596
  });
570
- $(this).removeClass('fa-square-o').addClass('fa-check-square-o');
597
+ $(this).removeClass('mi-check_square').addClass('mi-check_box');
571
598
  }
572
599
  });
573
600
 
@@ -667,11 +694,22 @@ $(document).ready( function() {
667
694
  if (url.length < 5) return false;
668
695
 
669
696
  // check HTML5 validations
670
- if ($("form")[0] && !$("form")[0].checkValidity() ) {
671
- $("form")[0].reportValidity();
672
- return false;
697
+ let validate = this.getAttribute("data-validate");
698
+ if (validate == null || validate == true) {
699
+ if ($("form")[0] && !$("form")[0].checkValidity()) {
700
+ $("form")[0].reportValidity();
701
+ return false;
702
+ }
673
703
  }
674
704
 
705
+ // update html editor fields before data serialization
706
+ let cke_elements = document.querySelectorAll(`div[id^="cke_record"]`);
707
+ cke_elements.forEach(e => {
708
+ let field_id = e.id.replace('cke_', '');
709
+ let text = CKEDITOR.instances[field_id].getData();
710
+ $('#' + field_id).val(text);
711
+ });
712
+
675
713
  let data = {};
676
714
  let request = this.getAttribute("data-request");
677
715
  switch (request) {
@@ -692,7 +730,7 @@ $(document).ready( function() {
692
730
  if (checkboxes.length > 0) {
693
731
  let checked = [];
694
732
  checkboxes.each( function() {
695
- if ($(this).prop('checked')) checked.push($(this).attr("id"));
733
+ if ($(this).prop('checked')) checked.push($(this).attr("id").replace('check-', ''));
696
734
  })
697
735
  data['checked'] = checked;
698
736
  }
@@ -717,7 +755,7 @@ $(document).ready( function() {
717
755
  /*******************************************************************
718
756
  * Click on filter off
719
757
  *******************************************************************/
720
- $('.mi-search_off').on('click', function(e) {
758
+ $('.mi-filter_alt_off').on('click', function(e) {
721
759
  let url = $(this).parents('.dc-filter').attr("data-url");
722
760
  if (url.length > 5) simple_ajax_call(url);
723
761
  });
@@ -970,35 +1008,31 @@ $(document).ready( function() {
970
1008
  });
971
1009
 
972
1010
  $('#1menu-filter').on('click', function(e) {
973
- var target = e.target;
974
- // if (e.target.src !== undefined) {
975
- // target = e.target.parent(); // picture
976
- // };
977
- // dumpAttributes(target);
1011
+ let target = e.target;
978
1012
  req = target.getAttribute("data-request");
979
1013
  $('.menu-filter').toggle(300);
980
-
981
1014
  });
982
1015
 
983
1016
  /*******************************************************************
984
- * This will fire cmsedit index action and pass value entered into
985
- * filter field and thus refresh browsed result set.
1017
+ * Pressing Enter in search field will trigger click event on search icon
1018
+ * and thus force search event.
986
1019
  *******************************************************************/
987
1020
  $('#_record__filter_field').keydown( function(e) {
988
1021
  if (e.which == '13' || e.which == '9') {
989
- let url = $(this).parents('span').attr("data-url");
990
- url = url + "&filter_value=" + this.value;
991
- simple_ajax_call(url);
1022
+ // let url = $(this).parents('span').attr("data-url");
1023
+ // url = url + "&filter_value=" + this.value;
1024
+ // simple_ajax_call(url);
1025
+ $('.record_filter_field_icon').trigger("click")
992
1026
  };
993
1027
  });
994
1028
 
995
1029
  /*******************************************************************
996
- * Same as above, but when clicked on filter icon. enter and tab don't
997
- * work on all field types.
1030
+ * Will set internal filter value and fire reload event to enable
1031
+ * filtering documents of browsed collection.
998
1032
  *******************************************************************/
999
1033
  $('.record_filter_field_icon').on('click', function(e) {
1000
1034
  let field = $('#_record__filter_field');
1001
- let url = $(this).parents('span').attr("data-url");
1035
+ let url = $(this).parents('span').attr("data-url");
1002
1036
  let value = null;
1003
1037
 
1004
1038
  if (field.is(':checkbox')) {
@@ -1015,8 +1049,11 @@ $(document).ready( function() {
1015
1049
  *******************************************************************/
1016
1050
  $('#open_drgcms_filter').on('click', function(e) {
1017
1051
  $('#drgcms_filter').bPopup({
1018
- transition: 'slideDown', transitionClose: 'slideDown', speed: 300,
1019
- opacity: 0, position: ['auto', 20],
1052
+ transition: 'slideDown',
1053
+ transitionClose: 'slideDown',
1054
+ speed: 300,
1055
+ opacity: 0,
1056
+ position: ['auto', 20],
1020
1057
  closeClass: 'dc-link' });
1021
1058
  });
1022
1059
 
@@ -1082,7 +1119,6 @@ $(document).ready( function() {
1082
1119
  * Result set record menu is left open if action is canceled. Ex. delete confirm. This will hide menu.
1083
1120
  *******************************************************************/
1084
1121
  $('.dc-result-submenu ul li').on('click', function(e) {
1085
- console.log('ups');
1086
1122
  if (typeof dc_last_menu_selected !== 'undefined') dc_last_menu_selected.hide();
1087
1123
  });
1088
1124
 
@@ -1133,9 +1169,10 @@ $(document).ready( function() {
1133
1169
  } else {
1134
1170
  sign = '';
1135
1171
  }
1136
- // save value to hidden field which holds return value
1172
+ // save value to field holding return value and trigger change event
1137
1173
  var field = '#' + $(this).attr("id").slice(0,-1);
1138
1174
  $(field).val(val);
1175
+ $(field).trigger("change")
1139
1176
 
1140
1177
  // decimal part
1141
1178
  if (decimals == 0) separator = '';
@@ -5,8 +5,6 @@
5
5
  // the compiled file.
6
6
  //
7
7
  //= require jquery3
8
- //= require drg_cms/jquery-migrate
9
8
  //= require jquery_ujs
10
9
  //= require drg_cms/drg_cms
11
10
  //= require drg_cms/jquery.bpopup.min
12
- //= #require_tree .
@@ -4,9 +4,8 @@
4
4
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
5
  // the compiled file.
6
6
 
7
- //= #require_self
8
- //= require jquery2
9
- //= require drg_cms/jquery-migrate.js
7
+ //= require_self
8
+ //= require jquery3
10
9
  //= require jquery_ujs
11
10
 
12
11
  //= require jquery-ui/widgets/tooltip