agile_rails 0.0.0.1

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 (259) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +5 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +285 -0
  5. data/Rakefile +39 -0
  6. data/agile_rails.gemspec +36 -0
  7. data/app/assets/fonts/ibm-plex-sans-300.woff2 +0 -0
  8. data/app/assets/fonts/ibm-plex-sans-400.woff2 +0 -0
  9. data/app/assets/fonts/ibm-plex-sans-500.woff2 +0 -0
  10. data/app/assets/fonts/ibm-plex-sans-600.woff2 +0 -0
  11. data/app/assets/fonts/ibm-plex-sans-700.woff2 +0 -0
  12. data/app/assets/fonts/ibm-plex-sans-italic.woff2 +0 -0
  13. data/app/assets/images/32px.png +0 -0
  14. data/app/assets/images/throbber.gif +0 -0
  15. data/app/assets/javascripts/agile/agile.js +1489 -0
  16. data/app/assets/javascripts/agile/jquery-migrate.js +702 -0
  17. data/app/assets/javascripts/agile/jquery.bpopup.js +372 -0
  18. data/app/assets/javascripts/agile/jquery.datetimepicker.js +1353 -0
  19. data/app/assets/javascripts/agile/jstree.min.js +6 -0
  20. data/app/assets/javascripts/agile/select-multiple.js +459 -0
  21. data/app/assets/javascripts/agile/some_scripts.js +33 -0
  22. data/app/assets/javascripts/agile.js +22 -0
  23. data/app/assets/javascripts/agile_application.js +22 -0
  24. data/app/assets/javascripts/agile_editor.js +22 -0
  25. data/app/assets/stylesheets/agile/agile.css +1882 -0
  26. data/app/assets/stylesheets/agile/agile_apps.css +149 -0
  27. data/app/assets/stylesheets/agile/jquery.datetimepicker.css +304 -0
  28. data/app/assets/stylesheets/agile/jstree.css +1107 -0
  29. data/app/assets/stylesheets/agile/select-multiple.css +110 -0
  30. data/app/assets/stylesheets/agile/th-bg.png +0 -0
  31. data/app/assets/stylesheets/agile/theme.css +49 -0
  32. data/app/assets/stylesheets/agile.css +21 -0
  33. data/app/assets/stylesheets/agile_application.css +20 -0
  34. data/app/assets/stylesheets/agile_editor.css +19 -0
  35. data/app/controllers/agile_application_controller.rb +735 -0
  36. data/app/controllers/agile_common_controller.rb +345 -0
  37. data/app/controllers/agile_controller.rb +977 -0
  38. data/app/controllers/agile_main_controller.rb +36 -0
  39. data/app/controls/agile_control.rb +120 -0
  40. data/app/controls/agile_report.rb +364 -0
  41. data/app/controls/ar_category_control.rb +39 -0
  42. data/app/controls/ar_help_control.rb +139 -0
  43. data/app/controls/ar_image_control.rb +180 -0
  44. data/app/controls/ar_journal_control.rb +47 -0
  45. data/app/controls/ar_menu_item_control.rb +55 -0
  46. data/app/controls/ar_page_control.rb +64 -0
  47. data/app/controls/ar_poll_result_control.rb +84 -0
  48. data/app/controls/ar_setup_control.rb +62 -0
  49. data/app/controls/belongs_to_control.rb +61 -0
  50. data/app/controls/browse_models_control.rb +98 -0
  51. data/app/controls/settings_form_control.rb +137 -0
  52. data/app/forms/agile_help.yml +112 -0
  53. data/app/forms/agile_menu.yml +140 -0
  54. data/app/forms/agile_report_defaults.yml +39 -0
  55. data/app/forms/all_options.yml +810 -0
  56. data/app/forms/ar_ad.yml +121 -0
  57. data/app/forms/ar_big_table.yml +60 -0
  58. data/app/forms/ar_big_table_value.yml +52 -0
  59. data/app/forms/ar_browse_fields.yml +35 -0
  60. data/app/forms/ar_browse_models.yml +48 -0
  61. data/app/forms/ar_category.yml +73 -0
  62. data/app/forms/ar_category_as_tree.yml +31 -0
  63. data/app/forms/ar_design.yml +75 -0
  64. data/app/forms/ar_filter.yml +52 -0
  65. data/app/forms/ar_folder_permission.yml +56 -0
  66. data/app/forms/ar_folder_rule.yml +48 -0
  67. data/app/forms/ar_gallery.yml +55 -0
  68. data/app/forms/ar_image.yml +126 -0
  69. data/app/forms/ar_image_search.yml +83 -0
  70. data/app/forms/ar_journal.yml +76 -0
  71. data/app/forms/ar_json_ld.yml +56 -0
  72. data/app/forms/ar_key_value.yml +33 -0
  73. data/app/forms/ar_key_value_store.yml +33 -0
  74. data/app/forms/ar_link.yml +60 -0
  75. data/app/forms/ar_menu.yml +67 -0
  76. data/app/forms/ar_menu_item.yml +141 -0
  77. data/app/forms/ar_page.yml +187 -0
  78. data/app/forms/ar_part.yml +91 -0
  79. data/app/forms/ar_permission.yml +52 -0
  80. data/app/forms/ar_permission_rule.yml +40 -0
  81. data/app/forms/ar_piece.yml +106 -0
  82. data/app/forms/ar_policy.yml +64 -0
  83. data/app/forms/ar_policy_rule.yml +42 -0
  84. data/app/forms/ar_policy_rule_nocms.yml +40 -0
  85. data/app/forms/ar_poll.yml +118 -0
  86. data/app/forms/ar_poll_item.yml +78 -0
  87. data/app/forms/ar_poll_result.yml +88 -0
  88. data/app/forms/ar_poll_result_export.yml +35 -0
  89. data/app/forms/ar_removed_url.yml +41 -0
  90. data/app/forms/ar_role.yml +43 -0
  91. data/app/forms/ar_seo.yml +32 -0
  92. data/app/forms/ar_setup.yml +45 -0
  93. data/app/forms/ar_site.yml +149 -0
  94. data/app/forms/ar_steps_template.yml +51 -0
  95. data/app/forms/ar_user.yml +140 -0
  96. data/app/forms/ar_user_role.yml +57 -0
  97. data/app/forms/help/dc_category_as_tree.en +4 -0
  98. data/app/forms/help/dc_category_as_tree.sl +5 -0
  99. data/app/forms/json_ld_schema.yml +168 -0
  100. data/app/helpers/agile_application_helper.rb +1162 -0
  101. data/app/helpers/agile_category_helper.rb +128 -0
  102. data/app/helpers/agile_common_helper.rb +308 -0
  103. data/app/helpers/agile_edit_helper.rb +645 -0
  104. data/app/helpers/agile_helper.rb +509 -0
  105. data/app/helpers/agile_index_helper.rb +677 -0
  106. data/app/helpers/ar_image_helper.rb +128 -0
  107. data/app/models/agile_form_fields/action.rb +61 -0
  108. data/app/models/agile_form_fields/agile_form_field.rb +322 -0
  109. data/app/models/agile_form_fields/belongs_to.rb +112 -0
  110. data/app/models/agile_form_fields/check_box.rb +73 -0
  111. data/app/models/agile_form_fields/comment.rb +62 -0
  112. data/app/models/agile_form_fields/date_picker.rb +104 -0
  113. data/app/models/agile_form_fields/date_select.rb +68 -0
  114. data/app/models/agile_form_fields/datetime_picker.rb +88 -0
  115. data/app/models/agile_form_fields/datetime_select.rb +73 -0
  116. data/app/models/agile_form_fields/file_field.rb +52 -0
  117. data/app/models/agile_form_fields/file_select.rb +69 -0
  118. data/app/models/agile_form_fields/hidden_field.rb +51 -0
  119. data/app/models/agile_form_fields/html_field.rb +69 -0
  120. data/app/models/agile_form_fields/journal_diff.rb +62 -0
  121. data/app/models/agile_form_fields/link_to.rb +69 -0
  122. data/app/models/agile_form_fields/method.rb +66 -0
  123. data/app/models/agile_form_fields/multitext_autocomplete.rb +215 -0
  124. data/app/models/agile_form_fields/number_field.rb +92 -0
  125. data/app/models/agile_form_fields/password_field.rb +63 -0
  126. data/app/models/agile_form_fields/radio_button.rb +95 -0
  127. data/app/models/agile_form_fields/readonly.rb +77 -0
  128. data/app/models/agile_form_fields/select.rb +281 -0
  129. data/app/models/agile_form_fields/submit_tag.rb +58 -0
  130. data/app/models/agile_form_fields/text_area.rb +61 -0
  131. data/app/models/agile_form_fields/text_autocomplete.rb +171 -0
  132. data/app/models/agile_form_fields/text_field.rb +55 -0
  133. data/app/models/agile_form_fields/text_with_select.rb +94 -0
  134. data/app/models/agile_form_fields/tree_select.rb +170 -0
  135. data/app/models/ar_big_table.rb +82 -0
  136. data/app/models/ar_big_table_value.rb +53 -0
  137. data/app/models/ar_category.rb +109 -0
  138. data/app/models/ar_design.rb +116 -0
  139. data/app/models/ar_filter.rb +200 -0
  140. data/app/models/ar_folder_permission.rb +50 -0
  141. data/app/models/ar_folder_rule.rb +47 -0
  142. data/app/models/ar_gallery.rb +53 -0
  143. data/app/models/ar_image.rb +198 -0
  144. data/app/models/ar_internals.rb +60 -0
  145. data/app/models/ar_journal.rb +46 -0
  146. data/app/models/ar_json_ld.rb +131 -0
  147. data/app/models/ar_key_value_store.rb +128 -0
  148. data/app/models/ar_link.rb +48 -0
  149. data/app/models/ar_memory.rb +172 -0
  150. data/app/models/ar_menu.rb +144 -0
  151. data/app/models/ar_menu_item.rb +106 -0
  152. data/app/models/ar_page.rb +74 -0
  153. data/app/models/ar_part.rb +66 -0
  154. data/app/models/ar_permission.rb +180 -0
  155. data/app/models/ar_permission_rule.rb +65 -0
  156. data/app/models/ar_policy.rb +78 -0
  157. data/app/models/ar_policy_rule.rb +65 -0
  158. data/app/models/ar_poll.rb +74 -0
  159. data/app/models/ar_poll_item.rb +47 -0
  160. data/app/models/ar_poll_result.rb +38 -0
  161. data/app/models/ar_removed_url.rb +42 -0
  162. data/app/models/ar_role.rb +84 -0
  163. data/app/models/ar_setup.rb +115 -0
  164. data/app/models/ar_site.rb +68 -0
  165. data/app/models/ar_temp.rb +150 -0
  166. data/app/models/ar_user.rb +72 -0
  167. data/app/models/ar_user_group.rb +38 -0
  168. data/app/models/ar_user_role.rb +54 -0
  169. data/app/models/ar_visit.rb +41 -0
  170. data/app/models/concerns/ar_page_concern.rb +128 -0
  171. data/app/models/concerns/ar_part_concern.rb +48 -0
  172. data/app/models/concerns/ar_piece_concern.rb +48 -0
  173. data/app/models/concerns/ar_policy_rule_concern.rb +87 -0
  174. data/app/models/concerns/ar_seo_concern.rb +66 -0
  175. data/app/models/concerns/ar_site_concern.rb +103 -0
  176. data/app/models/concerns/ar_user_concern.rb +195 -0
  177. data/app/renderers/agile_common_renderer.rb +93 -0
  178. data/app/renderers/agile_renderer.rb +59 -0
  179. data/app/renderers/ar_ad_renderer.rb +219 -0
  180. data/app/renderers/ar_captcha_renderer.rb +113 -0
  181. data/app/renderers/ar_common_renderer.rb +90 -0
  182. data/app/renderers/ar_gallery_renderer.rb +107 -0
  183. data/app/renderers/ar_menu_renderer.rb +195 -0
  184. data/app/renderers/ar_page_renderer.rb +147 -0
  185. data/app/renderers/ar_part_renderer.rb +235 -0
  186. data/app/renderers/ar_piece_renderer.rb +119 -0
  187. data/app/renderers/ar_poll_renderer.rb +272 -0
  188. data/app/views/agile/_edit_stuff.html.erb +57 -0
  189. data/app/views/agile/_form.html.erb +24 -0
  190. data/app/views/agile/_result.html.erb +28 -0
  191. data/app/views/agile/edit.html.erb +13 -0
  192. data/app/views/agile/error.html.erb +2 -0
  193. data/app/views/agile/index.html.erb +14 -0
  194. data/app/views/agile/login.html.erb +19 -0
  195. data/app/views/agile/new.html.erb +12 -0
  196. data/app/views/agile_common/_help.html.erb +18 -0
  197. data/app/views/agile_common/_iframe_edit.html.erb +2 -0
  198. data/app/views/agile_common/paste_clipboard.html.erb +17 -0
  199. data/app/views/layouts/agile.html.erb +17 -0
  200. data/app/views/layouts/content.html.erb +20 -0
  201. data/app/views/models/dump_models.html.erb +47 -0
  202. data/config/initializers/kaminari_patch.rb +56 -0
  203. data/config/locales/agile_de.yml +138 -0
  204. data/config/locales/agile_en.yml +162 -0
  205. data/config/locales/agile_sl.yml +163 -0
  206. data/config/locales/datetimepicker.yml +19 -0
  207. data/config/locales/de.yml +231 -0
  208. data/config/locales/en.yml +13 -0
  209. data/config/locales/kaminari.yml +26 -0
  210. data/config/locales/models_en.yml +1032 -0
  211. data/config/locales/models_sl.yml +1065 -0
  212. data/config/locales/sl.yml +211 -0
  213. data/db/migrate/20240120160001_add_sessions_table.rb +12 -0
  214. data/db/migrate/20240120160002_ar_big_table.rb +17 -0
  215. data/db/migrate/20240120160003_ar_big_table_value.rb +18 -0
  216. data/db/migrate/20240120160004_ar_category.rb +22 -0
  217. data/db/migrate/20240120160005_ar_design.rb +20 -0
  218. data/db/migrate/20240120160006_ar_filter.rb +17 -0
  219. data/db/migrate/20240120160007_ar_gallery.rb +21 -0
  220. data/db/migrate/20240120160008_ar_journal.rb +19 -0
  221. data/db/migrate/20240120160009_ar_key_value_store.rb +11 -0
  222. data/db/migrate/20240120160010_ar_link.rb +19 -0
  223. data/db/migrate/20240120160011_ar_memory.rb +8 -0
  224. data/db/migrate/20240120160012_ar_menu.rb +21 -0
  225. data/db/migrate/20240120160013_ar_menu_item.rb +28 -0
  226. data/db/migrate/20240120160014_ar_page.rb +50 -0
  227. data/db/migrate/20240120160015_ar_part.rb +33 -0
  228. data/db/migrate/20240120160016_ar_permission.rb +16 -0
  229. data/db/migrate/20240120160017_ar_permission_rule.rb +17 -0
  230. data/db/migrate/20240120160018_ar_piece.rb +28 -0
  231. data/db/migrate/20240120160019_ar_policy.rb +21 -0
  232. data/db/migrate/20240120160020_ar_policy_rule.rb +18 -0
  233. data/db/migrate/20240120160021_ar_poll.rb +27 -0
  234. data/db/migrate/20240120160022_ar_poll_item.rb +23 -0
  235. data/db/migrate/20240120160023_ar_poll_result.rb +14 -0
  236. data/db/migrate/20240120160024_ar_removed_url.rb +16 -0
  237. data/db/migrate/20240120160025_ar_role.rb +17 -0
  238. data/db/migrate/20240120160026_ar_site.rb +37 -0
  239. data/db/migrate/20240120160027_ar_temp.rb +11 -0
  240. data/db/migrate/20240120160028_ar_user.rb +42 -0
  241. data/db/migrate/20240120160029_ar_user_group.rb +12 -0
  242. data/db/migrate/20240120160030_ar_user_role.rb +18 -0
  243. data/db/migrate/20240120160031_ar_visit.rb +15 -0
  244. data/db/migrate/20240703016001_ar_setup.rb +16 -0
  245. data/db/migrate/20240703016002_ar_folder_permission.rb +15 -0
  246. data/db/migrate/20240703016003_ar_folder_rule.rb +14 -0
  247. data/db/migrate/20250115000001_ar_image.rb +25 -0
  248. data/lib/agile/configuration.rb +43 -0
  249. data/lib/agile/engine.rb +29 -0
  250. data/lib/agile/version.rb +27 -0
  251. data/lib/agile.rb +282 -0
  252. data/lib/agile_rails.rb +1 -0
  253. data/lib/generators/agile/USAGE +11 -0
  254. data/lib/generators/agile/new_form_generator.rb +369 -0
  255. data/lib/generators/convert_to_ar/convert_to_ar_generator.rb +158 -0
  256. data/lib/tasks/agile_db_clone.rake +132 -0
  257. data/lib/tasks/agile_db_export_to_yaml.rake +37 -0
  258. data/lib/tasks/agile_db_migrate.rake +35 -0
  259. metadata +414 -0
