para 0.11.4 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/para/admin/main.scss +31 -0
  3. data/app/assets/stylesheets/para/admin/src/_affix.scss +7 -0
  4. data/app/assets/stylesheets/para/admin/src/_alert.scss +35 -0
  5. data/app/assets/stylesheets/para/admin/src/_base.scss +63 -0
  6. data/app/assets/stylesheets/para/admin/src/_bootstrap-variables.scss +766 -379
  7. data/app/assets/stylesheets/para/admin/src/_breadcrumb.scss +37 -0
  8. data/app/assets/stylesheets/para/admin/src/_buttons.scss +128 -0
  9. data/app/assets/stylesheets/para/admin/src/_checkable.scss +106 -0
  10. data/app/assets/stylesheets/para/admin/src/_common.scss +250 -0
  11. data/app/assets/stylesheets/para/admin/src/_dropdown.scss +52 -0
  12. data/app/assets/stylesheets/para/admin/src/_form.scss +359 -0
  13. data/app/assets/stylesheets/para/admin/src/_list.scss +96 -0
  14. data/app/assets/stylesheets/para/admin/src/_mixins.scss +109 -0
  15. data/app/assets/stylesheets/para/admin/src/_multi-select.scss +110 -0
  16. data/app/assets/stylesheets/para/admin/src/_navigation.scss +210 -0
  17. data/app/assets/stylesheets/para/admin/src/_navtabs.scss +68 -0
  18. data/app/assets/stylesheets/para/admin/src/_nested-many.scss +87 -0
  19. data/app/assets/stylesheets/para/admin/src/_nested_one.scss +26 -0
  20. data/app/assets/stylesheets/para/admin/src/_orderable.scss +48 -0
  21. data/app/assets/stylesheets/para/admin/src/_page-loading.scss +40 -0
  22. data/app/assets/stylesheets/para/admin/src/_pagination.scss +39 -0
  23. data/app/assets/stylesheets/para/admin/src/_panel.scss +61 -0
  24. data/app/assets/stylesheets/para/admin/src/_responsive.scss +133 -0
  25. data/app/assets/stylesheets/para/admin/src/_sorting.scss +43 -0
  26. data/app/assets/stylesheets/para/admin/src/_statcard.scss +46 -0
  27. data/app/assets/stylesheets/para/admin/src/_table.scss +36 -0
  28. data/app/assets/stylesheets/para/admin/src/_tree.scss +60 -0
  29. data/app/assets/stylesheets/para/admin/src/{_variables.sass → _variables.scss} +7 -7
  30. data/app/assets/stylesheets/para/admin/src/{_well.sass → _well.scss} +5 -4
  31. data/app/assets/stylesheets/para/admin.scss +15 -0
  32. data/app/assets/stylesheets/para/index.scss +1 -0
  33. data/app/assets/stylesheets/para/lib/datetimepicker.scss +15 -0
  34. data/app/assets/stylesheets/para/lib/fuelux.scss +46 -0
  35. data/app/assets/stylesheets/para/lib/jasny-bootstrap.scss +100 -0
  36. data/app/assets/stylesheets/para/lib/selectize.scss +129 -0
  37. data/app/assets/stylesheets/para/lib/slider.scss +14 -0
  38. data/app/controllers/para/admin/crud_resources_controller.rb +16 -9
  39. data/app/controllers/para/admin/imports_controller.rb +9 -9
  40. data/app/controllers/para/admin/jobs_controller.rb +7 -1
  41. data/app/controllers/para/admin/resources_controller.rb +17 -18
  42. data/app/controllers/para/admin/settings_component_controller.rb +2 -2
  43. data/app/helpers/para/admin/base_helper.rb +36 -25
  44. data/app/helpers/para/admin/page_helper.rb +8 -9
  45. data/app/helpers/para/flash_helper.rb +7 -28
  46. data/app/helpers/para/model_helper.rb +5 -8
  47. data/app/helpers/para/tree_helper.rb +4 -4
  48. data/app/javascripts/para/admin/async-progress.js +58 -0
  49. data/app/javascripts/para/admin/filters-form.js +12 -0
  50. data/app/javascripts/para/admin/job-tracker.js +33 -0
  51. data/app/javascripts/para/admin/table.js +58 -0
  52. data/app/javascripts/para/admin/tabs.js +110 -0
  53. data/app/javascripts/para/admin/theme_actions.js +39 -0
  54. data/app/javascripts/para/admin/tree.js +124 -0
  55. data/app/javascripts/para/application.js +2 -0
  56. data/app/javascripts/para/controllers/application.js +17 -0
  57. data/app/javascripts/para/controllers/index.js +10 -0
  58. data/app/javascripts/para/controllers/para_admin_flash_message_controller.js +48 -0
  59. data/app/javascripts/para/controllers/para_admin_modal_controller.js +43 -0
  60. data/app/javascripts/para/controllers/selectize_field_controller.js +142 -0
  61. data/app/javascripts/para/index.js +31 -0
  62. data/app/javascripts/para/inputs/material-input.js +7 -0
  63. data/app/javascripts/para/inputs/multi-select-input.js +343 -0
  64. data/app/javascripts/para/inputs/nested_many.js +151 -0
  65. data/app/javascripts/para/lib/fetch.js +41 -0
  66. data/app/javascripts/para/lib/page-loading.js +42 -0
  67. data/app/javascripts/para/simple_form_extension/colorpicker.js +30 -0
  68. data/app/javascripts/para/simple_form_extension/datetimepicker.js +115 -0
  69. data/app/javascripts/para/simple_form_extension/fileinput.js +57 -0
  70. data/app/javascripts/para/simple_form_extension/index.js +12 -0
  71. data/app/javascripts/para/simple_form_extension/selectize.js +160 -0
  72. data/app/javascripts/para/simple_form_extension/simple_form_extension_initialization.js +62 -0
  73. data/app/javascripts/para/simple_form_extension/slider.js +43 -0
  74. data/app/javascripts/para/simple_form_extension/spinbox.js +35 -0
  75. data/app/javascripts/para/vendor/bootstrap-colorpicker.js +1025 -0
  76. data/app/javascripts/para/vendor/bootstrap-slider.js +1610 -0
  77. data/app/javascripts/para/vendor/cocoon.js +150 -0
  78. data/app/javascripts/para/vendor/jquery.datetimepicker.js +2156 -0
  79. data/app/javascripts/para/vendor/jquery.js +3 -0
  80. data/app/javascripts/para/vendor/spinbox.js +438 -0
  81. data/app/javascripts/para/vendor/vertebra.js +224 -0
  82. data/app/views/admin/para/exporter/bases/_completed.html.haml +1 -1
  83. data/app/views/layouts/para/admin.html.haml +4 -2
  84. data/app/views/para/admin/imports/new.html.haml +12 -11
  85. data/app/views/para/admin/jobs/_completed.html.haml +1 -1
  86. data/app/views/para/admin/jobs/_failed.html.haml +1 -1
  87. data/app/views/para/admin/jobs/_job.html.haml +11 -0
  88. data/app/views/para/admin/jobs/show.html.haml +1 -10
  89. data/app/views/para/admin/resources/_add_button.html.haml +1 -1
  90. data/app/views/para/admin/resources/_exports_menu.html.haml +2 -2
  91. data/app/views/para/admin/resources/_filters.html.haml +1 -1
  92. data/app/views/para/admin/resources/_imports_menu.html.haml +2 -2
  93. data/app/views/para/admin/resources/_list.html.haml +27 -26
  94. data/app/views/para/admin/resources/_navigation.html.haml +10 -11
  95. data/app/views/para/admin/resources/_subclassable_add_button.html.haml +1 -1
  96. data/app/views/para/admin/shared/_flash.html.haml +18 -0
  97. data/app/views/para/admin/shared/_header.html.haml +1 -1
  98. data/app/views/para/form/_tabs.html.haml +1 -1
  99. data/app/views/para/inputs/_nested_many.html.haml +3 -3
  100. data/app/views/para/inputs/nested_many/_add.html.haml +1 -1
  101. data/app/views/para/inputs/nested_many/_add_with_subclasses.html.haml +2 -2
  102. data/app/views/para/inputs/nested_many/_container.html.haml +1 -1
  103. data/config/locales/fr.yml +1 -0
  104. data/lib/generators/para/install/install_generator.rb +10 -14
  105. data/lib/para/attribute_field/base.rb +3 -0
  106. data/lib/para/attribute_field/wysiwyg_editor.rb +15 -0
  107. data/lib/para/attribute_field.rb +1 -1
  108. data/lib/para/components_configuration.rb +1 -1
  109. data/lib/para/engine.rb +20 -22
  110. data/lib/para/ext/turbo_stream.rb +13 -0
  111. data/lib/para/ext.rb +1 -1
  112. data/lib/para/form_builder/containers.rb +33 -22
  113. data/lib/para/form_builder/nested_form.rb +6 -5
  114. data/lib/para/inputs/nested_many_input.rb +5 -0
  115. data/lib/para/markup/modal.rb +30 -15
  116. data/lib/para/markup/resources_buttons.rb +15 -11
  117. data/lib/para/model_field_parsers/wysiwyg_editor.rb +19 -0
  118. data/lib/para/model_field_parsers.rb +1 -1
  119. data/lib/para/version.rb +1 -1
  120. data/lib/para.rb +2 -8
  121. data/lib/simple_form_extension/components/icons.rb +13 -0
  122. data/lib/simple_form_extension/components/popovers.rb +46 -0
  123. data/lib/simple_form_extension/components.rb +8 -0
  124. data/lib/simple_form_extension/ext/form_builder.rb +20 -0
  125. data/lib/simple_form_extension/file_concern.rb +74 -0
  126. data/lib/simple_form_extension/inputs/boolean_input.rb +16 -0
  127. data/lib/simple_form_extension/inputs/collection_check_boxes_input.rb +15 -0
  128. data/lib/simple_form_extension/inputs/collection_radio_buttons_input.rb +15 -0
  129. data/lib/simple_form_extension/inputs/color_input.rb +37 -0
  130. data/lib/simple_form_extension/inputs/date_time_input.rb +48 -0
  131. data/lib/simple_form_extension/inputs/file_input.rb +41 -0
  132. data/lib/simple_form_extension/inputs/image_input.rb +110 -0
  133. data/lib/simple_form_extension/inputs/numeric_input.rb +27 -0
  134. data/lib/simple_form_extension/inputs/selectize_input.rb +210 -0
  135. data/lib/simple_form_extension/inputs/slider_input.rb +30 -0
  136. data/lib/simple_form_extension/inputs.rb +16 -0
  137. data/lib/simple_form_extension/railtie.rb +21 -0
  138. data/lib/simple_form_extension/resource_name_helper.rb +9 -0
  139. data/lib/simple_form_extension/translations.rb +7 -0
  140. data/lib/simple_form_extension/version.rb +3 -0
  141. data/lib/simple_form_extension.rb +30 -0
  142. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  143. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/alpha.png +0 -0
  144. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/hue-horizontal.png +0 -0
  145. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/hue.png +0 -0
  146. data/vendor/assets/images/simple_form_extension/bootstrap-colorpicker/saturation.png +0 -0
  147. data/vendor/assets/stylesheets/bootstrap-colorpicker.scss +227 -0
  148. data/vendor/assets/stylesheets/bootstrap-slider.scss +246 -0
  149. data/vendor/assets/stylesheets/bootstrap.scss +6032 -0
  150. data/vendor/assets/stylesheets/jquery.datetimepicker.scss +568 -0
  151. metadata +120 -188
  152. data/app/assets/javascripts/admin/app.coffee +0 -1
  153. data/app/assets/javascripts/para/admin/async-progress.coffee +0 -29
  154. data/app/assets/javascripts/para/admin/filters-form.coffee +0 -11
  155. data/app/assets/javascripts/para/admin/job-tracker.coffee +0 -39
  156. data/app/assets/javascripts/para/admin/table.coffee +0 -44
  157. data/app/assets/javascripts/para/admin/tabs.coffee +0 -63
  158. data/app/assets/javascripts/para/admin/theme_actions.coffee +0 -25
  159. data/app/assets/javascripts/para/admin/tree.coffee +0 -105
  160. data/app/assets/javascripts/para/admin.coffee +0 -22
  161. data/app/assets/javascripts/para/application.js +0 -13
  162. data/app/assets/javascripts/para/inputs/material-input.coffee +0 -4
  163. data/app/assets/javascripts/para/inputs/multi-select-input.coffee +0 -174
  164. data/app/assets/javascripts/para/inputs/nested_many.coffee +0 -108
  165. data/app/assets/javascripts/para/lib/ajax.coffee +0 -11
  166. data/app/assets/javascripts/para/lib/remote-file-forms.coffee +0 -59
  167. data/app/assets/javascripts/para/lib/turbolinks-forms.coffee +0 -23
  168. data/app/assets/javascripts/para/lib/turbolinks-loading.coffee +0 -25
  169. data/app/assets/javascripts/para/lib/turbolinks-reloader.coffee +0 -19
  170. data/app/assets/stylesheets/para/admin/main.sass +0 -33
  171. data/app/assets/stylesheets/para/admin/src/_affix.sass +0 -4
  172. data/app/assets/stylesheets/para/admin/src/_alert.sass +0 -17
  173. data/app/assets/stylesheets/para/admin/src/_base.sass +0 -54
  174. data/app/assets/stylesheets/para/admin/src/_breadcrumb.sass +0 -32
  175. data/app/assets/stylesheets/para/admin/src/_buttons.sass +0 -107
  176. data/app/assets/stylesheets/para/admin/src/_checkable.sass +0 -94
  177. data/app/assets/stylesheets/para/admin/src/_common.sass +0 -202
  178. data/app/assets/stylesheets/para/admin/src/_dropdown.sass +0 -40
  179. data/app/assets/stylesheets/para/admin/src/_form.sass +0 -299
  180. data/app/assets/stylesheets/para/admin/src/_list.sass +0 -89
  181. data/app/assets/stylesheets/para/admin/src/_mixins.sass +0 -113
  182. data/app/assets/stylesheets/para/admin/src/_multi-select.sass +0 -91
  183. data/app/assets/stylesheets/para/admin/src/_navigation.sass +0 -171
  184. data/app/assets/stylesheets/para/admin/src/_navtabs.sass +0 -58
  185. data/app/assets/stylesheets/para/admin/src/_nested-many.sass +0 -75
  186. data/app/assets/stylesheets/para/admin/src/_nested_one.sass +0 -22
  187. data/app/assets/stylesheets/para/admin/src/_orderable.sass +0 -44
  188. data/app/assets/stylesheets/para/admin/src/_page-loading.sass +0 -39
  189. data/app/assets/stylesheets/para/admin/src/_pagination.sass +0 -34
  190. data/app/assets/stylesheets/para/admin/src/_panel.sass +0 -55
  191. data/app/assets/stylesheets/para/admin/src/_responsive.sass +0 -117
  192. data/app/assets/stylesheets/para/admin/src/_sorting.sass +0 -36
  193. data/app/assets/stylesheets/para/admin/src/_statcard.sass +0 -41
  194. data/app/assets/stylesheets/para/admin/src/_table.sass +0 -33
  195. data/app/assets/stylesheets/para/admin/src/_tree.sass +0 -52
  196. data/app/assets/stylesheets/para/admin.sass +0 -12
  197. data/app/assets/stylesheets/para/lib/compass/_support.scss +0 -447
  198. data/app/assets/stylesheets/para/lib/compass/css3/_box-shadow.scss +0 -88
  199. data/app/assets/stylesheets/para/lib/compass/css3/_images.scss +0 -152
  200. data/app/assets/stylesheets/para/lib/compass/css3/_inline-block.scss +0 -31
  201. data/app/assets/stylesheets/para/lib/compass/css3/_text-shadow.scss +0 -82
  202. data/app/assets/stylesheets/para/lib/compass/css3/_transform.scss +0 -590
  203. data/app/assets/stylesheets/para/lib/compass/css3/_transition.scss +0 -190
  204. data/app/assets/stylesheets/para/lib/compass/css3/_user-interface.scss +0 -71
  205. data/app/assets/stylesheets/para/lib/compass/utilities/general/_hacks.scss +0 -65
  206. data/app/assets/stylesheets/para/lib/datetimepicker.sass +0 -15
  207. data/app/assets/stylesheets/para/lib/fuelux.sass +0 -40
  208. data/app/assets/stylesheets/para/lib/jasny-bootstrap.sass +0 -97
  209. data/app/assets/stylesheets/para/lib/redactor.sass +0 -86
  210. data/app/assets/stylesheets/para/lib/selectize.sass +0 -111
  211. data/app/assets/stylesheets/para/lib/slider.sass +0 -12
  212. data/app/assets/stylesheets/para/plugins-includes.sass.erb +0 -1
  213. data/lib/para/attribute_field/redactor.rb +0 -22
  214. data/lib/para/ext/request_iframe_xhr.rb +0 -17
  215. data/lib/para/iframe_transport/middleware.rb +0 -58
  216. data/lib/para/iframe_transport.rb +0 -7
  217. data/lib/para/model_field_parsers/redactor.rb +0 -19
  218. data/vendor/assets/javascripts/jquery.iframe-transport.js +0 -260
  219. data/vendor/assets/javascripts/jquery.remote-modal-form.coffee +0 -145
  220. /data/app/assets/stylesheets/admin/{app.sass → app.scss} +0 -0
  221. /data/app/{assets/javascripts → javascripts}/para/plugins-includes.js.erb +0 -0
  222. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/Sortable.js +0 -0
  223. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/jasny-bootstrap.js +0 -0
  224. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/jquery.scrollto.js +0 -0
  225. /data/{vendor/assets/javascripts → app/javascripts/para/vendor}/jquery.sortable.js +0 -0
  226. /data/vendor/assets/stylesheets/{animate.css → animate.scss} +0 -0
  227. /data/vendor/assets/stylesheets/{hint.css → hint.scss} +0 -0
  228. /data/vendor/assets/stylesheets/{jasny-bootstrap.css → jasny-bootstrap.scss} +0 -0
