decidim-enhanced_textwork 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (441) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +64 -0
  3. data/Rakefile +3 -0
  4. data/app/cells/decidim/enhanced_textwork/amendment/show.erb +14 -0
  5. data/app/cells/decidim/enhanced_textwork/amendment_cell.rb +39 -0
  6. data/app/cells/decidim/enhanced_textwork/collaborative_draft_cell.rb +49 -0
  7. data/app/cells/decidim/enhanced_textwork/collaborative_draft_link_to_paragraph/show.erb +13 -0
  8. data/app/cells/decidim/enhanced_textwork/collaborative_draft_link_to_paragraph_cell.rb +57 -0
  9. data/app/cells/decidim/enhanced_textwork/collaborative_draft_m/footer.erb +6 -0
  10. data/app/cells/decidim/enhanced_textwork/collaborative_draft_m/tags.erb +1 -0
  11. data/app/cells/decidim/enhanced_textwork/collaborative_draft_m_cell.rb +44 -0
  12. data/app/cells/decidim/enhanced_textwork/collaborative_drafts/reported_content/show.erb +3 -0
  13. data/app/cells/decidim/enhanced_textwork/collaborative_drafts/reported_content_cell.rb +15 -0
  14. data/app/cells/decidim/enhanced_textwork/comments/show.erb +33 -0
  15. data/app/cells/decidim/enhanced_textwork/comments_cell.rb +8 -0
  16. data/app/cells/decidim/enhanced_textwork/content_blocks/highlighted_paragraphs/elements.erb +5 -0
  17. data/app/cells/decidim/enhanced_textwork/content_blocks/highlighted_paragraphs/heading.erb +1 -0
  18. data/app/cells/decidim/enhanced_textwork/content_blocks/highlighted_paragraphs_cell.rb +19 -0
  19. data/app/cells/decidim/enhanced_textwork/cost_report/show.erb +35 -0
  20. data/app/cells/decidim/enhanced_textwork/cost_report_cell.rb +42 -0
  21. data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs/show.erb +3 -0
  22. data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs_cell.rb +25 -0
  23. data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs_for_component/show.erb +19 -0
  24. data/app/cells/decidim/enhanced_textwork/highlighted_paragraphs_for_component_cell.rb +41 -0
  25. data/app/cells/decidim/enhanced_textwork/irreversible_action_modal/show.erb +27 -0
  26. data/app/cells/decidim/enhanced_textwork/irreversible_action_modal_cell.rb +80 -0
  27. data/app/cells/decidim/enhanced_textwork/paragraph_activity_cell.rb +35 -0
  28. data/app/cells/decidim/enhanced_textwork/paragraph_cell.rb +53 -0
  29. data/app/cells/decidim/enhanced_textwork/paragraph_link_to_collaborative_draft_cell.rb +26 -0
  30. data/app/cells/decidim/enhanced_textwork/paragraph_link_to_rejected_emendation/show.erb +9 -0
  31. data/app/cells/decidim/enhanced_textwork/paragraph_link_to_rejected_emendation_cell.rb +34 -0
  32. data/app/cells/decidim/enhanced_textwork/paragraph_linked_resources/show.erb +9 -0
  33. data/app/cells/decidim/enhanced_textwork/paragraph_linked_resources_cell.rb +14 -0
  34. data/app/cells/decidim/enhanced_textwork/paragraph_m/footer.erb +26 -0
  35. data/app/cells/decidim/enhanced_textwork/paragraph_m/tags.erb +1 -0
  36. data/app/cells/decidim/enhanced_textwork/paragraph_m_cell.rb +152 -0
  37. data/app/cells/decidim/enhanced_textwork/paragraph_tags/show.erb +33 -0
  38. data/app/cells/decidim/enhanced_textwork/paragraph_tags_cell.rb +35 -0
  39. data/app/cells/decidim/enhanced_textwork/paragraphs_picker/paragraphs.erb +12 -0
  40. data/app/cells/decidim/enhanced_textwork/paragraphs_picker/show.erb +14 -0
  41. data/app/cells/decidim/enhanced_textwork/paragraphs_picker_cell.rb +72 -0
  42. data/app/cells/decidim/enhanced_textwork/participatory_text_paragraph/buttons.erb +33 -0
  43. data/app/cells/decidim/enhanced_textwork/participatory_text_paragraph/show.erb +38 -0
  44. data/app/cells/decidim/enhanced_textwork/participatory_text_paragraph_cell.rb +104 -0
  45. data/app/cells/decidim/enhanced_textwork/reported_content/show.erb +4 -0
  46. data/app/cells/decidim/enhanced_textwork/reported_content_cell.rb +13 -0
  47. data/app/commands/decidim/enhanced_textwork/accept_access_to_collaborative_draft.rb +70 -0
  48. data/app/commands/decidim/enhanced_textwork/admin/answer_paragraph.rb +74 -0
  49. data/app/commands/decidim/enhanced_textwork/admin/assign_paragraphs_to_valuator.rb +61 -0
  50. data/app/commands/decidim/enhanced_textwork/admin/create_paragraph.rb +97 -0
  51. data/app/commands/decidim/enhanced_textwork/admin/create_paragraph_note.rb +67 -0
  52. data/app/commands/decidim/enhanced_textwork/admin/destroy_paragraph.rb +32 -0
  53. data/app/commands/decidim/enhanced_textwork/admin/discard_participatory_text.rb +40 -0
  54. data/app/commands/decidim/enhanced_textwork/admin/import_from_editor_participatory_text.rb +53 -0
  55. data/app/commands/decidim/enhanced_textwork/admin/import_paragraphs.rb +101 -0
  56. data/app/commands/decidim/enhanced_textwork/admin/import_participatory_text.rb +55 -0
  57. data/app/commands/decidim/enhanced_textwork/admin/merge_paragraphs.rb +69 -0
  58. data/app/commands/decidim/enhanced_textwork/admin/notify_paragraph_answer.rb +85 -0
  59. data/app/commands/decidim/enhanced_textwork/admin/publish_answers.rb +67 -0
  60. data/app/commands/decidim/enhanced_textwork/admin/publish_participatory_text.rb +81 -0
  61. data/app/commands/decidim/enhanced_textwork/admin/split_paragraphs.rb +67 -0
  62. data/app/commands/decidim/enhanced_textwork/admin/unassign_paragraphs_from_valuator.rb +62 -0
  63. data/app/commands/decidim/enhanced_textwork/admin/update_paragraph.rb +86 -0
  64. data/app/commands/decidim/enhanced_textwork/admin/update_paragraph_category.rb +68 -0
  65. data/app/commands/decidim/enhanced_textwork/admin/update_paragraph_scope.rb +75 -0
  66. data/app/commands/decidim/enhanced_textwork/admin/update_participatory_text.rb +68 -0
  67. data/app/commands/decidim/enhanced_textwork/create_collaborative_draft.rb +81 -0
  68. data/app/commands/decidim/enhanced_textwork/create_paragraph.rb +106 -0
  69. data/app/commands/decidim/enhanced_textwork/destroy_paragraph.rb +33 -0
  70. data/app/commands/decidim/enhanced_textwork/gallery_methods.rb +18 -0
  71. data/app/commands/decidim/enhanced_textwork/hashtags_methods.rb +36 -0
  72. data/app/commands/decidim/enhanced_textwork/publish_collaborative_draft.rb +93 -0
  73. data/app/commands/decidim/enhanced_textwork/publish_paragraph.rb +105 -0
  74. data/app/commands/decidim/enhanced_textwork/reject_access_to_collaborative_draft.rb +62 -0
  75. data/app/commands/decidim/enhanced_textwork/request_access_to_collaborative_draft.rb +49 -0
  76. data/app/commands/decidim/enhanced_textwork/unvote_paragraph.rb +65 -0
  77. data/app/commands/decidim/enhanced_textwork/update_collaborative_draft.rb +63 -0
  78. data/app/commands/decidim/enhanced_textwork/update_paragraph.rb +135 -0
  79. data/app/commands/decidim/enhanced_textwork/vote_paragraph.rb +77 -0
  80. data/app/commands/decidim/enhanced_textwork/withdraw_collaborative_draft.rb +65 -0
  81. data/app/commands/decidim/enhanced_textwork/withdraw_paragraph.rb +50 -0
  82. data/app/controllers/concerns/decidim/enhanced_textwork/admin/filterable.rb +82 -0
  83. data/app/controllers/concerns/decidim/enhanced_textwork/admin/picker.rb +21 -0
  84. data/app/controllers/concerns/decidim/enhanced_textwork/collaborative_orderable.rb +42 -0
  85. data/app/controllers/concerns/decidim/enhanced_textwork/orderable.rb +78 -0
  86. data/app/controllers/decidim/enhanced_textwork/admin/application_controller.rb +16 -0
  87. data/app/controllers/decidim/enhanced_textwork/admin/paragraph_answers_controller.rb +50 -0
  88. data/app/controllers/decidim/enhanced_textwork/admin/paragraph_notes_controller.rb +39 -0
  89. data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_controller.rb +237 -0
  90. data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_imports_controller.rb +33 -0
  91. data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_merges_controller.rb +30 -0
  92. data/app/controllers/decidim/enhanced_textwork/admin/paragraphs_splits_controller.rb +30 -0
  93. data/app/controllers/decidim/enhanced_textwork/admin/participatory_texts_controller.rb +128 -0
  94. data/app/controllers/decidim/enhanced_textwork/admin/valuation_assignments_controller.rb +58 -0
  95. data/app/controllers/decidim/enhanced_textwork/application_controller.rb +31 -0
  96. data/app/controllers/decidim/enhanced_textwork/collaborative_draft_collaborator_requests_controller.rb +53 -0
  97. data/app/controllers/decidim/enhanced_textwork/collaborative_drafts_controller.rb +161 -0
  98. data/app/controllers/decidim/enhanced_textwork/paragraph_votes_controller.rb +65 -0
  99. data/app/controllers/decidim/enhanced_textwork/paragraphs_controller.rb +316 -0
  100. data/app/controllers/decidim/enhanced_textwork/versions_controller.rb +21 -0
  101. data/app/controllers/decidim/enhanced_textwork/widgets_controller.rb +19 -0
  102. data/app/events/decidim/enhanced_textwork/accepted_paragraph_event.rb +17 -0
  103. data/app/events/decidim/enhanced_textwork/admin/paragraph_note_created_event.rb +27 -0
  104. data/app/events/decidim/enhanced_textwork/admin/update_paragraph_category_event.rb +11 -0
  105. data/app/events/decidim/enhanced_textwork/admin/update_paragraph_scope_event.rb +11 -0
  106. data/app/events/decidim/enhanced_textwork/collaborative_draft_access_accepted_event.rb +8 -0
  107. data/app/events/decidim/enhanced_textwork/collaborative_draft_access_rejected_event.rb +8 -0
  108. data/app/events/decidim/enhanced_textwork/collaborative_draft_access_request_event.rb +27 -0
  109. data/app/events/decidim/enhanced_textwork/collaborative_draft_access_requested_event.rb +8 -0
  110. data/app/events/decidim/enhanced_textwork/collaborative_draft_access_requester_accepted_event.rb +8 -0
  111. data/app/events/decidim/enhanced_textwork/collaborative_draft_access_requester_rejected_event.rb +8 -0
  112. data/app/events/decidim/enhanced_textwork/collaborative_draft_withdrawn_event.rb +29 -0
  113. data/app/events/decidim/enhanced_textwork/creation_enabled_event.rb +8 -0
  114. data/app/events/decidim/enhanced_textwork/endorsing_enabled_event.rb +8 -0
  115. data/app/events/decidim/enhanced_textwork/evaluating_paragraph_event.rb +11 -0
  116. data/app/events/decidim/enhanced_textwork/paragraph_endorsed_event.rb +33 -0
  117. data/app/events/decidim/enhanced_textwork/paragraph_mentioned_event.rb +21 -0
  118. data/app/events/decidim/enhanced_textwork/publish_paragraph_event.rb +25 -0
  119. data/app/events/decidim/enhanced_textwork/rejected_paragraph_event.rb +17 -0
  120. data/app/events/decidim/enhanced_textwork/voting_enabled_event.rb +8 -0
  121. data/app/forms/decidim/enhanced_textwork/accept_access_to_collaborative_draft_form.rb +10 -0
  122. data/app/forms/decidim/enhanced_textwork/access_to_collaborative_draft_form.rb +33 -0
  123. data/app/forms/decidim/enhanced_textwork/admin/import_editor_participatory_text_form.rb +35 -0
  124. data/app/forms/decidim/enhanced_textwork/admin/import_participatory_text_form.rb +68 -0
  125. data/app/forms/decidim/enhanced_textwork/admin/paragraph_answer_form.rb +44 -0
  126. data/app/forms/decidim/enhanced_textwork/admin/paragraph_base_form.rb +137 -0
  127. data/app/forms/decidim/enhanced_textwork/admin/paragraph_form.rb +32 -0
  128. data/app/forms/decidim/enhanced_textwork/admin/paragraph_note_form.rb +16 -0
  129. data/app/forms/decidim/enhanced_textwork/admin/paragraphs_fork_form.rb +63 -0
  130. data/app/forms/decidim/enhanced_textwork/admin/paragraphs_import_form.rb +67 -0
  131. data/app/forms/decidim/enhanced_textwork/admin/paragraphs_merge_form.rb +13 -0
  132. data/app/forms/decidim/enhanced_textwork/admin/paragraphs_split_form.rb +12 -0
  133. data/app/forms/decidim/enhanced_textwork/admin/participatory_text_paragraph_form.rb +20 -0
  134. data/app/forms/decidim/enhanced_textwork/admin/preview_participatory_text_form.rb +21 -0
  135. data/app/forms/decidim/enhanced_textwork/admin/valuation_assignment_form.rb +37 -0
  136. data/app/forms/decidim/enhanced_textwork/collaborative_draft_form.rb +20 -0
  137. data/app/forms/decidim/enhanced_textwork/paragraph_form.rb +126 -0
  138. data/app/forms/decidim/enhanced_textwork/paragraph_wizard_create_step_form.rb +41 -0
  139. data/app/forms/decidim/enhanced_textwork/reject_access_to_collaborative_draft_form.rb +9 -0
  140. data/app/forms/decidim/enhanced_textwork/request_access_to_collaborative_draft_form.rb +20 -0
  141. data/app/helpers/decidim/enhanced_textwork/admin/filterable_helper.rb +17 -0
  142. data/app/helpers/decidim/enhanced_textwork/admin/paragraph_bulk_actions_helper.rb +35 -0
  143. data/app/helpers/decidim/enhanced_textwork/admin/paragraph_rankings_helper.rb +63 -0
  144. data/app/helpers/decidim/enhanced_textwork/admin/paragraphs_helper.rb +144 -0
  145. data/app/helpers/decidim/enhanced_textwork/admin/paragraphs_picker_helper.rb +30 -0
  146. data/app/helpers/decidim/enhanced_textwork/application_helper.rb +191 -0
  147. data/app/helpers/decidim/enhanced_textwork/collaborative_draft_cells_helper.rb +48 -0
  148. data/app/helpers/decidim/enhanced_textwork/collaborative_draft_helper.rb +29 -0
  149. data/app/helpers/decidim/enhanced_textwork/control_version_helper.rb +12 -0
  150. data/app/helpers/decidim/enhanced_textwork/map_helper.rb +48 -0
  151. data/app/helpers/decidim/enhanced_textwork/paragraph_cells_helper.rb +75 -0
  152. data/app/helpers/decidim/enhanced_textwork/paragraph_votes_helper.rb +103 -0
  153. data/app/helpers/decidim/enhanced_textwork/paragraph_wizard_helper.rb +140 -0
  154. data/app/helpers/decidim/enhanced_textwork/paragraphs_helper.rb +63 -0
  155. data/app/helpers/decidim/enhanced_textwork/participatory_texts_helper.rb +49 -0
  156. data/app/jobs/decidim/enhanced_textwork/notify_paragraphs_mentioned_job.rb +27 -0
  157. data/app/jobs/decidim/enhanced_textwork/settings_change_job.rb +50 -0
  158. data/app/models/decidim/enhanced_textwork/application_record.rb +10 -0
  159. data/app/models/decidim/enhanced_textwork/collaborative_draft.rb +73 -0
  160. data/app/models/decidim/enhanced_textwork/collaborative_draft_collaborator_request.rb +13 -0
  161. data/app/models/decidim/enhanced_textwork/paragraph.rb +411 -0
  162. data/app/models/decidim/enhanced_textwork/paragraph_note.rb +20 -0
  163. data/app/models/decidim/enhanced_textwork/paragraph_vote.rb +50 -0
  164. data/app/models/decidim/enhanced_textwork/participatory_text.rb +16 -0
  165. data/app/models/decidim/enhanced_textwork/valuation_assignment.rb +24 -0
  166. data/app/packs/documents/decidim/enhanced_textwork/participatory_texts/participatory_text.md +52 -0
  167. data/app/packs/documents/decidim/enhanced_textwork/participatory_texts/participatory_text.odt +0 -0
  168. data/app/packs/entrypoints/decidim_enhanced_textwork.js +17 -0
  169. data/app/packs/entrypoints/decidim_enhanced_textwork_admin.js +3 -0
  170. data/app/packs/images/decidim/enhanced_textwork/decidim_paragraphs.svg +1 -0
  171. data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_accepted_paragraphs.svg +1 -0
  172. data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_paragraph_votes.svg +1 -0
  173. data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_paragraphs.svg +1 -0
  174. data/app/packs/src/decidim/enhanced_textwork/add_paragraph.js +49 -0
  175. data/app/packs/src/decidim/enhanced_textwork/admin/paragraphs.js +143 -0
  176. data/app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js +29 -0
  177. data/app/packs/src/decidim/enhanced_textwork/admin/paragraphs_picker.js +35 -0
  178. data/app/packs/src/decidim/enhanced_textwork/toggle_element.js +21 -0
  179. data/app/packs/src/decidim/enhanced_textwork/utils.js +11 -0
  180. data/app/packs/stylesheets/decidim/enhanced_textwork/_paragraphs.scss +208 -0
  181. data/app/packs/stylesheets/decidim/enhanced_textwork/paragraphs/_preview.scss +3 -0
  182. data/app/permissions/decidim/enhanced_textwork/admin/permissions.rb +147 -0
  183. data/app/permissions/decidim/enhanced_textwork/permissions.rb +163 -0
  184. data/app/presenters/decidim/enhanced_textwork/admin_log/paragraph_note_presenter.rb +39 -0
  185. data/app/presenters/decidim/enhanced_textwork/admin_log/paragraph_presenter.rb +51 -0
  186. data/app/presenters/decidim/enhanced_textwork/admin_log/valuation_assignment_presenter.rb +51 -0
  187. data/app/presenters/decidim/enhanced_textwork/admin_log/value_types/paragraph_state_presenter.rb +17 -0
  188. data/app/presenters/decidim/enhanced_textwork/admin_log/value_types/paragraph_title_body_presenter.rb +23 -0
  189. data/app/presenters/decidim/enhanced_textwork/admin_log/value_types/valuator_role_user_presenter.rb +19 -0
  190. data/app/presenters/decidim/enhanced_textwork/collaborative_draft_presenter.rb +25 -0
  191. data/app/presenters/decidim/enhanced_textwork/log/resource_presenter.rb +22 -0
  192. data/app/presenters/decidim/enhanced_textwork/log/valuation_assignment_presenter.rb +22 -0
  193. data/app/presenters/decidim/enhanced_textwork/official_author_presenter.rb +14 -0
  194. data/app/presenters/decidim/enhanced_textwork/paragraph_presenter.rb +146 -0
  195. data/app/queries/decidim/enhanced_textwork/filtered_paragraphs.rb +37 -0
  196. data/app/queries/decidim/enhanced_textwork/metrics/accepted_paragraphs_metric_manage.rb +32 -0
  197. data/app/queries/decidim/enhanced_textwork/metrics/endorsements_metric_manage.rb +58 -0
  198. data/app/queries/decidim/enhanced_textwork/metrics/paragraph_followers_metric_measure.rb +58 -0
  199. data/app/queries/decidim/enhanced_textwork/metrics/paragraph_participants_metric_measure.rb +74 -0
  200. data/app/queries/decidim/enhanced_textwork/metrics/paragraphs_metric_manage.rb +48 -0
  201. data/app/queries/decidim/enhanced_textwork/metrics/votes_metric_manage.rb +52 -0
  202. data/app/queries/decidim/enhanced_textwork/similar_paragraphs.rb +67 -0
  203. data/app/services/decidim/enhanced_textwork/collaborative_draft_search.rb +59 -0
  204. data/app/services/decidim/enhanced_textwork/diff_renderer.rb +74 -0
  205. data/app/services/decidim/enhanced_textwork/paragraph_builder.rb +132 -0
  206. data/app/services/decidim/enhanced_textwork/paragraph_search.rb +85 -0
  207. data/app/validators/paragraph_length_validator.rb +40 -0
  208. data/app/views/decidim/enhanced_textwork/admin/paragraph_answers/_form.html.erb +35 -0
  209. data/app/views/decidim/enhanced_textwork/admin/paragraph_notes/_form.html.erb +8 -0
  210. data/app/views/decidim/enhanced_textwork/admin/paragraph_notes/_paragraph_notes.html.erb +45 -0
  211. data/app/views/decidim/enhanced_textwork/admin/paragraphs/_bulk-actions.html.erb +33 -0
  212. data/app/views/decidim/enhanced_textwork/admin/paragraphs/_form.html.erb +101 -0
  213. data/app/views/decidim/enhanced_textwork/admin/paragraphs/_js-callout.html.erb +6 -0
  214. data/app/views/decidim/enhanced_textwork/admin/paragraphs/_paragraph-tr.html.erb +76 -0
  215. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_assign_to_valuator.html.erb +15 -0
  216. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_dropdown.html.erb +56 -0
  217. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_merge.html.erb +15 -0
  218. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_publish_answers.html.erb +14 -0
  219. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_recategorize.html.erb +15 -0
  220. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_scope-change.html.erb +25 -0
  221. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_split.html.erb +15 -0
  222. data/app/views/decidim/enhanced_textwork/admin/paragraphs/bulk_actions/_unassign_from_valuator.html.erb +15 -0
  223. data/app/views/decidim/enhanced_textwork/admin/paragraphs/edit.html.erb +7 -0
  224. data/app/views/decidim/enhanced_textwork/admin/paragraphs/index.html.erb +84 -0
  225. data/app/views/decidim/enhanced_textwork/admin/paragraphs/new.html.erb +7 -0
  226. data/app/views/decidim/enhanced_textwork/admin/paragraphs/publish_answers.js.erb +12 -0
  227. data/app/views/decidim/enhanced_textwork/admin/paragraphs/show.html.erb +186 -0
  228. data/app/views/decidim/enhanced_textwork/admin/paragraphs/update_category.js.erb +26 -0
  229. data/app/views/decidim/enhanced_textwork/admin/paragraphs/update_scope.js.erb +27 -0
  230. data/app/views/decidim/enhanced_textwork/admin/paragraphs_imports/new.html.erb +37 -0
  231. data/app/views/decidim/enhanced_textwork/admin/participatory_texts/_article-preview.html.erb +16 -0
  232. data/app/views/decidim/enhanced_textwork/admin/participatory_texts/_bulk-actions.html.erb +3 -0
  233. data/app/views/decidim/enhanced_textwork/admin/participatory_texts/index.html.erb +55 -0
  234. data/app/views/decidim/enhanced_textwork/admin/participatory_texts/new_editor.html.erb +39 -0
  235. data/app/views/decidim/enhanced_textwork/admin/participatory_texts/new_import.html.erb +39 -0
  236. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_accept_request_access_form.html.erb +8 -0
  237. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_collaborative_drafts.html.erb +16 -0
  238. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_collaborator_requests.html.erb +20 -0
  239. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_count.html.erb +1 -0
  240. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_edit_form_fields.html.erb +83 -0
  241. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_filters.html.erb +32 -0
  242. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_filters_small_view.html.erb +18 -0
  243. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_new_collaborative_draft_button.html.erb +11 -0
  244. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_reject_request_access_form.html.erb +10 -0
  245. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_request_access_form.html.erb +7 -0
  246. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_wizard_aside.html.erb +13 -0
  247. data/app/views/decidim/enhanced_textwork/collaborative_drafts/_wizard_header.html.erb +14 -0
  248. data/app/views/decidim/enhanced_textwork/collaborative_drafts/edit.html.erb +31 -0
  249. data/app/views/decidim/enhanced_textwork/collaborative_drafts/index.html.erb +23 -0
  250. data/app/views/decidim/enhanced_textwork/collaborative_drafts/index.js.erb +10 -0
  251. data/app/views/decidim/enhanced_textwork/collaborative_drafts/new.html.erb +24 -0
  252. data/app/views/decidim/enhanced_textwork/collaborative_drafts/show.html.erb +128 -0
  253. data/app/views/decidim/enhanced_textwork/paragraph_votes/update_buttons_and_counters.js.erb +41 -0
  254. data/app/views/decidim/enhanced_textwork/paragraphs/_count.html.erb +1 -0
  255. data/app/views/decidim/enhanced_textwork/paragraphs/_dynamic_map_instructions.html.erb +4 -0
  256. data/app/views/decidim/enhanced_textwork/paragraphs/_edit_form_fields.html.erb +115 -0
  257. data/app/views/decidim/enhanced_textwork/paragraphs/_endorsements_card_row.html.erb +0 -0
  258. data/app/views/decidim/enhanced_textwork/paragraphs/_filters.html.erb +48 -0
  259. data/app/views/decidim/enhanced_textwork/paragraphs/_filters_small_view.html.erb +18 -0
  260. data/app/views/decidim/enhanced_textwork/paragraphs/_linked_paragraphs.html.erb +34 -0
  261. data/app/views/decidim/enhanced_textwork/paragraphs/_paragraph.html.erb +1 -0
  262. data/app/views/decidim/enhanced_textwork/paragraphs/_paragraph_badge.html.erb +3 -0
  263. data/app/views/decidim/enhanced_textwork/paragraphs/_paragraph_similar.html.erb +22 -0
  264. data/app/views/decidim/enhanced_textwork/paragraphs/_paragraphs.html.erb +46 -0
  265. data/app/views/decidim/enhanced_textwork/paragraphs/_remaining_votes_count.html.erb +3 -0
  266. data/app/views/decidim/enhanced_textwork/paragraphs/_vote_button.html.erb +61 -0
  267. data/app/views/decidim/enhanced_textwork/paragraphs/_votes_count.html.erb +18 -0
  268. data/app/views/decidim/enhanced_textwork/paragraphs/_voting_rules.html.erb +50 -0
  269. data/app/views/decidim/enhanced_textwork/paragraphs/_wizard_aside.html.erb +20 -0
  270. data/app/views/decidim/enhanced_textwork/paragraphs/_wizard_header.html.erb +42 -0
  271. data/app/views/decidim/enhanced_textwork/paragraphs/compare.html.erb +23 -0
  272. data/app/views/decidim/enhanced_textwork/paragraphs/complete.html.erb +24 -0
  273. data/app/views/decidim/enhanced_textwork/paragraphs/edit.html.erb +31 -0
  274. data/app/views/decidim/enhanced_textwork/paragraphs/edit_draft.html.erb +26 -0
  275. data/app/views/decidim/enhanced_textwork/paragraphs/index.html.erb +56 -0
  276. data/app/views/decidim/enhanced_textwork/paragraphs/index.js.erb +10 -0
  277. data/app/views/decidim/enhanced_textwork/paragraphs/new.html.erb +38 -0
  278. data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_index.html.erb +20 -0
  279. data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_overview.html.erb +35 -0
  280. data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_paragraph_vote_button.html.erb +53 -0
  281. data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_paragraph_vote_button_chevron.html.erb +72 -0
  282. data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_paragraph_votes_count.html.erb +41 -0
  283. data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/_view_index.html.erb +10 -0
  284. data/app/views/decidim/enhanced_textwork/paragraphs/participatory_texts/participatory_text.html.erb +29 -0
  285. data/app/views/decidim/enhanced_textwork/paragraphs/preview.html.erb +41 -0
  286. data/app/views/decidim/enhanced_textwork/paragraphs/show.html.erb +143 -0
  287. data/app/views/decidim/enhanced_textwork/versions/index.html.erb +16 -0
  288. data/app/views/decidim/enhanced_textwork/versions/show.html.erb +18 -0
  289. data/config/assets.rb +10 -0
  290. data/config/locales/de.yml +927 -0
  291. data/config/locales/en.yml +967 -0
  292. data/config/locales/todo/am-ET.yml +1 -0
  293. data/config/locales/todo/ar-SA.yml +801 -0
  294. data/config/locales/todo/ar.yml +791 -0
  295. data/config/locales/todo/bg-BG.yml +237 -0
  296. data/config/locales/todo/bg.yml +238 -0
  297. data/config/locales/todo/ca.yml +908 -0
  298. data/config/locales/todo/cs-CZ.yml +787 -0
  299. data/config/locales/todo/cs.yml +969 -0
  300. data/config/locales/todo/da-DK.yml +1 -0
  301. data/config/locales/todo/da.yml +1 -0
  302. data/config/locales/todo/el-GR.yml +1 -0
  303. data/config/locales/todo/el.yml +848 -0
  304. data/config/locales/todo/eo-UY.yml +1 -0
  305. data/config/locales/todo/eo.yml +1 -0
  306. data/config/locales/todo/es-MX.yml +908 -0
  307. data/config/locales/todo/es-PY.yml +908 -0
  308. data/config/locales/todo/es.yml +908 -0
  309. data/config/locales/todo/et-EE.yml +1 -0
  310. data/config/locales/todo/et.yml +1 -0
  311. data/config/locales/todo/eu.yml +717 -0
  312. data/config/locales/todo/fi-pl.yml +763 -0
  313. data/config/locales/todo/fi-plain.yml +920 -0
  314. data/config/locales/todo/fi.yml +920 -0
  315. data/config/locales/todo/fr-CA.yml +936 -0
  316. data/config/locales/todo/fr-LU.yml +903 -0
  317. data/config/locales/todo/fr.yml +936 -0
  318. data/config/locales/todo/ga-IE.yml +275 -0
  319. data/config/locales/todo/gl.yml +808 -0
  320. data/config/locales/todo/hr-HR.yml +1 -0
  321. data/config/locales/todo/hr.yml +1 -0
  322. data/config/locales/todo/hu.yml +847 -0
  323. data/config/locales/todo/id-ID.yml +704 -0
  324. data/config/locales/todo/is-IS.yml +269 -0
  325. data/config/locales/todo/is.yml +274 -0
  326. data/config/locales/todo/it.yml +908 -0
  327. data/config/locales/todo/ja.yml +922 -0
  328. data/config/locales/todo/ko-KR.yml +1 -0
  329. data/config/locales/todo/ko.yml +1 -0
  330. data/config/locales/todo/lb-LU.yml +1 -0
  331. data/config/locales/todo/lb.yml +40 -0
  332. data/config/locales/todo/lt-LT.yml +1 -0
  333. data/config/locales/todo/lt.yml +1 -0
  334. data/config/locales/todo/lv.yml +838 -0
  335. data/config/locales/todo/mt-MT.yml +1 -0
  336. data/config/locales/todo/mt.yml +1 -0
  337. data/config/locales/todo/nl.yml +882 -0
  338. data/config/locales/todo/no.yml +770 -0
  339. data/config/locales/todo/om-ET.yml +1 -0
  340. data/config/locales/todo/pl.yml +927 -0
  341. data/config/locales/todo/pt-BR.yml +908 -0
  342. data/config/locales/todo/pt.yml +945 -0
  343. data/config/locales/todo/ro-RO.yml +886 -0
  344. data/config/locales/todo/ru.yml +379 -0
  345. data/config/locales/todo/si-LK.yml +1 -0
  346. data/config/locales/todo/sk-SK.yml +896 -0
  347. data/config/locales/todo/sk.yml +851 -0
  348. data/config/locales/todo/sl.yml +26 -0
  349. data/config/locales/todo/so-SO.yml +1 -0
  350. data/config/locales/todo/sr-CS.yml +125 -0
  351. data/config/locales/todo/sv.yml +908 -0
  352. data/config/locales/todo/sw-KE.yml +1 -0
  353. data/config/locales/todo/ti-ER.yml +1 -0
  354. data/config/locales/todo/tr-TR.yml +890 -0
  355. data/config/locales/todo/uk.yml +379 -0
  356. data/config/locales/todo/vi-VN.yml +1 -0
  357. data/config/locales/todo/vi.yml +1 -0
  358. data/config/locales/todo/zh-CN.yml +857 -0
  359. data/config/locales/todo/zh-TW.yml +1 -0
  360. data/db/migrate/20161212110850_create_decidim_paragraphs.rb +16 -0
  361. data/db/migrate/20170112115253_create_paragraph_votes.rb +14 -0
  362. data/db/migrate/20170113114245_add_enhanced_textwork_text_search_indexes.rb +8 -0
  363. data/db/migrate/20170118120151_add_counter_cache_votes_to_paragraphs.rb +7 -0
  364. data/db/migrate/20170120151202_add_user_group_id_to_paragraphs.rb +7 -0
  365. data/db/migrate/20170131092413_add_answers_to_paragraphs.rb +9 -0
  366. data/db/migrate/20170205082832_add_index_to_decidim_enhanced_textwork_paragraphs_paragraph_votes_count.rb +9 -0
  367. data/db/migrate/20170215113152_create_paragraph_reports.rb +16 -0
  368. data/db/migrate/20170215131720_add_report_count_to_paragraphs.rb +7 -0
  369. data/db/migrate/20170215132030_add_reference_to_paragraphs.rb +13 -0
  370. data/db/migrate/20170220152416_add_hidden_at_to_paragraphs.rb +7 -0
  371. data/db/migrate/20170228105156_add_geolocalization_fields_to_paragraphs.rb +9 -0
  372. data/db/migrate/20170307085300_migrate_paragraph_reports_data_to_reports.rb +24 -0
  373. data/db/migrate/20170410073742_remove_not_null_reference_paragraphs.rb +7 -0
  374. data/db/migrate/20170612101809_migrate_paragraphs_category.rb +15 -0
  375. data/db/migrate/20171201115434_create_paragraph_endorsements.rb +16 -0
  376. data/db/migrate/20171201122623_add_counter_cache_endorsements_to_paragraphs.rb +8 -0
  377. data/db/migrate/20171212102250_enable_pg_trgm_extension_for_paragraphs.rb +18 -0
  378. data/db/migrate/20171220084719_add_published_at_to_paragraphs.rb +14 -0
  379. data/db/migrate/20180111110204_create_decidim_paragraph_notes.rb +15 -0
  380. data/db/migrate/20180115155220_add_index_created_at_paragraph_notes.rb +7 -0
  381. data/db/migrate/20180305133811_rename_features_to_components_at_paragraphs.rb +11 -0
  382. data/db/migrate/20180326091532_create_decidim_enhanced_textwork_collaborative_drafts.rb +29 -0
  383. data/db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb +18 -0
  384. data/db/migrate/20180529101323_add_counter_cache_coauthorships_to_paragraphs.rb +8 -0
  385. data/db/migrate/20180529110230_move_enhanced_textwork_authorships_to_coauthorships.rb +28 -0
  386. data/db/migrate/20180529110830_remove_authorships_from_paragraphs.rb +8 -0
  387. data/db/migrate/20180613151121_create_enhanced_textwork_collaborative_draft_collaborator_requests.rb +12 -0
  388. data/db/migrate/20180711074134_add_enhanced_textwork_counter_cache_coauthorships_to_collaborative_drafts.rb +7 -0
  389. data/db/migrate/20180711075004_remove_index_counter_cache_coauthorships_to_paragraphs.rb +7 -0
  390. data/db/migrate/20180927111721_create_enhanced_textwork_participatory_texts.rb +13 -0
  391. data/db/migrate/20180930125321_add_participatory_text_level_to_paragraphs.rb +7 -0
  392. data/db/migrate/20180930125321_add_position_to_paragraphs.rb +7 -0
  393. data/db/migrate/20181003074440_fix_user_groups_ids_in_paragraphs_endorsements.rb +20 -0
  394. data/db/migrate/20181010114622_add_enhanced_textwork_temporary_votes.rb +9 -0
  395. data/db/migrate/20181016132225_add_enhanced_textwork_organization_as_author.rb +13 -0
  396. data/db/migrate/20181017084221_make_author_polymorhpic_for_paragraph_endorsements.rb +31 -0
  397. data/db/migrate/20181026073215_add_enhanced_textwork_created_in_meeting.rb +7 -0
  398. data/db/migrate/20190215113158_use_enhanced_textwork_md5_indexes.rb +17 -0
  399. data/db/migrate/20191206154128_add_endorsements_counter_cache_to_paragraphs.rb +7 -0
  400. data/db/migrate/20200120215928_move_paragraph_endorsements_to_core_endorsements.rb +54 -0
  401. data/db/migrate/20200120230130_drop_paragraph_endorsements.rb +8 -0
  402. data/db/migrate/20200203111239_add_paragraph_valuation_assignments.rb +12 -0
  403. data/db/migrate/20200210135152_add_costs_to_paragraphs.rb +9 -0
  404. data/db/migrate/20200212120110_sync_paragraphs_state_with_amendments_state.rb +28 -0
  405. data/db/migrate/20200227175922_add_state_published_at_to_paragraphs.rb +7 -0
  406. data/db/migrate/20200306123652_publish_existing_paragraphs_state.rb +15 -0
  407. data/db/migrate/20200708091228_move_paragraphs_fields_to_i18n.rb +86 -0
  408. data/db/migrate/20200730131631_move_paragraph_endorsed_event_notifications_to_resource_endorsed_event.rb +20 -0
  409. data/db/migrate/20200827154156_add_commentable_counter_cache_to_paragraphs.rb +12 -0
  410. data/db/migrate/20201002085508_fix_paragraphs_data.rb +36 -0
  411. data/db/migrate/20210127115628_fix_answered_paragraphs_after_copy.rb +14 -0
  412. data/db/migrate/20210310102839_add_followable_counter_cache_to_paragraphs.rb +16 -0
  413. data/db/migrate/20210310120812_add_enhanced_textwork_followable_counter_cache_to_collaborative_drafts.rb +16 -0
  414. data/db/migrate/20210318082934_fix_counters_for_copied_paragraphs.rb +19 -0
  415. data/lib/decidim/api/paragraph_input_filter.rb +29 -0
  416. data/lib/decidim/api/paragraph_input_sort.rb +20 -0
  417. data/lib/decidim/api/paragraph_type.rb +56 -0
  418. data/lib/decidim/api/paragraphs_type.rb +43 -0
  419. data/lib/decidim/content_parsers/paragraph_parser.rb +101 -0
  420. data/lib/decidim/content_renderers/paragraph_renderer.rb +33 -0
  421. data/lib/decidim/enhanced_textwork/admin.rb +10 -0
  422. data/lib/decidim/enhanced_textwork/admin_engine.rb +52 -0
  423. data/lib/decidim/enhanced_textwork/api.rb +10 -0
  424. data/lib/decidim/enhanced_textwork/commentable_collaborative_draft.rb +38 -0
  425. data/lib/decidim/enhanced_textwork/commentable_paragraph.rb +36 -0
  426. data/lib/decidim/enhanced_textwork/component.rb +448 -0
  427. data/lib/decidim/enhanced_textwork/doc_to_markdown.rb +50 -0
  428. data/lib/decidim/enhanced_textwork/engine.rb +204 -0
  429. data/lib/decidim/enhanced_textwork/html_to_markdown.rb +22 -0
  430. data/lib/decidim/enhanced_textwork/markdown_to_paragraphs.rb +153 -0
  431. data/lib/decidim/enhanced_textwork/odt_to_markdown.rb +46 -0
  432. data/lib/decidim/enhanced_textwork/paragraph_creator.rb +98 -0
  433. data/lib/decidim/enhanced_textwork/paragraph_serializer.rb +95 -0
  434. data/lib/decidim/enhanced_textwork/participatory_text_section.rb +21 -0
  435. data/lib/decidim/enhanced_textwork/test/capybara_paragraphs_picker.rb +59 -0
  436. data/lib/decidim/enhanced_textwork/test/factories.rb +492 -0
  437. data/lib/decidim/enhanced_textwork/valuatable.rb +21 -0
  438. data/lib/decidim/enhanced_textwork/version.rb +14 -0
  439. data/lib/decidim/enhanced_textwork.rb +58 -0
  440. data/lib/decidim/exporters/word.rb +309 -0
  441. metadata +704 -0
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="paragraphs-svg" width="1080" height="1080" x="0" y="0" enable-background="new 0 0 1080 1080" version="1.1" viewBox="0 0 1080 1080" xml:space="preserve"><g id="paragraphs" class="stroke-primary"><g id="sleeve"><rect id="_x32_5-pct_1_" width="225" height="286" x="437.5" y="798.5" fill="#31536E" fill-opacity=".25" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" class="fill-primary"/><rect width="225" height="192" x="437.5" y="892.5" fill="#31536E" class="fill-primary"/><line x1="469.5" x2="469.5" y1="798.5" y2="876.5" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16"/><line x1="501.5" x2="501.5" y1="798.5" y2="876.5" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16"/><line x1="533.5" x2="533.5" y1="798.5" y2="876.5" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16"/><line x1="565.5" x2="565.5" y1="798.5" y2="876.5" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16"/><line x1="597.5" x2="597.5" y1="798.5" y2="876.5" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16"/><line x1="629.5" x2="629.5" y1="798.5" y2="876.5" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16"/></g><g><g id="hand_1_" fill-opacity=".25" class="fill-primary"><path fill="#31536E" fill-opacity=".1" d="M702.979,523.043l-19.699-3.815l-13.889-22.199L640.001,508.5l-29.808-17.167 l-22.892,9.486l-38.948-10.921l-12.906,15.104l-35.937,6.877c0,0-21.511-9.38-24.181-20.584 c9.166-8.183,25.578-12.414,40.17-24.795c33-28,32-81-4-111c-22,12-156,79-156,79l0,0v74c0,17.992-2.5,41,1.577,65.972 C377.942,619.5,401.5,665,466.031,667.689l-8.531-0.627V798.5h189v-123h-0.105c51.605,0,66.62-94.165,72.562-158.237 L702.979,523.043z" class="fill-primary"/><path fill="#FFF" d="M473.499,373.498c0,0,12.987,26.002,22.994,22.002s32.046-23.229,32.046-23.229L511.5,355.5 L473.499,373.498z"/><path fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M451.324,498.5c0,0,31.176-4,64.176-32s32-81-4-111c-22,12-156,79-156,79l0,0v74c0,17.992-2.5,41,1.577,65.972 C377.942,619.5,401.5,665,466.031,667.689l-8.531-0.627V798.5h189v-123h-0.105c51.605,0,62.62-94.165,68.562-158.237"/><path fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M505.818,513.229c12.682,29.272,13.403,80.272,8.682,102.271"/><path fill="#31536E" fill-opacity=".1" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M468.5,377.5v-11.282c0-28.564,17.923-51.718,42.5-51.718l0,0c24.577,0,44.5,23.154,44.5,51.718v95.564 c0,28.562-19.923,51.718-44.5,51.718l0,0c-17.737,0-26.049-4.979-33.199-22.428c0,0,43.033-21.906,53.699-44.572 c8.476-18.011,18-58.892-20-91C496.188,363.522,468.5,377.5,468.5,377.5z" class="fill-primary"/><path fill="#31536E" fill-opacity=".1" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M548.052,337.583c7.851-8.05,19.034-13.083,31.448-13.083l0,0c23.748,0,43,18.419,43,41.141v94.719 c0,22.721-19.252,41.14-43,41.14l0,0c-11.874,0-22.624-4.605-30.406-12.05" class="fill-primary"/><path fill="#31536E" fill-opacity=".1" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M621.341,356.167c6.171-4.207,13.628-6.667,21.659-6.667l0,0c21.263,0,38.5,17.237,38.5,38.5v81c0,21.263-17.237,38.5-38.5,38.5 l0,0c-13.871,0-26.029-7.336-32.807-18.34" class="fill-primary"/><path fill="#31536E" fill-opacity=".1" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M681.973,386.233c4.827-4.194,9.131-6.733,16.027-6.733l0,0c15.188,0,27.5,12.312,27.5,27.5v89c0,15.188-12.312,27.5-27.5,27.5 l0,0c-15.188,0-27.5-12.312-27.5-27.5" class="fill-primary"/><path id="_x32_5-pct_3_" fill="#31536E" fill-opacity=".25" d="M688,523.5c-15.188,0-27.5-12.312-27.5-27.5l0.008-0.075 C653.52,503.064,643.779,507.5,633,507.5c-13.871,0-26.028-7.336-32.807-18.339c-7.805,7.611-18.669,12.339-30.693,12.339 c-11.874,0-22.624-4.605-30.406-12.051l-0.006-0.91C531.29,503.501,517.15,513.5,501,513.5c-10.683,0-18.826-16-27.386-20.245 c-5.651-2.803-13.74,8.544-14.813,0.817l10,35C475.952,546.521,490.26,623.5,524,623.5c16.15,0,18.094-67.051,18.094-67.051 c7.782,7.443,8.532,23.051,20.406,23.051c12.024,0,29.891-47.729,37.693-55.339C606.972,535.164,619.129,542.5,633,542.5 c10.779,0,20.52-4.436,27.508-11.575L660.5,531c0,15.188,12.312,27.5,27.5,27.5s27.5-12.312,27.5-27.5v-35 C715.5,511.188,703.188,523.5,688,523.5z" class="fill-primary"/><path fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="8" d="M473.499,373.498c0,0,12.987,26.002,22.994,22.002s32.046-23.229,32.046-23.229"/><path fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M542.539,502.5c12.047,5.577,23.875,74.756,22.961,69"/></g></g><path fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M426.638,477.259"/><path fill="#31536E" fill-opacity=".1" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M469.333,369.889V99.028c0-23.58-19.115-42.695-42.695-42.695l0,0c-23.58,0-42.694,19.115-42.694,42.695v320.536" class="fill-primary"/><line x1="404.098" x2="447.455" y1="165.608" y2="165.608" fill="none" stroke="#31536E" stroke-linecap="round" stroke-miterlimit="10" stroke-width="4"/><line x1="404.098" x2="447.455" y1="269.608" y2="269.608" fill="none" stroke="#31536E" stroke-linecap="round" stroke-miterlimit="10" stroke-width="4"/><line x1="404.098" x2="447.455" y1="387.608" y2="387.608" fill="none" stroke="#31536E" stroke-linecap="round" stroke-miterlimit="10" stroke-width="4"/><path fill="#FFF" d="M1404.5,687.5"/><g id="stars_2" class="stars"><path fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4" d="M137.5,645.605c0-14.688-18.667-35.354-35.355-35.354c15.355,0,35.355-20.333,35.355-35.354c0,15.021,16.666,35.354,35.355,35.354 C153.833,610.251,137.5,630.918,137.5,645.605z"/><g><circle cx="1008.882" cy="708.662" r="13.5" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="992.383" x2="971.17" y1="691.927" y2="670.714" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="1026.324" x2="1047.537" y1="725.868" y2="747.081" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="1025.617" x2="1046.83" y1="692.634" y2="671.421" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="992.383" x2="971.17" y1="725.868" y2="747.081" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="212.112" x2="185.95" y1="161.345" y2="187.508" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="176.758" x2="150.595" y1="196.701" y2="222.864" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="211.405" x2="185.242" y1="222.864" y2="196.701" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="176.051" x2="149.888" y1="187.508" y2="161.345" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><path fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4" d="M833.092,333.86c0,0-24.604,4.603-30.25,10.249c-5.646,5.646-10.248,30.249-10.248,30.249s-4.604-24.603-10.25-30.249 c-5.646-5.646-30.248-10.249-30.248-10.249s25.188-5.187,30.248-10.249c5.062-5.062,10.25-30.249,10.25-30.249 s4.604,24.603,10.248,30.249C808.488,329.257,833.092,333.86,833.092,333.86z"/><g><circle cx="978.834" cy="500.751" r="18.5" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="938.834" cy="500.751" r="7.166" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="978.834" cy="540.751" r="7.166" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="1018.834" cy="500.751" r="7.166" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="978.834" cy="460.751" r="7.166" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="296.246" x2="351.149" y1="682.224" y2="737.129" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="351.149" x2="296.246" y1="682.224" y2="737.129" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="305.5" x2="278.5" y1="709.251" y2="709.251" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="343.5" x2="370.5" y1="709.251" y2="709.251" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="324.5" x2="324.5" y1="728.251" y2="755.251" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="324.5" x2="324.5" y1="690.251" y2="663.251" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="629.5" x2="629.5" y1="122.251" y2="201.251" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="668.5" x2="589.5" y1="162.251" y2="162.251" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="609.5" cy="181.751" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="609.5" cy="141.751" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="649.5" cy="181.751" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="649.5" cy="141.751" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g></g></g></svg>
@@ -0,0 +1,49 @@
1
+ import attachGeocoding from "src/decidim/geocoding/attach_input"
2
+ import getCoordinateInputName from "src/decidim/geocoding/coordinate_input";
3
+
4
+ $(() => {
5
+ const $checkbox = $("input:checkbox[name$='[has_address]']");
6
+ const $addressInput = $("#address_input");
7
+ const $addressInputField = $("input", $addressInput);
8
+ const $map = $("#address_map");
9
+ const latFieldName = getCoordinateInputName("latitude", $addressInputField, {})
10
+ const longFieldName = getCoordinateInputName("longitude", $addressInputField, {})
11
+ $map.hide();
12
+
13
+ if ($checkbox.length > 0) {
14
+ const toggleInput = () => {
15
+ if ($checkbox[0].checked) {
16
+ $addressInput.show();
17
+ $addressInputField.prop("disabled", false);
18
+ } else {
19
+ $addressInput.hide();
20
+ $addressInputField.prop("disabled", true);
21
+ }
22
+ }
23
+ toggleInput();
24
+ $checkbox.on("change", toggleInput);
25
+ }
26
+
27
+ if ($addressInput.length > 0) {
28
+ if ($checkbox[0].checked) {
29
+ $map.show();
30
+ }
31
+
32
+ const ctrl = $("[data-decidim-map]").data("map-controller");
33
+ ctrl.setEventHandler("coordinates", (ev) => {
34
+ $(`input[name='${latFieldName}']`).val(ev.lat);
35
+ $(`input[name='${longFieldName}']`).val(ev.lng);
36
+ });
37
+
38
+ attachGeocoding($addressInputField, null, (coordinates) => {
39
+ $map.show();
40
+ // Remove previous marker when user updates address in address field
41
+ ctrl.removeMarker();
42
+ ctrl.addMarker({
43
+ latitude: coordinates[0],
44
+ longitude: coordinates[1],
45
+ address: $addressInput.val()
46
+ });
47
+ });
48
+ }
49
+ });
@@ -0,0 +1,143 @@
1
+ /* eslint-disable no-invalid-this */
2
+ /* eslint no-unused-vars: 0 */
3
+ /* eslint id-length: ["error", { "exceptions": ["e"] }] */
4
+
5
+ $(() => {
6
+ const selectedParagraphsCount = function() {
7
+ return $(".table-list .js-check-all-paragraph:checked").length
8
+ }
9
+
10
+ const selectedParagraphsNotPublishedAnswerCount = function() {
11
+ return $(".table-list [data-published-state=false] .js-check-all-paragraph:checked").length
12
+ }
13
+
14
+ const selectedParagraphsCountUpdate = function() {
15
+ const selectedParagraphs = selectedParagraphsCount();
16
+ const selectedParagraphsNotPublishedAnswer = selectedParagraphsNotPublishedAnswerCount();
17
+ if (selectedParagraphs === 0) {
18
+ $("#js-selected-paragraphs-count").text("")
19
+ } else {
20
+ $("#js-selected-paragraphs-count").text(selectedParagraphs);
21
+ }
22
+
23
+ if (selectedParagraphs >= 2) {
24
+ $('button[data-action="merge-paragraphs"]').parent().show();
25
+ } else {
26
+ $('button[data-action="merge-paragraphs"]').parent().hide();
27
+ }
28
+
29
+ if (selectedParagraphsNotPublishedAnswer > 0) {
30
+ $('button[data-action="publish-answers"]').parent().show();
31
+ $("#js-form-publish-answers-number").text(selectedParagraphsNotPublishedAnswer);
32
+ } else {
33
+ $('button[data-action="publish-answers"]').parent().hide();
34
+ }
35
+ }
36
+
37
+ const showBulkActionsButton = function() {
38
+ if (selectedParagraphsCount() > 0) {
39
+ $("#js-bulk-actions-button").removeClass("hide");
40
+ }
41
+ }
42
+
43
+ const hideBulkActionsButton = function(force = false) {
44
+ if (selectedParagraphsCount() === 0 || force === true) {
45
+ $("#js-bulk-actions-button").addClass("hide");
46
+ $("#js-bulk-actions-dropdown").removeClass("is-open");
47
+ }
48
+ }
49
+
50
+ const showOtherActionsButtons = function() {
51
+ $("#js-other-actions-wrapper").removeClass("hide");
52
+ }
53
+
54
+ const hideOtherActionsButtons = function() {
55
+ $("#js-other-actions-wrapper").addClass("hide");
56
+ }
57
+
58
+ const hideBulkActionForms = function() {
59
+ $(".js-bulk-action-form").addClass("hide");
60
+ }
61
+
62
+ // Expose functions to make them avaialble in .js.erb templates
63
+ window.selectedParagraphsCount = selectedParagraphsCount;
64
+ window.selectedParagraphsNotPublishedAnswerCount = selectedParagraphsNotPublishedAnswerCount;
65
+ window.selectedParagraphsCountUpdate = selectedParagraphsCountUpdate;
66
+ window.showBulkActionsButton = showBulkActionsButton;
67
+ window.hideBulkActionsButton = hideBulkActionsButton;
68
+ window.showOtherActionsButtons = showOtherActionsButtons;
69
+ window.hideOtherActionsButtons = hideOtherActionsButtons;
70
+ window.hideBulkActionForms = hideBulkActionForms;
71
+
72
+ if ($(".js-bulk-action-form").length) {
73
+ hideBulkActionForms();
74
+ $("#js-bulk-actions-button").addClass("hide");
75
+
76
+ $("#js-bulk-actions-dropdown ul li button").click(function(e) {
77
+ e.preventDefault();
78
+ let action = $(e.target).data("action");
79
+
80
+ if (action) {
81
+ $(`#js-form-${action}`).submit(function() {
82
+ $(".layout-content > .callout-wrapper").html("");
83
+ })
84
+
85
+ $(`#js-${action}-actions`).removeClass("hide");
86
+ hideBulkActionsButton(true);
87
+ hideOtherActionsButtons();
88
+ }
89
+ })
90
+
91
+ // select all checkboxes
92
+ $(".js-check-all").change(function() {
93
+ $(".js-check-all-paragraph").prop("checked", $(this).prop("checked"));
94
+
95
+ if ($(this).prop("checked")) {
96
+ $(".js-check-all-paragraph").closest("tr").addClass("selected");
97
+ showBulkActionsButton();
98
+ } else {
99
+ $(".js-check-all-paragraph").closest("tr").removeClass("selected");
100
+ hideBulkActionsButton();
101
+ }
102
+
103
+ selectedParagraphsCountUpdate();
104
+ });
105
+
106
+ // paragraph checkbox change
107
+ $(".table-list").on("change", ".js-check-all-paragraph", function (e) {
108
+ let paragraphId = $(this).val()
109
+ let checked = $(this).prop("checked")
110
+
111
+ // uncheck "select all", if one of the listed checkbox item is unchecked
112
+ if ($(this).prop("checked") === false) {
113
+ $(".js-check-all").prop("checked", false);
114
+ }
115
+ // check "select all" if all checkbox paragraphs are checked
116
+ if ($(".js-check-all-paragraph:checked").length === $(".js-check-all-paragraph").length) {
117
+ $(".js-check-all").prop("checked", true);
118
+ showBulkActionsButton();
119
+ }
120
+
121
+ if ($(this).prop("checked")) {
122
+ showBulkActionsButton();
123
+ $(this).closest("tr").addClass("selected");
124
+ } else {
125
+ hideBulkActionsButton();
126
+ $(this).closest("tr").removeClass("selected");
127
+ }
128
+
129
+ if ($(".js-check-all-paragraph:checked").length === 0) {
130
+ hideBulkActionsButton();
131
+ }
132
+
133
+ $(".js-bulk-action-form").find(`.js-paragraph-id-${paragraphId}`).prop("checked", checked);
134
+ selectedParagraphsCountUpdate();
135
+ });
136
+
137
+ $(".js-cancel-bulk-action").on("click", function (e) {
138
+ hideBulkActionForms()
139
+ showBulkActionsButton();
140
+ showOtherActionsButtons();
141
+ });
142
+ }
143
+ });
@@ -0,0 +1,29 @@
1
+ import attachGeocoding from "src/decidim/geocoding/attach_input"
2
+
3
+ $(() => {
4
+ const $form = $(".paragraph_form_admin");
5
+
6
+ if ($form.length > 0) {
7
+ const $paragraphCreatedInMeeting = $form.find("#paragraph_created_in_meeting");
8
+ const $paragraphMeeting = $form.find("#paragraph_meeting");
9
+
10
+ const toggleDisabledHiddenFields = () => {
11
+ const enabledMeeting = $paragraphCreatedInMeeting.prop("checked");
12
+ $paragraphMeeting.find("select").attr("disabled", "disabled");
13
+ $paragraphMeeting.hide();
14
+
15
+ if (enabledMeeting) {
16
+ $paragraphMeeting.find("select").attr("disabled", !enabledMeeting);
17
+ $paragraphMeeting.show();
18
+ }
19
+ };
20
+
21
+ $paragraphCreatedInMeeting.on("change", toggleDisabledHiddenFields);
22
+ toggleDisabledHiddenFields();
23
+
24
+ const $paragraphAddress = $form.find("#paragraph_address");
25
+ if ($paragraphAddress.length !== 0) {
26
+ attachGeocoding($paragraphAddress);
27
+ }
28
+ }
29
+ });
@@ -0,0 +1,35 @@
1
+ $(() => {
2
+ const $content = $(".picker-content"),
3
+ pickerMore = $content.data("picker-more"),
4
+ pickerPath = $content.data("picker-path"),
5
+ toggleNoParagraphs = () => {
6
+ const showNoParagraphs = $("#paragraphs_list li:visible").length === 0
7
+ $("#no_paragraphs").toggle(showNoParagraphs)
8
+ }
9
+
10
+ let jqxhr = null
11
+
12
+ toggleNoParagraphs()
13
+
14
+ $(".data_picker-modal-content").on("change keyup", "#paragraphs_filter", (event) => {
15
+ const filter = event.target.value.toLowerCase()
16
+
17
+ if (pickerMore) {
18
+ if (jqxhr !== null) {
19
+ jqxhr.abort()
20
+ }
21
+
22
+ $content.html("<div class='loading-spinner'></div>")
23
+ jqxhr = $.get(`${pickerPath}?q=${filter}`, (data) => {
24
+ $content.html(data)
25
+ jqxhr = null
26
+ toggleNoParagraphs()
27
+ })
28
+ } else {
29
+ $("#paragraphs_list li").each((index, li) => {
30
+ $(li).toggle(li.textContent.toLowerCase().indexOf(filter) > -1)
31
+ })
32
+ toggleNoParagraphs()
33
+ }
34
+ })
35
+ })
@@ -0,0 +1,21 @@
1
+ $(() => {
2
+ const $showButton = $("[data-toggle='show']")
3
+ const $hideButton = $("[data-toggle='hide']")
4
+ const $toggleElements = $(".toggle--hidden:not(button)")
5
+
6
+ $showButton.on("click", (e) => {
7
+ e.preventDefault()
8
+ $toggleElements.removeClass("toggle--hidden")
9
+
10
+ $hideButton.removeClass("toggle--hidden")
11
+ $(e.target).addClass("toggle--hidden")
12
+ })
13
+
14
+ $hideButton.on("click", (e) => {
15
+ e.preventDefault()
16
+ $toggleElements.addClass("toggle--hidden")
17
+
18
+ $showButton.removeClass("toggle--hidden")
19
+ $(e.target).addClass("toggle--hidden")
20
+ })
21
+ });
@@ -0,0 +1,11 @@
1
+ /* eslint-disable no-invalid-this */
2
+
3
+ $(() => {
4
+ $("#vote_button").mouseover(function () {
5
+ $(this).text($(this).data("replace"));
6
+ });
7
+
8
+ $("#vote_button").mouseout(function () {
9
+ $(this).text($(this).data("original"));
10
+ });
11
+ });
@@ -0,0 +1,208 @@
1
+ @import "stylesheets/decidim/enhanced_textwork/paragraphs/preview";
2
+
3
+ #paragraphs {
4
+ background-color: $white;
5
+ padding: 1.125rem;
6
+ }
7
+
8
+ .paragraphs-overview {
9
+ overflow: unset;
10
+ }
11
+
12
+ .toggle--hidden {
13
+ display: none;
14
+ }
15
+
16
+ .paragraph {
17
+ padding: 1rem;
18
+ border: 1px solid $white;
19
+ border-bottom-color: #f4f4f4;
20
+
21
+ &__back-button {
22
+ display: none;
23
+ }
24
+ &__layout {
25
+ display: flex;
26
+ }
27
+ &__main {
28
+ width: 66.6667%;
29
+ padding-right: 10px;
30
+ }
31
+ &__sidebar {
32
+ width: 33.333%;
33
+ position: sticky;
34
+ top: 0;
35
+ height: 100vh;
36
+ padding: 3rem 0 3rem 10px;
37
+ overflow: scroll;
38
+ scroll-behavior: smooth;
39
+ }
40
+ a {
41
+ color: inherit;
42
+ &:hover {
43
+ text-decoration: none;
44
+ }
45
+ }
46
+ &__actions {
47
+ .right-column {
48
+ display: flex;
49
+ justify-content: space-between;
50
+ }
51
+ a {
52
+ color: $secondary;
53
+ font-weight: 600;
54
+ font-size: .9rem;
55
+ &:hover {
56
+ text-decoration: underline;
57
+ }
58
+ }
59
+ button {
60
+ color: $secondary;
61
+ font-weight: 600;
62
+ font-size: .9rem;
63
+ line-height: 1.5;
64
+ &:hover {
65
+ text-decoration: underline;
66
+ }
67
+ }
68
+ }
69
+
70
+ &__overview {
71
+ h2 {
72
+ fonz-size: 1.625rem;
73
+ }
74
+ h3 {
75
+ font-size: 1.125rem;
76
+ }
77
+ .link {
78
+ font-size: .9rem;
79
+ }
80
+ .amendments, .comments {
81
+ background-color: #f4f4f4;
82
+ padding: 1.125rem;
83
+ }
84
+ .amendments {
85
+ margin-bottom: 1.125rem;
86
+ h3 {
87
+ margin: 0;
88
+ }
89
+ .card {
90
+ margin-bottom: 0;
91
+ margin-top: .5rem;
92
+ }
93
+ }
94
+ .comments__header {
95
+ h3 {
96
+ float: left;
97
+ }
98
+ a {
99
+ float: right;
100
+ font-size: .9rem;
101
+ }
102
+ }
103
+ }
104
+ }
105
+
106
+ .paragraph--active {
107
+ border: 1px solid #3c393b;
108
+ background-color: #f4f4f4;
109
+ border-radius: 4px;
110
+ }
111
+
112
+ .emendation {
113
+ display: flex;
114
+ align-items: baseline;
115
+ justify-content: space-between;
116
+
117
+ .amendment__header {
118
+ padding: 1rem 1rem 0.5rem 1rem;
119
+ }
120
+
121
+ .amendment__author {
122
+ display: flex;
123
+ }
124
+
125
+ .amendment__date {
126
+ font-style: italic;
127
+ color: #9b9b9b;
128
+ font-size: 0.7rem;
129
+ }
130
+
131
+ .amendment__body {
132
+ padding: 0.5rem 1rem;
133
+ }
134
+
135
+ .amendment__actions {
136
+ padding: 0rem 1rem 1rem 1rem;
137
+ font-size: .9rem;
138
+ }
139
+ }
140
+
141
+
142
+ .paragraph__hover-section{
143
+ .paragraph-actions {
144
+ color: #9b9b9b;
145
+ }
146
+
147
+ &:hover{
148
+ .paragraph {
149
+ background-color: #f4f4f4;
150
+ }
151
+
152
+ .paragraph-actions {
153
+ color: #3d393c;
154
+ }
155
+ }
156
+
157
+ .hidden-section{
158
+ display: none;
159
+ }
160
+ }
161
+
162
+ /* Mobile */
163
+
164
+ @media screen and (max-width: 1125px) {
165
+ .paragraph {
166
+ &__layout {
167
+ display: block;
168
+ }
169
+ &__sidebar {
170
+ width: 100%;
171
+ padding: 0;
172
+ overflow: auto;
173
+ height: auto;
174
+ display: none;
175
+ }
176
+ }
177
+ .paragraph__main {
178
+ width: 100%;
179
+ padding: 0;
180
+ }
181
+ .paragraphs-overview {
182
+ .paragraph {
183
+ display: none;
184
+ &__sidebar {
185
+ display: block;
186
+ overflow: auto;
187
+ height: auto;
188
+ }
189
+ &__back-button {
190
+ display: block;
191
+ }
192
+ &--active {
193
+ display: block;
194
+ }
195
+ }
196
+ }
197
+ }
198
+
199
+ @media screen and (max-width: 500px) {
200
+ .paragraph {
201
+ &__actions .right-column {
202
+ flex-direction: column;
203
+ a {
204
+ margin-top: .5rem;
205
+ }
206
+ }
207
+ }
208
+ }
@@ -0,0 +1,3 @@
1
+ .preview--form__hidden{
2
+ display: none;
3
+ }
@@ -0,0 +1,147 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module EnhancedTextwork
5
+ module Admin
6
+ class Permissions < Decidim::DefaultPermissions
7
+ def permissions
8
+ # The public part needs to be implemented yet
9
+ return permission_action if permission_action.scope != :admin
10
+
11
+ # Valuators can only perform these actions
12
+ if user_is_valuator?
13
+ if valuator_assigned_to_paragraph?
14
+ can_create_paragraph_note?
15
+ can_create_paragraph_answer?
16
+ end
17
+ can_export_paragraphs?
18
+ valuator_can_unassign_valuator_from_paragraphs?
19
+
20
+ return permission_action
21
+ end
22
+
23
+ if create_permission_action?
24
+ can_create_paragraph_note?
25
+ can_create_paragraph_from_admin?
26
+ can_create_paragraph_answer?
27
+ end
28
+
29
+ # Admins can only edit official paragraphs if they are within the
30
+ # time limit.
31
+ allow! if permission_action.subject == :paragraph && permission_action.action == :edit && admin_edition_is_available?
32
+
33
+ # Every user allowed by the space can update the category of the paragraph
34
+ allow! if permission_action.subject == :paragraph_category && permission_action.action == :update
35
+
36
+ # Every user allowed by the space can update the scope of the paragraph
37
+ allow! if permission_action.subject == :paragraph_scope && permission_action.action == :update
38
+
39
+ # Every user allowed by the space can import paragraphs from another_component
40
+ allow! if permission_action.subject == :paragraphs && permission_action.action == :import
41
+
42
+ # Every user allowed by the space can export paragraphs
43
+ can_export_paragraphs?
44
+
45
+ # Every user allowed by the space can merge paragraphs to another component
46
+ allow! if permission_action.subject == :paragraphs && permission_action.action == :merge
47
+
48
+ # Every user allowed by the space can split paragraphs to another component
49
+ allow! if permission_action.subject == :paragraphs && permission_action.action == :split
50
+
51
+ # Every user allowed by the space can assign paragraphs to a valuator
52
+ allow! if permission_action.subject == :paragraphs && permission_action.action == :assign_to_valuator
53
+
54
+ # Every user allowed by the space can unassign a valuator from paragraphs
55
+ can_unassign_valuator_from_paragraphs?
56
+
57
+ # Only admin users can publish many answers at once
58
+ toggle_allow(user.admin?) if permission_action.subject == :paragraphs && permission_action.action == :publish_answers
59
+
60
+ if permission_action.subject == :participatory_texts && participatory_texts_are_enabled? && permission_action.action == :manage
61
+ # Every user allowed by the space can manage (import, update and publish) participatory texts to paragraphs
62
+ allow!
63
+ end
64
+
65
+ permission_action
66
+ end
67
+
68
+ private
69
+
70
+ def paragraph
71
+ @paragraph ||= context.fetch(:paragraph, nil)
72
+ end
73
+
74
+ def user_valuator_role
75
+ @user_valuator_role ||= space.user_roles(:valuator).find_by(user: user)
76
+ end
77
+
78
+ def user_is_valuator?
79
+ return if user.admin?
80
+
81
+ user_valuator_role.present?
82
+ end
83
+
84
+ def valuator_assigned_to_paragraph?
85
+ @valuator_assigned_to_paragraph ||=
86
+ Decidim::EnhancedTextwork::ValuationAssignment
87
+ .where(paragraph: paragraph, valuator_role: user_valuator_role)
88
+ .any?
89
+ end
90
+
91
+ def admin_creation_is_enabled?
92
+ current_settings.try(:creation_enabled?) &&
93
+ component_settings.try(:official_paragraphs_enabled)
94
+ end
95
+
96
+ def admin_edition_is_available?
97
+ return unless paragraph
98
+
99
+ (paragraph.official? || paragraph.official_meeting?) && paragraph.votes.empty?
100
+ end
101
+
102
+ def admin_paragraph_answering_is_enabled?
103
+ current_settings.try(:paragraph_answering_enabled) &&
104
+ component_settings.try(:paragraph_answering_enabled)
105
+ end
106
+
107
+ def create_permission_action?
108
+ permission_action.action == :create
109
+ end
110
+
111
+ def participatory_texts_are_enabled?
112
+ component_settings.participatory_texts_enabled?
113
+ end
114
+
115
+ # There's no special condition to create paragraph notes, only
116
+ # users with access to the admin section can do it.
117
+ def can_create_paragraph_note?
118
+ allow! if permission_action.subject == :paragraph_note
119
+ end
120
+
121
+ # Paragraphs can only be created from the admin when the
122
+ # corresponding setting is enabled.
123
+ def can_create_paragraph_from_admin?
124
+ toggle_allow(admin_creation_is_enabled?) if permission_action.subject == :paragraph
125
+ end
126
+
127
+ # Paragraphs can only be answered from the admin when the
128
+ # corresponding setting is enabled.
129
+ def can_create_paragraph_answer?
130
+ toggle_allow(admin_paragraph_answering_is_enabled?) if permission_action.subject == :paragraph_answer
131
+ end
132
+
133
+ def can_unassign_valuator_from_paragraphs?
134
+ allow! if permission_action.subject == :paragraphs && permission_action.action == :unassign_from_valuator
135
+ end
136
+
137
+ def valuator_can_unassign_valuator_from_paragraphs?
138
+ can_unassign_valuator_from_paragraphs? if user == context.fetch(:valuator, nil)
139
+ end
140
+
141
+ def can_export_paragraphs?
142
+ allow! if permission_action.subject == :paragraphs && permission_action.action == :export
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end