@@ -0,0 +1,23 @@
1
+ class ArPollItem < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_poll_items do |t|
4
+ t.string :name, default: ''
5
+ t.string :text, default: ''
6
+ t.string :field_type, default: ''
7
+ t.string :size, default: '10'
8
+ t.boolean :mandatory, default: false
9
+ t.string :separator, default: ''
10
+ t.string :options, default: ''
11
+ t.integer :order, default: 0
12
+
13
+ t.integer :ar_poll_id
14
+ t.boolean :active, default: true
15
+
16
+ t.integer :created_by
17
+ t.integer :updated_by
18
+ t.timestamps
19
+
20
+ t.index :ar_poll_id
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ class ArPollResult < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_poll_results do |t|
4
+ t.integer :ar_poll_id
5
+ t.string :data
6
+ t.boolean :confirmed
7
+
8
+ t.timestamps
9
+
10
+ t.index :ar_poll_id
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ class ArRemovedUrl < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_removed_urls do |t|
4
+ t.string :url
5
+ t.string :description
6
+ t.integer :created_by
7
+ t.integer :updated_by
8
+ t.integer :ar_site_id
9
+
10
+ t.timestamps
11
+
12
+ t.index :ar_site_id
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ class ArRole < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_roles do |t|
4
+ t.string :name
5
+ t.string :system_name
6
+ t.boolean :active, default: true
7
+
8
+ t.timestamps
9
+ t.integer :created_by
10
+ t.integer :updated_by
11
+
12
+ t.index :name, :unique=>true
13
+ t.index :system_name
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ class ArSite < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_sites do |t|
4
+ t.string :name
5
+ t.string :description
6
+ t.string :homepage_link
7
+ t.string :error_link
8
+ t.string :header
9
+ t.string :css
10
+ t.string :route_name
11
+ t.string :page_title
12
+ t.string :page_class, default: 'ArPage'
13
+ t.string :site_layout, default: 'content'
14
+ t.string :menu_class, default: 'ArMenu'
15
+ t.string :request_processor
16
+ t.string :files_directory
17
+ t.string :logo
18
+ t.string :favicon
19
+ t.string :menu_name
20
+ t.integer :menu_id
21
+ t.string :settings
22
+ t.string :alias_for
23
+ t.string :rails_view
24
+ t.string :design
25
+ t.integer :inherit_policy
26
+
27
+ t.boolean :active, default: true
28
+ t.timestamps
29
+ t.integer :created_by
30
+ t.integer :updated_by
31
+
32
+ t.index :name, unique: true
33
+ t.index :alias_for
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,11 @@
1
+ class ArTemp < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_temps do |t|
4
+ t.string :key
5
+ t.boolean :active
6
+ t.string :data
7
+ t.string :order
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,42 @@
1
+ class ArUser < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_users do |t|
4
+ t.string :username, default: ''
5
+ t.string :title, default: ''
6
+ t.string :first_name, default: ''
7
+ t.string :middle_name, default: ''
8
+ t.string :last_name, default: ''
9
+ t.string :name
10
+ t.string :company, default: ''
11
+ t.string :address
12
+ t.string :post
13
+ t.string :country
14
+ t.string :phone
15
+ t.string :email
16
+ t.string :www
17
+ t.string :picture
18
+ t.date :birthdate
19
+ t.string :about
20
+ t.datetime :last_visit
21
+ t.boolean :active, default: true
22
+ t.date :valid_from
23
+ t.date :valid_to
24
+ t.boolean :group, default: false
25
+ t.string :signature
26
+ t.string :interests
27
+ t.string :job_occup
28
+ t.string :description
29
+ t.date :reg_date
30
+ t.string :password_digest
31
+
32
+ t.timestamps
33
+ t.integer :created_by
34
+ t.integer :updated_by
35
+
36
+ t.index :username, unique: true
37
+ t.index :email, unique: true
38
+ t.index :group
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,12 @@
1
+ class ArUserGroup < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_user_groups do |t|
4
+ t.integer :ar_user_id
5
+ t.integer :group_id
6
+
7
+ t.index :ar_user_id
8
+ t.index :group_id
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ class ArUserRole < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_user_roles do |t|
4
+ t.integer :ar_role_id
5
+ t.integer :ar_user_id
6
+ t.date :valid_from
7
+ t.date :valid_to
8
+ t.boolean :active, default: true
9
+
10
+ t.integer :created_by
11
+ t.integer :updated_by
12
+ t.timestamps
13
+
14
+ t.index [:ar_user_id, :ar_role_id], name: 'index_ar_user_roles_1'
15
+ t.index [:ar_role_id, :ar_user_id], name: 'index_ar_user_roles_2'
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ class ArVisit < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_visits do |t|
4
+ t.integer :page_id
5
+ t.integer :user_id
6
+ t.integer :site_id
7
+ t.string :session_id
8
+ t.string :ip
9
+ t.datetime :time
10
+
11
+ t.index :time
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ class ArSetup < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_setups do |t|
4
+ t.string :name
5
+ t.text :data
6
+ t.text :form
7
+ t.string :edit_ids
8
+
9
+ t.integer :created_by
10
+ t.integer :updated_by
11
+ t.timestamps
12
+
13
+ t.index :name
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ class ArFolderPermission < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_folder_permissions do |t|
4
+ t.string :folder_name
5
+ t.boolean :inherited, default: true
6
+ t.boolean :active, default: true
7
+
8
+ t.integer :created_by
9
+ t.integer :updated_by
10
+ t.timestamps
11
+
12
+ t.index :folder_name, unique: true
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ class ArFolderRule < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_folder_rules do |t|
4
+ t.references :ar_folder_permission
5
+ t.belongs_to :ar_role
6
+ t.integer :permission, default: 0
7
+ t.boolean :active, default: true
8
+
9
+ t.integer :created_by
10
+ t.integer :updated_by
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,25 @@
1
+ class ArImage < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :ar_images do |t|
4
+ t.string :name
5
+ t.string :img_type
6
+ t.string :text
7
+ t.string :short
8
+ t.boolean :keep_original, default: false
9
+ t.string :size_o
10
+ t.string :size_l
11
+ t.string :size_m
12
+ t.string :size_s
13
+ t.integer :page_id
14
+ t.string :keywords
15
+
16
+ t.integer :ar_site_id
17
+ t.integer :created_by
18
+ t.timestamps
19
+
20
+ t.index :ar_site_id
21
+ t.index :created_by
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ #--
2
+ # Copyright (c) 2023+ 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
+ module Agile
25
+ class Configuration
26
+
27
+ def self.defaults
28
+ default = {}
29
+ # 1: new, 2: filter, 3: sort
30
+ default[:index_standard_actions] = { 1 => 'new', 3 => 'filter' }
31
+ # 1: edit, 2: duplicate, 3: delete
32
+ default[:dataset_standard_actions] = { 1 => 'edit', 3 => 'delete' }
33
+ # 1: back, 2: save, 3: save&back, 4: refresh, 5: enable, 6:new
34
+ default[:form_standard_actions] = { 1 => 'cancel', 3 => 'save&back' }
35
+ # top, bottom, both
36
+ default[:default_actions_position] = 'top'
37
+ # top, left
38
+ default[:default_labels_position] = 'left'
39
+ default
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,29 @@
1
+ #--
2
+ # Copyright (c) 2023+ 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
+ module Agile #:nodoc:
25
+
26
+ class Engine < ::Rails::Engine #:nodoc:
27
+ end
28
+
29
+ end
@@ -0,0 +1,27 @@
1
+ #--
2
+ # Copyright (c) 2023+ 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
+ # Agile gem version
25
+ module Agile # :nodoc:
26
+ VERSION = '0.0.0.1'.freeze
27
+ end
data/lib/agile.rb ADDED
@@ -0,0 +1,282 @@
1
+ require 'agile/engine'
2
+ require 'agile/version'
3
+ require 'agile/configuration'
4
+
5
+ ################################################################################
6
+ # AgileRails plugin module
7
+ ################################################################################
8
+ module Agile
9
+ @@paths = {}
10
+ @@configuration = nil
11
+
12
+ ################################################################################
13
+ # Returns source file name of required model.
14
+ #
15
+ # Used wherever end user wants to extend basic Agile model. Model source definition
16
+ # file is tricky to require since it is included in Agile gem and thus a moving
17
+ # target. Whenever gem version changes file location changes with it. This way
18
+ # programmer doesn't have to care about actual source file location.
19
+ #
20
+ # Parameters:
21
+ # [ model_name ] String. Must be passed in lower case, just like the file name is.
22
+ #
23
+ # Example:
24
+ # require Agile.model 'ar_page'
25
+ #
26
+ ###############################################################################
27
+ def self.model(model_name)
28
+ File.expand_path("../../app/models/#{model_name}.rb", __FILE__)
29
+ end
30
+
31
+ ###############################################################################
32
+ # If new_value is nil method will return current value of application configuration. Otherwise
33
+ # it will set new value to the configurations.
34
+ #
35
+ # @param [Object] what : Config name
36
+ # @param [Object] new_value : new config value. Default = nil.
37
+ ###############################################################################
38
+ def self.config(what, new_value = nil)
39
+ @@configuration ||= Agile::Configuration.defaults
40
+ if new_value
41
+ @@configuration[what.to_sym] = new_value
42
+ else
43
+ @@configuration[what.to_sym]
44
+ end
45
+ end
46
+
47
+ ###############################################################################
48
+ # When new plugin with its own AgileRails forms is added to application, path to
49
+ # forms directory must be sent to Agile module. Paths are saved into @@paths hash variable.
50
+ #
51
+ # Adding path is best done in plugin module initialization code.
52
+ #
53
+ # Parameters:
54
+ # [path] String. Path to forms directory
55
+ #
56
+ # Example:
57
+ # # As used in MyPlugin plugin.
58
+ # require "my_plugin/engine"
59
+ # module MyPlugin
60
+ # end
61
+ #
62
+ # Agile.add_forms_path File.expand_path("../../app/forms", __FILE__)
63
+ ###############################################################################
64
+ def self.add_forms_path(path)
65
+ if @@paths[:forms].nil?
66
+ @@paths[:forms] = []
67
+ # Agile forms path
68
+ @@paths[:forms] << File.expand_path('../../app/forms', __FILE__)
69
+ end
70
+ @@paths[:forms] << path
71
+ end
72
+
73
+ ###############################################################################
74
+ # Not used anymore!
75
+ #
76
+ # Patching is one of the rubies best strenghts and also its curse. Loading
77
+ # patches in development has become real problem for developers. This is my
78
+ # way of patch loading.
79
+ #
80
+ # Preferred location for patch files is lib/patches. But can be located anywhere in
81
+ # Rails application path. Add Agile.add_forms_path to initialization part and pass
82
+ # directory name where patching files are located as parameter.
83
+ #
84
+ # Method will also load patch file so loading in config/initializers is not required.
85
+ #
86
+ # Parameters:
87
+ # [path] String. Path to patches directory
88
+ #
89
+ # Example:
90
+ # # As used in MyPlugin plugin.
91
+ # require "my_plugin/engine"
92
+ # module MyPlugin
93
+ # end
94
+ #
95
+ # Agile.add_patches_path File.dirname(__FILE__) + '/patches'
96
+ ###############################################################################
97
+ def self.add_patches_path(path)
98
+ self.add_path(:patches, path)
99
+ # Dir["#{path}/**/*.rb"].each { |path| p path; require_dependency path }
100
+ # Dir["#{path}/**/*.rb"].each { |file| p file; require file }
101
+ end
102
+
103
+ ###############################################################################
104
+ # General add path method. Paths are saved into @@paths hash variable. Paths can
105
+ # then be reused in different parts of application.
106
+ #
107
+ # Adding paths is best done in plugin mudule initialization code.
108
+ #
109
+ # Parameters:
110
+ # [type] Symbol. Defines type of data. Current used values are :forms, :patches
111
+ # [path] String. Path or string which will be added to @@paths hash.
112
+ #
113
+ # Example:
114
+ # Agile.add_path(File.expand_path('patches', __FILE__), :patches)
115
+ ###############################################################################
116
+ def self.add_path(type, path)
117
+ @@paths[type] ||= []
118
+ @@paths[type] << path
119
+ end
120
+
121
+ ###############################################################################
122
+ # Will return value saved to internal @@paths hash.
123
+ #
124
+ # Parameters:
125
+ # [key] String. Key
126
+ #
127
+ # forms_paths = Agile.paths(:forms)
128
+ # patches_paths = Agile.paths(:patches)
129
+ ###############################################################################
130
+ def self.paths(key)
131
+ @@paths[key]
132
+ end
133
+
134
+ ###############################################################################
135
+ # Will return name of file relative to agile_rails gem root
136
+ ###############################################################################
137
+ def self.from_root(file = nil)
138
+ File.expand_path("../../#{file}", __FILE__).to_s
139
+ end
140
+
141
+ ####################################################################
142
+ # Checks if any errors exist on document and writes error log. It can also
143
+ # crash if requested. This is mostly usefull in development for debuging
144
+ # model errors or when updating multiple collections and each save must be
145
+ # checked if succesfull.
146
+ #
147
+ # @param [Document] Document object which will be checked
148
+ # @param [Boolean] If true method should end in runtime error. Default = false.
149
+ #
150
+ # @return [String] Error messages or empty string if everything is OK.
151
+ #
152
+ # @Example Check for error when data is saved.
153
+ # model.save
154
+ # if (msg = Agile.model_check(model) ).size > 0
155
+ # p msg
156
+ # error process ......
157
+ # end
158
+ #
159
+ ####################################################################
160
+ def self.model_check(document, crash = false)
161
+ return unless document.errors.any?
162
+
163
+ msg = document.errors.inject('') { |r, error| r << "#{error.attribute}: #{error.message}\n" }
164
+ if crash && msg.size > 0
165
+ msg = "Validation errors in #{document.class}:\n" + msg
166
+ pp msg
167
+ Rails.logger.error(msg)
168
+ raise 'Validation error. See log for more information.'
169
+ end
170
+ msg
171
+ end
172
+
173
+ ########################################################################
174
+ # Determines if redis cache store is active
175
+ #
176
+ # @return [Boolean] : True if redis cache store is active
177
+ ########################################################################
178
+ def self.redis_cache_store?
179
+ (Rails.application.config.cache_store.first == :redis_cache_store) rescue false
180
+ end
181
+
182
+ ####################################################################
183
+ # Clear cache. If key is specified only this key will be deleted.
184
+ #
185
+ # @param [String] Optional key to be deleted
186
+ ####################################################################
187
+ def self.cache_clear(key = nil)
188
+ return Rails.cache.clear if key.nil?
189
+
190
+ if redis_cache_store?
191
+ Rails.cache.redis.del(key)
192
+ else
193
+ Rails.cache.delete_matched("#{key}*")
194
+ end
195
+ end
196
+
197
+ ####################################################################
198
+ # Read from cache
199
+ #
200
+ # @keys [Array] Array of keys
201
+ #
202
+ # @return [Object] Data returned from cache
203
+ ####################################################################
204
+ def self.cache_read(keys)
205
+ data = if redis_cache_store?
206
+ tmp_keys = keys.dup
207
+ first_key = tmp_keys.shift
208
+ cached = Rails.cache.redis.hget(first_key, tmp_keys.join(''))
209
+ cached ? Marshal.load(cached) : nil
210
+ else
211
+ Rails.cache.read(keys.join(''))
212
+ end
213
+ return data if data
214
+ return unless block_given?
215
+
216
+ cache_write(keys, yield)
217
+ end
218
+
219
+ ####################################################################
220
+ # Write data to cache
221
+ #
222
+ # @param [Array] keys : array of keys
223
+ # @param [Object] data : Document object
224
+ #
225
+ # @return [Object] data so cache_write can be used as last statement in method.
226
+ ####################################################################
227
+ def self.cache_write(keys, data)
228
+ if redis_cache_store?
229
+ tmp_keys = keys.dup
230
+ first_key = tmp_keys.shift
231
+ Rails.cache.redis.hset(first_key, tmp_keys.join(''), Marshal.dump(data))
232
+ else
233
+ Rails.cache.write(keys.join(''), data)
234
+ end
235
+ data
236
+ end
237
+
238
+ ########################################################################
239
+ # Will dump exception to rails log and console.
240
+ #
241
+ # Parameters:
242
+ # [exception] Object: Exception caught
243
+ ########################################################################
244
+ def self.dump_exception(exception)
245
+ msg = [exception.message, *exception.backtrace].join($/)
246
+ pp msg
247
+ Rails.logger.error msg
248
+ end
249
+
250
+ ###############################################################################
251
+ # All Routes required by agile_rails.
252
+ #
253
+ # Usage:
254
+ # put Agile.routes line anywhere into your application routes file
255
+ ###############################################################################
256
+ def self.routes
257
+ Rails.application.routes.draw do
258
+ controller :agile_common do
259
+ post 'agile/autocomplete' => :autocomplete
260
+ post 'agile_common/ad_click' => :ad_click
261
+ get 'agile/toggle_edit_mode' => :toggle_edit_mode
262
+ match 'agile_common/process_login' => :process_login, via: [:put, :post]
263
+ get 'agile_common/login' => :login
264
+ get 'agile_common/logout' => :logout
265
+ get 'agile_common/copy_clipboard' => :copy_clipboard
266
+ match 'agile_common/paste_clipboard' => :paste_clipboard, via: [:get, :post]
267
+ put 'agile_common/restore_from_journal' => :restore_from_journal
268
+ get 'agile_common/add_json_ld_schema' => :add_json_ld_schema
269
+ get 'agile_common/help' => :help
270
+ put 'agile_common/poll_submit' => :poll_submit
271
+ end
272
+
273
+ match 'elfinder' => 'agile_elfinder#connector', via: [:get, :post]
274
+ get 'agile/login' => 'agile#login'
275
+ get 'agile/logout' => 'agile#logout'
276
+ match 'agile/run' => 'agile#run', via: [:get, :put, :post]
277
+
278
+ resources :agile
279
+ end
280
+ end
281
+
282
+ end
@@ -0,0 +1 @@
1
+ require 'agile'