@@ -12,5 +12,5 @@
12
12
  = model_translate(:success, scope: "para.jobs", model: job)
13
13
 
14
14
  = modal.footer do
15
- %button.btn.btn-default{ data: { dismiss: 'modal' } }
15
+ %button.btn.btn-default{ data: { action: 'click->para-admin-modal#closeModal' } }
16
16
  = t('para.shared.close')
@@ -3,5 +3,5 @@
3
3
  = model_translate(:error, scope: "para.jobs", model: job)
4
4
 
5
5
  = modal.footer do
6
- %button.btn.btn-default{ data: { dismiss: 'modal' } }
6
+ %button.btn.btn-default{ data: { action: 'click->para-admin-modal#closeModal' } }
7
7
  = t('para.shared.close')
@@ -0,0 +1,11 @@
1
+ = turbo_frame_tag "para_admin_modal" do
2
+ = modal id: "job-#{ job.model_name.route_key }", data: { :'job-status-url' => url_for(action: :show, id: status.job_id), **job_additional_attributes } do |modal|
3
+ = modal.header do
4
+ = job.model_name.human
5
+
6
+ - if status.failed?
7
+ = render partial: find_partial_for(job, :failed, partial_dir: 'admin/jobs'), locals: { modal: modal, job: job }
8
+ - elsif status.completed?
9
+ = render partial: find_partial_for(job, :completed, partial_dir: 'admin/jobs'), locals: { modal: modal, job: job, status: status }
10
+ - else
11
+ = render partial: find_partial_for(job, :progress, partial_dir: 'admin/jobs'), locals: { modal: modal, job: job, status: status }
@@ -1,10 +1 @@
1
- = modal id: "job-#{ @job.model_name.route_key }", data: { :'job-status-url' => url_for(action: :show, id: @status.job_id) } do |modal|
2
- = modal.header do
3
- = @job.model_name.human
4
-
5
- - if @status.failed?
6
- = render partial: find_partial_for(@job, :failed, partial_dir: 'admin/jobs'), locals: { modal: modal, job: @job }
7
- - elsif @status.completed?
8
- = render partial: find_partial_for(@job, :completed, partial_dir: 'admin/jobs'), locals: { modal: modal, job: @job, status: @status }
9
- - else
10
- = render partial: find_partial_for(@job, :progress, partial_dir: 'admin/jobs'), locals: { modal: modal, job: @job, status: @status }
1
+ = render partial: "para/admin/jobs/job", locals: { job: @job, status: @status }
@@ -1 +1 @@
1
- = icon_link_to t('para.shared.add'), component.relation_path(model.model_name.singular_route_key, action: :new), class: 'btn btn-primary btn-shadow add-button'
1
+ = icon_link_to t('para.shared.add'), component.relation_path(model.model_name.singular_route_key, action: :new), class: 'btn btn-primary btn-shadow add-button', data: { 'turbo-frame': '_top' }
@@ -2,7 +2,7 @@
2
2
  - if component.exporters.length == 1
3
3
  - exporter = component.exporters.first
4
4
 
5
- = link_to component.path(namespace: :exports, exporter: exporter.name, q: params[:q].try(:permit!)), class: 'btn btn-default btn-shadow', method: :post, remote: true, data: { :'job-tracker-button' => true, :'refresh-on-close' => false } do
5
+ = link_to component.path(namespace: :exports, exporter: exporter.name, q: params[:q].try(:permit!)), class: 'btn btn-default btn-shadow', data: { "turbo-method": :post, "turbo-frame": "para_admin_modal" } do
6
6
  %i.fa.fa-download.fa-fw
7
7
  = exporter.model_name.human
8
8
 
@@ -15,5 +15,5 @@
15
15
  %ul.dropdown-menu
16
16
  - component.exporters.each do |exporter|
17
17
  %li
18
- = link_to component.path(namespace: :exports, exporter: exporter.name, q: params[:q].try(:permit!)), method: :post, remote: true, data: { :'job-tracker-button' => true, :'refresh-on-close' => false } do
18
+ = link_to component.path(namespace: :exports, exporter: exporter.name, q: params[:q].try(:permit!)), data: { "turbo-method": :post, "turbo-frame": "para_admin_modal" } do
19
19
  = exporter.model_name.human
@@ -1,5 +1,5 @@
1
1
  .flextable-item.flextable-primary
2
- = search_form_for @q, builder: SimpleForm::FormBuilder, url: @component.path, html: { data: { :'filters-form' => true } } do |form|
2
+ = search_form_for @q, builder: SimpleForm::FormBuilder, url: @component.path, html: { data: { 'filters-form': true, 'turbo-frame': "component-list-#{dom_id(@component)}" } } do |form|
3
3
  .input-group.filter-form
4
4
  = form.input_field fulltext_search_param_for(attributes), as: :string, placeholder: t('para.shared.search'), class: 'form-control'
5
5
 
@@ -2,7 +2,7 @@
2
2
  - if component.importers.length == 1
3
3
  - importer = component.importers.first
4
4
 
5
- = link_to component.path(namespace: :import, action: :new, importer: importer.model_name.singular_route_key), class: 'btn btn-default btn-shadow', remote: true, data: { :'job-tracker-button' => true } do
5
+ = link_to component.path(namespace: :import, action: :new, importer: importer.model_name.singular_route_key), class: 'btn btn-default btn-shadow', data: { "turbo-frame": "para_admin_modal" } do
6
6
  %i.fa.fa-upload.fa-fw
7
7
  = importer.model_name.human
8
8
 
@@ -15,5 +15,5 @@
15
15
  %ul.dropdown-menu
16
16
  - component.importers.each do |importer|
17
17
  %li
18
- = link_to component.path(namespace: :import, action: :new, importer: importer.model_name.singular_route_key), remote: true, data: { :'job-tracker-button' => true } do
18
+ = link_to component.path(namespace: :import, action: :new, importer: importer.model_name.singular_route_key), data: { "turbo-frame": "para_admin_modal" } do
19
19
  = importer.model_name.human
@@ -1,32 +1,33 @@
1
- .row.page-content-row
2
- %div{ class: @component.page_container_class }
3
- .page-content-wrap
4
- .page-list
5
- .page-list-heading
6
- = render partial: find_partial_for(relation, :actions), locals: { relation: relation, component: component, model: model, allow_adding_resource: allow_adding_resource }
1
+ = turbo_frame_tag "component-list-#{dom_id(component)}" do
2
+ .row.page-content-row
3
+ %div{ class: @component.page_container_class }
4
+ .page-content-wrap
5
+ .page-list
6
+ .page-list-heading
7
+ = render partial: find_partial_for(relation, :actions), locals: { relation: relation, component: component, model: model, allow_adding_resource: allow_adding_resource }
7
8
 
8
- .page-list-heading
9
- .flextable
10
- = render partial: find_partial_for(relation, :filters), locals: { attributes: attributes }
9
+ .page-list-heading
10
+ .flextable
11
+ = render partial: find_partial_for(relation, :filters), locals: { attributes: attributes }
11
12
 
12
- - if resources.length > 0
13
- .page-entries-info
14
- = page_entries(resources)
15
- .page-list-body
16
- = table_for(resources: resources, model: model, component: component, attributes: attributes)
13
+ - if resources.length > 0
14
+ .page-entries-info
15
+ = page_entries(resources)
16
+ .page-list-body
17
+ = table_for(resources: resources, model: model, component: component, attributes: attributes)
17
18
 
18
- - else
19
- = alert class: 'no-results', dismissable: false do
20
- - if filtered?(attributes)
21
- = t('para.list.no_results')
22
- - else
23
- = t('para.list.empty')
19
+ - else
20
+ = alert class: 'no-results', dismissable: false do
21
+ - if filtered?(attributes)
22
+ = t('para.list.no_results')
23
+ - else
24
+ = t('para.list.empty')
24
25
 
25
- = add_button_for(component, relation, model) if allow_adding_resource
26
+ = add_button_for(component, relation, model) if allow_adding_resource
26
27
 
27
- - if resources.total_count > resources.length
28
- .page-list-footer
29
- = paginate resources, theme: Para.config.pagination_theme
28
+ - if resources.total_count > resources.length
29
+ .page-list-footer
30
+ = paginate resources, theme: Para.config.pagination_theme
30
31
 
31
- -# Render history module if configured to be displayed
32
- = history_for(@component, action: :index, resources: resources, relation: relation)
32
+ -# Render history module if configured to be displayed
33
+ = history_for(@component, action: :index, resources: resources, relation: relation)
@@ -1,13 +1,12 @@
1
- .top-nav-tabs-affix-placeholder
2
- %ul.top-nav-tabs-affix.nav.nav-tabs{ role: "tablist", "data-top-level-affix": true }
3
- - if can?(:manage, parent_component) && show_component?(parent_component)
4
- %li{ class: ("active" if active_component == parent_component) }
5
- = link_to parent_component.path do
6
- = parent_component.name
1
+ %ul.top-nav-tabs-affix.nav.nav-tabs.row{ role: "tablist", data: { "affix-header": "component-navigation" } }
2
+ - if can?(:manage, parent_component) && show_component?(parent_component)
3
+ %li{ class: ("active" if active_component == parent_component) }
4
+ = link_to parent_component.path do
5
+ = parent_component.name
7
6
 
8
- - parent_component.child_components.each do |child_component|
9
- - next unless can?(:manage, child_component) && show_component?(child_component)
7
+ - parent_component.child_components.each do |child_component|
8
+ - next unless can?(:manage, child_component) && show_component?(child_component)
10
9
 
11
- %li{ class: ("active" if active_component == child_component) }
12
- = link_to child_component.path do
13
- = child_component.name
10
+ %li{ class: ("active" if active_component == child_component) }
11
+ = link_to child_component.path do
12
+ = child_component.name
@@ -6,5 +6,5 @@
6
6
  %ul.dropdown-menu
7
7
  - component.subclass_names.each do |subclass|
8
8
  %li
9
- = link_to component.relation_path(model.model_name.singular_route_key, action: :new, type: subclass) do
9
+ = link_to component.relation_path(model.model_name.singular_route_key, action: :new, type: subclass), data: { 'turbo-frame': '_top' } do
10
10
  = subclass.constantize.model_name.human
@@ -0,0 +1,18 @@
1
+ = turbo_frame_tag "para_admin_flash_messages" do
2
+ - flash.each do |type, message|
3
+ -# Ensure the flash is discarded after it's displayed so it's not displayed again on
4
+ -# the next request
5
+ - flash.discard(type)
6
+
7
+ -# Convert the provided flash type to a bootstrap-compatible color class type
8
+ - type = homogenize_flash_type(type)
9
+
10
+ .alert{ class: "alert-#{type} fade", data: { controller: "para-admin-flash-message", action: "click->para-admin-flash-message#close" } }
11
+ %button.close{ 'aria-label': 'Close', type: 'button' }
12
+ %span{ 'aria-hidden': 'true' } ×
13
+
14
+ .alert-icon-container.pull-left
15
+ %i{ class: "fa #{icon_class_for(type)}" }
16
+  
17
+
18
+ %p= message
@@ -14,5 +14,5 @@
14
14
  %i.fa.fa-home
15
15
 
16
16
  %li
17
- = link_to destroy_admin_user_session_path, method: :delete, class: 'hint--bottom-left btn-power-off btn-shadow', aria: { label: t('para.admin.sign_out') } do
17
+ = link_to destroy_admin_user_session_path, class: 'hint--bottom-left btn-power-off btn-shadow', data: { "turbo-method": :delete, aria: { label: t('para.admin.sign_out') } do
18
18
  %i.fa.fa-sign-out
@@ -2,7 +2,7 @@
2
2
  -# The .nav-tabs-wrapper is used to maintain the tabs height when the tabs
3
3
  -# are fixed to top
4
4
  .nav-tabs-wrapper{ data: { :'nav-tabs-wrapper' => true } }
5
- %ul.nav.nav-tabs.affix-no-mobile{ role: 'tablist', data: { :'tabs-nav-affix' => tabs_manager.affix? } }
5
+ %ul.nav.nav-tabs.affix-no-mobile{ role: 'tablist', data: { :'affix-header' => tabs_manager.affix? && "tabs" } }
6
6
  - tabs.each do |tab|
7
7
  %li{ class: ('active' if tab.active?), role: 'presentation' }
8
8
  = link_to "##{ tab.dom_id }", role: 'tab', aria: { controls: 'settings' }, data: { toggle: 'tab' } do
@@ -1,11 +1,11 @@
1
1
  .nested-many-field{ class: [('orderable' if orderable), ('nested-many-field-inset' if inset)] }
2
2
  .fields-list{ id: dom_identifier }
3
3
  = form.simple_fields_for attribute_name, resources, nested_attribute_name: attribute_name, orderable: orderable, track_attribute_mappings: render_partial do |nested_form|
4
- = render partial: find_partial_for(model, 'nested_many/container', partial_dir: 'inputs'), locals: { form: nested_form, model: nested_form.object.class, subclass: subclass, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params }
4
+ = render partial: find_partial_for(model, 'nested_many/container', partial_dir: 'inputs'), locals: { form: nested_form, model: nested_form.object.class, subclass: subclass, allow_destroy_if: allow_destroy_if, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params }
5
5
 
6
6
  -# Add button
7
7
  - if add_button
8
8
  - if subclass
9
- = render partial: 'para/inputs/nested_many/add_with_subclasses', locals: { form: form, model: model, dom_identifier: dom_identifier, nested_locals: nested_locals, attribute_name: attribute_name, orderable: orderable, subclasses: subclasses, inset: inset, uncollapsed: uncollapsed, add_button_label: add_button_label, add_button_class: add_button_class, render_partial: render_partial, remote_partial_params: remote_partial_params }
9
+ = render partial: 'para/inputs/nested_many/add_with_subclasses', locals: { form: form, model: model, dom_identifier: dom_identifier, nested_locals: nested_locals, attribute_name: attribute_name, orderable: orderable, subclasses: subclasses, inset: inset, uncollapsed: uncollapsed, add_button_label: add_button_label, add_button_class: add_button_class, allow_destroy_if: allow_destroy_if, render_partial: render_partial, remote_partial_params: remote_partial_params }
10
10
  - else
11
- = render partial: 'para/inputs/nested_many/add', locals: { form: form, model: model, dom_identifier: dom_identifier, nested_locals: nested_locals, attribute_name: attribute_name, orderable: orderable, inset: inset, uncollapsed: uncollapsed, add_button_label: add_button_label, add_button_class: add_button_class, render_partial: render_partial, remote_partial_params: remote_partial_params }
11
+ = render partial: 'para/inputs/nested_many/add', locals: { form: form, model: model, dom_identifier: dom_identifier, nested_locals: nested_locals, attribute_name: attribute_name, orderable: orderable, inset: inset, uncollapsed: uncollapsed, add_button_label: add_button_label, add_button_class: add_button_class, allow_destroy_if: allow_destroy_if, render_partial: render_partial, remote_partial_params: remote_partial_params }
@@ -1,2 +1,2 @@
1
- = link_to_add_association form, attribute_name, partial: find_partial_for(model, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: "btn btn-shadow add-button nested-many-inset-add-button #{add_button_class}", data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: model, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params } } do
1
+ = link_to_add_association form, attribute_name, partial: find_partial_for(model, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: "btn btn-shadow add-button nested-many-inset-add-button #{add_button_class}", data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: model, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, allow_destroy_if: allow_destroy_if, render_partial: render_partial, remote_partial_params: remote_partial_params } } do
2
2
  = add_button_label
@@ -1,7 +1,7 @@
1
1
  - if subclasses.one?
2
2
  - submodel = subclasses.first
3
3
 
4
- = link_to_add_association form, attribute_name, wrap_object: proc { with_inverse_association_for(submodel.new, attribute_name, form.object) }, partial: find_partial_for(model, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: "btn btn-shadow add-button nested-many-inset-add-button #{add_button_class}", data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: submodel, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params } } do
4
+ = link_to_add_association form, attribute_name, wrap_object: proc { with_inverse_association_for(submodel.new, attribute_name, form.object) }, partial: find_partial_for(model, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: "btn btn-shadow add-button nested-many-inset-add-button #{add_button_class}", data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: submodel, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params, allow_destroy_if: allow_destroy_if } } do
5
5
  = add_button_label
6
6
  - else
7
7
  .add-button.nested-many-inset-add-button.dropdown
@@ -11,5 +11,5 @@
11
11
  %ul.dropdown-menu
12
12
  - subclasses.each do |submodel|
13
13
  %li
14
- = link_to_add_association form, attribute_name, wrap_object: proc { with_inverse_association_for(submodel.new, attribute_name, form.object) }, partial: find_partial_for(submodel, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: 'dropdown-link', data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: submodel, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, render_partial: render_partial, remote_partial_params: remote_partial_params } } do
14
+ = link_to_add_association form, attribute_name, wrap_object: proc { with_inverse_association_for(submodel.new, attribute_name, form.object) }, partial: find_partial_for(submodel, 'nested_many/container', partial_dir: 'inputs'), form_name: 'form', class: 'dropdown-link', data: { :'association-insertion-node' => "##{ dom_identifier }", :'association-insertion-method' => 'append' }, render_options: { nested_attribute_name: attribute_name, orderable: orderable, locals: { model: submodel, nested_locals: nested_locals, inset: inset, uncollapsed: uncollapsed, allow_destroy_if: allow_destroy_if, render_partial: render_partial, remote_partial_params: remote_partial_params } } do
15
15
  = submodel.model_name.human
@@ -9,7 +9,7 @@
9
9
  = form.nested_resource_name
10
10
  %i.fa.fa-angle-up
11
11
 
12
- = form.remove_association_button
12
+ = form.remove_association_button(allow_destroy_if: allow_destroy_if)
13
13
 
14
14
  .panel-collapse.form-inputs.collapse{ id: form.nested_resource_dom_id, class: ('in' if uncollapsed && form.object.persisted?), data: { rendered: render_partial, render_path: @component.path(**remote_partial_params), id: form.object.id, :"object-name" => form.object_name, :"model-name" => model.name } }
15
15
  .panel-body{ data: { :"nested-form-container" => true } }
@@ -56,6 +56,7 @@ fr:
56
56
  title: "Créer un(e) %{model}"
57
57
  edit:
58
58
  title: "Modification d'un(e) %{model}"
59
+ saving: "Enregistrement en cours ..."
59
60
  nested:
60
61
  name: "Nom"
61
62
  add: "Ajouter"
@@ -1,6 +1,6 @@
1
1
  module Para
2
2
  class InstallGenerator < Rails::Generators::Base
3
- source_root File.expand_path('../templates', __FILE__)
3
+ source_root File.expand_path('templates', __dir__)
4
4
 
5
5
  desc 'Para install generator'
6
6
 
@@ -29,16 +29,13 @@ module Para
29
29
  # This should be avoided when add an initializer namespaced to the
30
30
  # para environment
31
31
  ['simple_form'],
32
- ['simple_form_extension'],
33
32
  # Pull requests are pending, and I don't want to release the gem
34
33
  # under another name to be able to depend on it
35
34
  ['kaminari', '>= 0.16.1'],
36
35
  ['ransack', '>= 1.4.1'],
37
36
  ['bootstrap-kaminari-views', '>= 0.0.5']
38
37
  ].each do |name, *args|
39
- unless gemfile_contents.match(/gem ['"]#{ name }['"]/)
40
- gem name, *args
41
- end
38
+ gem name, *args unless gemfile_contents.match(/gem ['"]#{name}['"]/)
42
39
  end
43
40
  end
44
41
 
@@ -55,7 +52,6 @@ module Para
55
52
 
56
53
  def simple_form_install
57
54
  generate 'simple_form:install', '--bootstrap'
58
- generate 'simple_form_extension:install'
59
55
  end
60
56
 
61
57
  def migrate
@@ -67,24 +63,24 @@ module Para
67
63
  end
68
64
 
69
65
  def mount_engine
70
- say "Mounting Para engine in routes"
66
+ say 'Mounting Para engine in routes'
71
67
  gsub_file 'config/routes.rb', /para_at.+\n/, ''
72
68
  route "para_at '/'"
73
69
  end
74
70
 
75
71
  def final_message
76
- say <<-MESSAGE
72
+ say <<~MESSAGE
77
73
 
78
- *******************************************************************************
74
+ *******************************************************************************
79
75
 
80
- Para was successfully installed in your app.
76
+ Para was successfully installed in your app.
81
77
 
82
- Please not that your should define your root path in your application routes.rb
83
- for the Para admin panel to work :
78
+ Please not that your should define your root path in your application routes.rb
79
+ for the Para admin panel to work :
84
80
 
85
- e.g.: root to: 'home#index'
81
+ e.g.: root to: 'home#index'
86
82
 
87
- *******************************************************************************
83
+ *******************************************************************************
88
84
 
89
85
  MESSAGE
90
86
  end
@@ -79,6 +79,9 @@ module Para
79
79
  def searchable?
80
80
  options[:searchable] != false && (
81
81
  [:string, :text].include?(type.to_sym) && !name.match(/password/)
82
+ ) && (
83
+ !model.respond_to?(:ransackable_attributes) ||
84
+ model.ransackable_attributes.include?(name.to_s)
82
85
  )
83
86
  end
84
87
 
@@ -0,0 +1,15 @@
1
+ module Para
2
+ module AttributeField
3
+ class WysiwygEditor < AttributeField::Base
4
+ include ActionView::Helpers::SanitizeHelper
5
+ include ActionView::Helpers::TextHelper
6
+
7
+ register :wysiwyg_editor, self
8
+
9
+ def initialize(model, options = {})
10
+ options.reverse_merge!(type: 'text', field_type: 'wysiwyg_editor')
11
+ super(model, options)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -16,6 +16,6 @@ require 'para/attribute_field/has_many'
16
16
  require 'para/attribute_field/nested_field'
17
17
  require 'para/attribute_field/nested_one'
18
18
  require 'para/attribute_field/nested_many'
19
- require 'para/attribute_field/redactor'
19
+ require 'para/attribute_field/wysiwyg_editor'
20
20
  require 'para/attribute_field/translation'
21
21
  require 'para/attribute_field/friendly_id'
@@ -139,7 +139,7 @@ module Para
139
139
  #
140
140
  def eager_load_components!
141
141
  $LOAD_PATH.each do |path|
142
- next unless path.match(%r{/components$})
142
+ next unless path.match(%r{/(para_)?components$})
143
143
 
144
144
  glob = File.join(path, '**', '*_component.rb')
145
145
 
data/lib/para/engine.rb CHANGED
@@ -1,19 +1,22 @@
1
1
  module Para
2
2
  class Engine < ::Rails::Engine
3
3
  initializer 'add vendor path to assets pipeline' do |app|
4
- %w(javascripts stylesheets).each do |folder|
5
- app.config.assets.paths << File.expand_path(
6
- "../../../vendor/assets/#{ folder }",
7
- __FILE__
8
- )
4
+ %w[javascripts stylesheets images].each do |folder|
5
+ app.config.assets.paths << vendor_asset_path_for(folder)
9
6
  end
10
7
  end
11
8
 
12
9
  initializer 'Para precompile hook', group: :all do |app|
13
- app.config.assets.precompile += %w(
10
+ app.config.assets.precompile += %w[
14
11
  para/admin.js
15
12
  para/admin.css
16
- )
13
+ ]
14
+ end
15
+
16
+ initializer 'add images to precompile hook' do |app|
17
+ Dir[vendor_asset_path_for('images/**/*.*')].each do |image_path|
18
+ app.config.assets.precompile << image_path.split('/images/').pop
19
+ end
17
20
  end
18
21
 
19
22
  initializer 'Para Orderable Mixin' do
@@ -37,14 +40,6 @@ module Para
37
40
  end
38
41
  end
39
42
 
40
- initializer 'Add IFrame transport support' do |app|
41
- app.middleware.use Para::IframeTransport::Middleware
42
-
43
- ActiveSupport.on_load(:action_controller) do
44
- ActionDispatch::Request.prepend Para::Ext::Request::IFrameXHR
45
- end
46
- end
47
-
48
43
  initializer 'Add resource name methods to simple form extension' do
49
44
  ::SimpleFormExtension.resource_name_methods = (
50
45
  Para.config.resource_name_methods +
@@ -54,9 +49,7 @@ module Para
54
49
 
55
50
  initializer 'Extend active job status\' status class' do
56
51
  ActiveSupport.on_load(:active_job) do
57
- ::ActiveJob::Status::Status.send(
58
- :include, Para::Ext::ActiveJob::StatusMixin
59
- )
52
+ ::ActiveJob::Status::Status.include Para::Ext::ActiveJob::StatusMixin
60
53
  end
61
54
  end
62
55
 
@@ -84,9 +77,8 @@ module Para
84
77
  end
85
78
 
86
79
  initializer 'Configure ActiveJob' do
87
- if ActiveSupport::Cache::NullStore === ActiveJob::Status.store ||
88
- ActiveSupport::Cache::MemoryStore === ActiveJob::Status.store
89
- then
80
+ if ActiveJob::Status.store.is_a?(ActiveSupport::Cache::NullStore) ||
81
+ ActiveJob::Status.store.is_a?(ActiveSupport::Cache::MemoryStore)
90
82
  ActiveJob::Status.store = Para.config.jobs_store
91
83
  end
92
84
 
@@ -108,7 +100,7 @@ module Para
108
100
  if Para.config.enable_app_breadcrumbs
109
101
  include Para::Breadcrumbs::Controller
110
102
  else
111
- Para::ApplicationController.send(:include, Para::Breadcrumbs::Controller)
103
+ Para::ApplicationController.include Para::Breadcrumbs::Controller
112
104
  end
113
105
  end
114
106
  end
@@ -123,5 +115,11 @@ module Para
123
115
  generators.javascripts false
124
116
  generators.test_framework false
125
117
  end
118
+
119
+ private
120
+
121
+ def vendor_asset_path_for(sub_path)
122
+ File.expand_path("../../../vendor/assets/#{sub_path}", __FILE__)
123
+ end
126
124
  end
127
125
  end
@@ -0,0 +1,13 @@
1
+ module Para
2
+ module Ext
3
+ module CustomTurboStreamActions
4
+ def display_flash(id = 'para_admin_flash_messages')
5
+ replace(id, partial: 'para/admin/shared/flash')
6
+ end
7
+ end
8
+ end
9
+ end
10
+
11
+ ActiveSupport::Reloader.to_prepare do
12
+ Turbo::Streams::TagBuilder.prepend(Para::Ext::CustomTurboStreamActions)
13
+ end
data/lib/para/ext.rb CHANGED
@@ -13,4 +13,4 @@ require 'para/ext/paperclip'
13
13
  require 'para/ext/deep_cloneable'
14
14
  require 'para/ext/active_job_status'
15
15
  require 'para/ext/active_record_nested_attributes'
16
- require 'para/ext/request_iframe_xhr'
16
+ require 'para/ext/turbo_stream'
@@ -4,10 +4,10 @@ module Para
4
4
  def fieldset(options = {}, &block)
5
5
  template.content_tag(:div, class: 'form-inputs') do
6
6
  buffer = if (title = options[:title])
7
- template.content_tag(:legend, title)
8
- else
9
- ''.html_safe
10
- end
7
+ template.content_tag(:legend, title)
8
+ else
9
+ ''.html_safe
10
+ end
11
11
 
12
12
  buffer + template.capture(&block)
13
13
  end
@@ -15,26 +15,27 @@ module Para
15
15
 
16
16
  def actions(options = {}, &block)
17
17
  template.content_tag(:div, class: 'form-actions') do
18
- if block
19
- template.capture(&block)
20
- else
21
- if options.empty?
22
- options[:only] = template.instance_variable_get(:@component).default_form_actions
23
- end
24
- actions_buttons_for(options).join("\n").html_safe
18
+ next template.capture(&block) if block
19
+
20
+ if options.empty?
21
+ options[:only] =
22
+ template.instance_variable_get(:@component).default_form_actions
25
23
  end
24
+
25
+ actions_buttons_for(options).join("\n").html_safe
26
26
  end
27
27
  end
28
28
 
29
29
  def actions_buttons_for(options)
30
- names = [:submit, :submit_and_edit]
30
+ names = %i[submit submit_and_edit]
31
31
  names << :submit_and_add_another if template.can?(:create, object.class)
32
32
  names << :cancel
33
33
 
34
34
  names.select! { |name| Array.wrap(options[:only]).include?(name) } if options[:only]
35
35
  names.reject! { |name| Array.wrap(options[:except]).include?(name) } if options[:except]
36
- buttons = names.map { |name| send(:"para_#{ name }_button") }
36
+ buttons = names.map { |name| send(:"para_#{name}_button") }
37
37
  buttons.unshift(return_to_hidden_field)
38
+
38
39
  buttons
39
40
  end
40
41
 
@@ -42,22 +43,31 @@ module Para
42
43
  template.hidden_field_tag(:return_to, return_to_path)
43
44
  end
44
45
 
45
- def para_submit_button(options = {})
46
- button(:submit, ::I18n.t('para.shared.save'), name: '_save', class: 'btn-success btn-shadow')
46
+ def para_submit_button(_options = {})
47
+ button(
48
+ :submit,
49
+ ::I18n.t('para.shared.save'),
50
+ name: '_save',
51
+ class: 'btn-success btn-shadow',
52
+ data: { 'turbo-submits-with': ::I18n.t('para.form.shared.saving') }
53
+ )
47
54
  end
48
55
 
49
56
  def para_submit_and_edit_button
50
57
  # Create a hidden field that will hold the last tab used by the user,
51
58
  # allowing redirection and re-rendering to display it directly
52
59
  current_anchor_tag = template.hidden_field_tag(
53
- :_current_anchor, template.params[:_current_anchor],
54
- data: { :'current-anchor' => true }
60
+ :_current_anchor,
61
+ template.params[:_current_anchor],
62
+ data: { 'current-anchor': true }
55
63
  )
56
64
 
57
65
  button_tag = button(
58
66
  :submit,
59
67
  ::I18n.t('para.shared.save_and_edit'),
60
- name: '_save_and_edit', class: 'btn-primary btn-shadow'
68
+ name: '_save_and_edit',
69
+ class: 'btn-primary btn-shadow',
70
+ data: { 'turbo-submits-with': ::I18n.t('para.form.shared.saving') }
61
71
  )
62
72
 
63
73
  current_anchor_tag + button_tag
@@ -68,7 +78,8 @@ module Para
68
78
  :submit,
69
79
  ::I18n.t('para.shared.save_and_add_another_button'),
70
80
  name: '_save_and_add_another',
71
- class: 'btn-primary btn-shadow'
81
+ class: 'btn-primary btn-shadow',
82
+ data: { 'turbo-submits-with': ::I18n.t('para.form.shared.saving') }
72
83
  )
73
84
  end
74
85
 
@@ -85,9 +96,9 @@ module Para
85
96
  end
86
97
 
87
98
  def component_path
88
- if (component = template.instance_variable_get(:@component))
89
- component.path
90
- end
99
+ return unless (component = template.instance_variable_get(:@component))
100
+
101
+ component.path
91
102
  end
92
103
  end
93
104
  end