decidim-proposals 0.29.2 → 0.30.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +1 -1
  3. data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +1 -1
  4. data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +1 -1
  5. data/app/cells/decidim/proposals/proposal_g/show.erb +13 -0
  6. data/app/cells/decidim/proposals/proposal_g_cell.rb +13 -0
  7. data/app/cells/decidim/proposals/proposal_history_cell.rb +107 -0
  8. data/app/cells/decidim/proposals/proposal_l/show.erb +37 -0
  9. data/app/cells/decidim/proposals/proposal_l_cell.rb +9 -0
  10. data/app/cells/decidim/proposals/proposal_metadata_cell.rb +2 -2
  11. data/app/cells/decidim/proposals/proposal_vote/show.erb +75 -0
  12. data/app/cells/decidim/proposals/proposal_vote_cell.rb +43 -0
  13. data/app/commands/decidim/proposals/accept_coauthorship.rb +62 -0
  14. data/app/commands/decidim/proposals/admin/assign_proposals_to_valuator.rb +14 -0
  15. data/app/commands/decidim/proposals/admin/create_proposal.rb +6 -14
  16. data/app/commands/decidim/proposals/admin/create_proposal_note.rb +20 -11
  17. data/app/commands/decidim/proposals/admin/import_proposals.rb +0 -5
  18. data/app/commands/decidim/proposals/admin/merge_proposals.rb +2 -2
  19. data/app/commands/decidim/proposals/admin/proposal_notes_methods.rb +48 -0
  20. data/app/commands/decidim/proposals/admin/reply_proposal_note.rb +92 -0
  21. data/app/commands/decidim/proposals/admin/split_proposals.rb +2 -2
  22. data/app/commands/decidim/proposals/admin/update_proposal.rb +10 -16
  23. data/app/commands/decidim/proposals/admin/update_proposal_taxonomies.rb +34 -0
  24. data/app/commands/decidim/proposals/cancel_coauthorship.rb +32 -0
  25. data/app/commands/decidim/proposals/create_collaborative_draft.rb +1 -2
  26. data/app/commands/decidim/proposals/create_proposal.rb +1 -2
  27. data/app/commands/decidim/proposals/invite_coauthor.rb +45 -0
  28. data/app/commands/decidim/proposals/publish_collaborative_draft.rb +1 -2
  29. data/app/commands/decidim/proposals/reject_coauthorship.rb +54 -0
  30. data/app/commands/decidim/proposals/update_collaborative_draft.rb +1 -2
  31. data/app/commands/decidim/proposals/update_proposal.rb +1 -2
  32. data/app/controllers/concerns/decidim/proposals/admin/filterable.rb +5 -1
  33. data/app/controllers/concerns/decidim/proposals/admin/needs_interpolations.rb +40 -0
  34. data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +50 -2
  35. data/app/controllers/decidim/proposals/admin/proposal_notes_controller.rb +18 -0
  36. data/app/controllers/decidim/proposals/admin/proposals_controller.rb +41 -85
  37. data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +2 -4
  38. data/app/controllers/decidim/proposals/invite_coauthors_controller.rb +87 -0
  39. data/app/controllers/decidim/proposals/proposals_controller.rb +7 -32
  40. data/app/events/decidim/proposals/accepted_coauthorship_event.rb +8 -0
  41. data/app/events/decidim/proposals/admin/proposal_assigned_to_valuator_event.rb +27 -0
  42. data/app/events/decidim/proposals/admin/proposal_note_created_event.rb +5 -0
  43. data/app/events/decidim/proposals/coauthor_accepted_invite_event.rb +49 -0
  44. data/app/events/decidim/proposals/coauthor_invited_event.rb +45 -0
  45. data/app/events/decidim/proposals/coauthor_rejected_invite_event.rb +8 -0
  46. data/app/events/decidim/proposals/rejected_coauthorship_event.rb +8 -0
  47. data/app/events/decidim/proposals/update_proposal_taxonomies_event.rb +9 -0
  48. data/app/forms/decidim/proposals/admin/proposal_answer_form.rb +1 -0
  49. data/app/forms/decidim/proposals/admin/proposal_base_form.rb +3 -31
  50. data/app/forms/decidim/proposals/admin/proposal_form.rb +11 -6
  51. data/app/forms/decidim/proposals/admin/proposals_import_form.rb +0 -5
  52. data/app/forms/decidim/proposals/collaborative_draft_form.rb +0 -8
  53. data/app/forms/decidim/proposals/proposal_form.rb +5 -32
  54. data/app/helpers/decidim/proposals/admin/proposal_bulk_actions_helper.rb +25 -0
  55. data/app/helpers/decidim/proposals/admin/proposals_helper.rb +0 -1
  56. data/app/helpers/decidim/proposals/application_helper.rb +23 -14
  57. data/app/helpers/decidim/proposals/collaborative_draft_helper.rb +7 -7
  58. data/app/helpers/decidim/proposals/map_helper.rb +0 -18
  59. data/app/helpers/decidim/proposals/proposal_votes_helper.rb +15 -2
  60. data/app/jobs/decidim/proposals/admin/proposal_answer_job.rb +20 -0
  61. data/app/models/decidim/proposals/collaborative_draft.rb +10 -1
  62. data/app/models/decidim/proposals/proposal.rb +66 -5
  63. data/app/models/decidim/proposals/proposal_note.rb +11 -0
  64. data/app/models/decidim/proposals/proposal_state.rb +1 -1
  65. data/app/packs/entrypoints/decidim_proposals.js +1 -0
  66. data/app/packs/entrypoints/decidim_proposals_geocoding.js +2 -0
  67. data/app/packs/src/decidim/proposals/admin/proposals.js +16 -1
  68. data/app/packs/src/decidim/proposals/exit_handler.js +73 -0
  69. data/app/packs/stylesheets/decidim/proposals/proposals.scss +248 -3
  70. data/app/permissions/decidim/proposals/admin/permissions.rb +2 -5
  71. data/app/permissions/decidim/proposals/permissions.rb +42 -0
  72. data/app/presenters/decidim/proposals/admin_log/proposal_presenter.rb +1 -1
  73. data/app/presenters/decidim/proposals/proposal_presenter.rb +1 -1
  74. data/app/queries/decidim/proposals/filtered_proposals.rb +2 -2
  75. data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +2 -2
  76. data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +10 -10
  77. data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +4 -4
  78. data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +6 -6
  79. data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +6 -6
  80. data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +6 -6
  81. data/app/services/decidim/proposals/proposal_builder.rb +1 -1
  82. data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +3 -3
  83. data/app/views/decidim/proposals/admin/proposal_notes/_proposal_note.html.erb +28 -0
  84. data/app/views/decidim/proposals/admin/proposal_notes/_proposal_note_reply.html.erb +9 -0
  85. data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +4 -28
  86. data/app/views/decidim/proposals/admin/proposal_states/_form.html.erb +1 -1
  87. data/app/views/decidim/proposals/admin/proposals/_actions.html.erb +21 -0
  88. data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +3 -2
  89. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +16 -23
  90. data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +12 -28
  91. data/app/views/decidim/proposals/admin/proposals/_proposals-thead.html.erb +45 -0
  92. data/app/views/decidim/proposals/admin/proposals/bulk_actions/_apply_answer_template.html.erb +22 -0
  93. data/app/views/decidim/proposals/admin/proposals/bulk_actions/_dropdown.html.erb +15 -11
  94. data/app/views/decidim/proposals/admin/proposals/bulk_actions/_taxonomy_change.html.erb +23 -0
  95. data/app/views/decidim/proposals/admin/proposals/index.html.erb +17 -48
  96. data/app/views/decidim/proposals/admin/proposals/manage_trash.html.erb +18 -0
  97. data/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb +1 -1
  98. data/app/views/decidim/proposals/admin/proposals/show.html.erb +10 -22
  99. data/app/views/decidim/proposals/admin/proposals/update_attribute.js.erb +1 -1
  100. data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +0 -3
  101. data/app/views/decidim/proposals/collaborative_drafts/_collaborative_actions.html.erb +9 -0
  102. data/app/views/decidim/proposals/collaborative_drafts/_collaborative_draft_aside.html.erb +0 -15
  103. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +4 -6
  104. data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +6 -2
  105. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +27 -11
  106. data/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +29 -9
  107. data/app/views/decidim/proposals/proposals/_actions.html.erb +4 -7
  108. data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +17 -22
  109. data/app/views/decidim/proposals/proposals/_exit_modal.html.erb +17 -0
  110. data/app/views/decidim/proposals/proposals/_notification_alert_box.html.erb +1 -0
  111. data/app/views/decidim/proposals/proposals/_proposal_actions.html.erb +19 -0
  112. data/app/views/decidim/proposals/proposals/_proposal_aside.html.erb +9 -32
  113. data/app/views/decidim/proposals/proposals/_proposal_voting_rules.html.erb +33 -0
  114. data/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +2 -2
  115. data/app/views/decidim/proposals/proposals/_remaining_votes_notification.html.erb +12 -0
  116. data/app/views/decidim/proposals/proposals/_update_proposal_voting_rules.html.erb +6 -0
  117. data/app/views/decidim/proposals/proposals/_vote_button.html.erb +12 -8
  118. data/app/views/decidim/proposals/proposals/_votes_count.html.erb +2 -1
  119. data/app/views/decidim/proposals/proposals/_voting_rules.html.erb +1 -7
  120. data/app/views/decidim/proposals/proposals/index.html.erb +10 -18
  121. data/app/views/decidim/proposals/proposals/index.js.erb +1 -1
  122. data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +3 -1
  123. data/app/views/decidim/proposals/proposals/show.html.erb +35 -15
  124. data/config/locales/ar.yml +18 -72
  125. data/config/locales/bg.yml +7 -89
  126. data/config/locales/bs-BA.yml +0 -13
  127. data/config/locales/ca.yml +212 -72
  128. data/config/locales/cs.yml +213 -73
  129. data/config/locales/de.yml +214 -75
  130. data/config/locales/el.yml +8 -82
  131. data/config/locales/en.yml +209 -69
  132. data/config/locales/es-MX.yml +213 -73
  133. data/config/locales/es-PY.yml +213 -73
  134. data/config/locales/es.yml +215 -75
  135. data/config/locales/eu.yml +217 -78
  136. data/config/locales/fi-plain.yml +216 -75
  137. data/config/locales/fi.yml +216 -75
  138. data/config/locales/fr-CA.yml +118 -87
  139. data/config/locales/fr.yml +118 -87
  140. data/config/locales/ga-IE.yml +0 -19
  141. data/config/locales/gl.yml +8 -43
  142. data/config/locales/hu.yml +6 -66
  143. data/config/locales/id-ID.yml +8 -40
  144. data/config/locales/is-IS.yml +0 -14
  145. data/config/locales/it.yml +8 -53
  146. data/config/locales/ja.yml +162 -87
  147. data/config/locales/lt.yml +8 -83
  148. data/config/locales/lv.yml +8 -50
  149. data/config/locales/nl.yml +6 -55
  150. data/config/locales/no.yml +8 -42
  151. data/config/locales/pl.yml +6 -88
  152. data/config/locales/pt-BR.yml +6 -74
  153. data/config/locales/pt.yml +8 -54
  154. data/config/locales/ro-RO.yml +10 -54
  155. data/config/locales/ru.yml +0 -18
  156. data/config/locales/sk.yml +8 -50
  157. data/config/locales/sr-CS.yml +0 -14
  158. data/config/locales/sv.yml +128 -85
  159. data/config/locales/tr-TR.yml +8 -51
  160. data/config/locales/uk.yml +0 -18
  161. data/config/locales/zh-CN.yml +8 -51
  162. data/config/locales/zh-TW.yml +8 -84
  163. data/db/migrate/20171220084719_add_published_at_to_proposals.rb +1 -1
  164. data/db/migrate/20181016132225_add_organization_as_author.rb +1 -1
  165. data/db/migrate/20200120215928_move_proposal_endorsements_to_core_endorsements.rb +1 -1
  166. data/db/migrate/20200827154156_add_commentable_counter_cache_to_proposals.rb +3 -3
  167. data/db/migrate/20210310102839_add_followable_counter_cache_to_proposals.rb +1 -1
  168. data/db/migrate/20240110203504_create_default_proposal_states.rb +1 -1
  169. data/db/migrate/20240404202756_add_valuation_assignments_count_to_decidim_proposals_proposals.rb +1 -1
  170. data/db/migrate/20240617091140_add_email_on_assigned_proposals_to_users.rb +7 -0
  171. data/db/migrate/20240617170052_add_parent_relation_to_decidim_proposal_notes.rb +7 -0
  172. data/db/migrate/20240828103755_add_deleted_at_to_decidim_proposals_proposals.rb +8 -0
  173. data/decidim-proposals.gemspec +1 -1
  174. data/lib/decidim/api/functions/proposal_finder_helper.rb +12 -0
  175. data/lib/decidim/api/functions/proposal_list_helper.rb +12 -0
  176. data/lib/decidim/api/proposal_type.rb +17 -25
  177. data/lib/decidim/api/proposals_type.rb +4 -19
  178. data/lib/decidim/proposals/admin_engine.rb +12 -3
  179. data/lib/decidim/proposals/admin_filter.rb +3 -6
  180. data/lib/decidim/proposals/component.rb +4 -5
  181. data/lib/decidim/proposals/download_your_data_proposal_serializer.rb +15 -0
  182. data/lib/decidim/proposals/engine.rb +5 -0
  183. data/lib/decidim/proposals/import/proposal_creator.rb +4 -4
  184. data/lib/decidim/proposals/proposal_serializer.rb +12 -29
  185. data/lib/decidim/proposals/seeds.rb +21 -17
  186. data/lib/decidim/proposals/test/factories.rb +2 -1
  187. data/lib/decidim/proposals/version.rb +1 -1
  188. data/lib/decidim/proposals.rb +4 -0
  189. metadata +65 -29
  190. data/app/commands/decidim/proposals/admin/update_proposal_category.rb +0 -70
  191. data/app/commands/decidim/proposals/admin/update_proposal_scope.rb +0 -75
  192. data/app/events/decidim/proposals/admin/update_proposal_category_event.rb +0 -11
  193. data/app/events/decidim/proposals/admin/update_proposal_scope_event.rb +0 -11
  194. data/app/views/decidim/proposals/admin/proposals/bulk_actions/_recategorize.html.erb +0 -15
  195. data/app/views/decidim/proposals/admin/proposals/bulk_actions/_scope-change.html.erb +0 -21
  196. data/app/views/decidim/proposals/collaborative_drafts/_actions.html.erb +0 -7
@@ -16,27 +16,47 @@
16
16
 
17
17
  <% if vote_limit_enabled? %>
18
18
  (function() {
19
- var $remainingVotesCount = $('#remaining-votes-count');
20
- var $notVotedButtons = $('.card__button.button').not('.success');
19
+ var $remainingVotesCount = $('div[data-remaining-votes-count="true"]');
20
+ var $notVotedButtons = $('*[data-proposal-vote-button="true"]').not('[id^=vote_button-]');
21
21
 
22
- if(!$remainingVotesCount[0]) { return; }
23
-
24
- morphdom($remainingVotesCount[0], '<%= j(render partial: "decidim/proposals/proposals/remaining_votes_count").strip.html_safe %>');
22
+ if($remainingVotesCount[0]) {
23
+ morphdom($remainingVotesCount[0], '<%= j(render partial: "decidim/proposals/proposals/remaining_votes_count").strip.html_safe %>');
24
+ }
25
25
 
26
26
  <% if remaining_votes_count_for(current_user) == 0 %>
27
27
  $notVotedButtons.attr('disabled', true);
28
- $notVotedButtons.val('<%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %>');
28
+ $notVotedButtons.text('<%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %>');
29
29
  <% else %>
30
30
  $notVotedButtons.attr('disabled', false);
31
- $notVotedButtons.val('<%= t("decidim.proposals.proposals.vote_button.vote") %>');
31
+ $notVotedButtons.text('<%= t("decidim.proposals.proposals.vote_button.vote") %>');
32
32
  <% end %>
33
33
  }());
34
34
  <% end %>
35
35
 
36
36
  <% if show_voting_rules? %>
37
37
  (function() {
38
+ var $remainingVotesNotification = $('#remaining-votes-notification');
39
+ var $exitProposalModal = $('#exit-proposal-notification');
38
40
  var $votingRules = $('.voting-rules');
39
- if(!$votingRules[0]) { return; }
40
- morphdom($votingRules[0], '<%= j(render partial: "decidim/proposals/proposals/voting_rules").strip.html_safe %>');
41
+ var $votingRulesNode = $('.item_voting_rules')
42
+
43
+ if($votingRules[0]) {
44
+ morphdom($votingRules[0], '<%= j(render partial: "decidim/proposals/proposals/voting_rules").strip.html_safe %>');
45
+ }
46
+
47
+ <% if remaining_minimum_votes_count_for(current_user).zero? %>
48
+ $votingRulesNode.prepend(`<%= j(render partial: "decidim/proposals/proposals/notification_alert_box").strip.html_safe %>`)
49
+
50
+ <% end %>
51
+ if ($exitProposalModal[0]) {
52
+ morphdom($exitProposalModal[0], '<%= j(render partial: "decidim/proposals/proposals/exit_modal").strip.html_safe %>')
53
+ if(window.Decidim.currentDialogs["exit-proposal-notification"] && window.Decidim.currentDialogs["exit-proposal-notification"].dialog) {
54
+ window.Decidim.currentDialogs["exit-proposal-notification"].dialog.innerHTML = $exitProposalModal[0].innerHTML;
55
+ }
56
+ }
57
+
58
+ if ($remainingVotesNotification[0]) {
59
+ morphdom($remainingVotesNotification[0], '<%= j(render partial: "decidim/proposals/proposals/remaining_votes_notification").strip.html_safe %>')
60
+ }
41
61
  }());
42
62
  <% end %>
@@ -1,13 +1,10 @@
1
1
  <section class="layout-main__section layout-main__buttons" data-buttons>
2
- <% if endorsements_enabled? %>
3
- <%= endorsement_buttons_cell(@proposal) %>
4
- <% end %>
5
-
2
+ <%= cell("decidim/endorsement_block", @proposal) %>
6
3
  <%= cell "decidim/comments_button", nil %>
7
4
 
8
- <div class="ml-auto">
9
- <%= cell "decidim/tags", @proposal %>
5
+ <div class="ml-auto lg:ml-0">
6
+ <%= cell "decidim/share_widget", @proposal %>
10
7
  </div>
11
8
  </section>
12
9
 
13
- <%= cell "decidim/endorsers_list", @proposal, layout: :full %>
10
+ <%= cell "decidim/endorsers_list", @proposal %>
@@ -20,36 +20,31 @@
20
20
  <% end %>
21
21
 
22
22
  <% if @form.geocoding_enabled? %>
23
- <%= form.geocoding_field(
24
- :address,
25
- placeholder: t("decidim.proposals.proposals.placeholder.address"),
26
- data: {
27
- screen_reader_announcement: t("decidim.proposals.proposals.edit_form_fields.marker_added")
28
- }
29
- ) %>
30
-
31
- <div id="address_map" class="proposal__container">
32
- <p class="help-text">
33
- <%= t("instructions", scope: "decidim.proposals.proposals.dynamic_map_instructions") %> <%= t("description", scope: "decidim.proposals.proposals.dynamic_map_instructions") %>
34
- </p>
35
- <%= dynamic_map_for proposal_preview_data_for_map(@proposal) unless new_proposal %>
23
+ <div id="address_input">
24
+ <div class="address-fill">
25
+ <%= form.geocoding_field :address, placeholder: t("decidim.proposals.proposals.placeholder.address"), data: { screen_reader_announcement: t("decidim.proposals.proposals.edit_form_fields.marker_added") } %>
26
+ </div>
27
+ <div id="address_map" class="proposal__container">
28
+ <p class="help-text">
29
+ <%= t("instructions", scope: "decidim.proposals.proposals.dynamic_map_instructions") %> <%= t("description", scope: "decidim.proposals.proposals.dynamic_map_instructions") %>
30
+ </p>
31
+ <%= dynamic_map_for proposal_preview_data_for_map(@form.to_h) %>
32
+ </div>
36
33
  </div>
37
34
  <% end %>
38
35
 
39
- <% if @form.categories&.any? %>
40
- <%= form.categories_select :category_id, @form.categories, include_blank: t("decidim.proposals.proposals.edit.select_a_category") %>
41
- <% end %>
42
-
43
- <% if current_component.has_subscopes? %>
44
- <%= scopes_select_field form, :scope_id, root: current_component.scope %>
36
+ <% if @form.taxonomy_filters&.any? %>
37
+ <% @form.taxonomy_filters.each do |filter| %>
38
+ <%= filter_taxonomy_items_select_field form, :taxonomies, filter %>
39
+ <% end %>
45
40
  <% end %>
46
41
 
47
42
  <% if component_settings.attachments_allowed? && (new_proposal || @proposal) %>
48
43
  <%= form.attachment :documents,
49
44
  multiple: true,
50
- label: t("decidim.proposals.proposals.edit.add_documents"),
51
- button_label: t("decidim.proposals.proposals.edit.add_documents"),
52
- button_edit_label: t("decidim.proposals.proposals.edit.edit_documents"),
45
+ label: t("decidim.proposals.proposals.edit.add_attachments"),
46
+ button_label: t("decidim.proposals.proposals.edit.add_attachments"),
47
+ button_edit_label: t("decidim.proposals.proposals.edit.edit_attachments"),
53
48
  button_class: "button button__lg button__transparent-secondary w-full",
54
49
  help_i18n_scope: "decidim.forms.file_help.file",
55
50
  help_text: t("attachment_legend", scope: "decidim.proposals.proposals.edit") %>
@@ -0,0 +1,17 @@
1
+ <%= decidim_modal id: "exit-proposal-notification" do %>
2
+ <div data-dialog-container data-minimum-votes-reached="<%= remaining_minimum_votes_count_for(current_user).zero? %>" data-minimum-votes-count="<%= minimum_votes_per_user - remaining_minimum_votes_count_for(current_user) %>">
3
+ <%= icon "information-line" %>
4
+ <h3 class="h3 text-base" id="dialog-title-exit-proposal-notification" tabindex="-1" data-dialog-title>
5
+ <%= t("title", scope: "decidim.proposals.exit_modal", number: remaining_minimum_votes_count_for(current_user)) %>
6
+ </h3>
7
+ <p id="dialog-desc-budget-modal">
8
+ <%= t("message", scope: "decidim.proposals.exit_modal", number: remaining_minimum_votes_count_for(current_user)) %>
9
+ </p>
10
+ </div>
11
+ <div data-dialog-actions>
12
+ <button data-dialog-close="exit-proposal-notification" class="button button__sm md:button__lg button__secondary">
13
+ <%= t("cancel", scope: "decidim.proposals.exit_modal") %>
14
+ </button>
15
+ <%= link_to t("exit", scope: "decidim.proposals.exit_modal"), proposals_path, id: "exit-proposal-notification-link", class: "button button__sm md:button__lg button__secondary" %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= alert_box(t("success", scope: "decidim.proposals.proposals.voting_rules"), :success, true, { id: "success-proposal-vote" }) %>
@@ -0,0 +1,19 @@
1
+ <% if @proposal.amendable? && allowed_to?(:edit, :proposal, proposal: @proposal) %>
2
+ <li role="menuitem">
3
+ <%= link_to edit_proposal_path(@proposal), class: "button button__sm button__text button__text-secondary" do %>
4
+ <span><%= t("edit_proposal", scope: "decidim.proposals.proposals.show") %></span>
5
+ <%= icon "pencil-line" %>
6
+ <% end %>
7
+ </li>
8
+ <% else %>
9
+ <%= cell("decidim/amendable/amend_button_card", @proposal) %>
10
+ <% end %>
11
+
12
+ <% if @proposal.withdrawable_by?(current_user) %>
13
+ <li role="menuitem">
14
+ <%= action_authorized_link_to :withdraw, withdraw_proposal_path(@proposal), resource: @proposal, method: :put, class: "button button__sm button__text button__text-secondary", title: t("withdraw_btn_hint", scope: "decidim.proposals.proposals.show" ), data: { confirm: t("withdraw_confirmation_html", scope: "decidim.proposals.proposals.show" ) } do %>
15
+ <span><%= t("withdraw_proposal", scope: "decidim.proposals.proposals.show") %></span>
16
+ <%= icon "arrow-go-back-line" %>
17
+ <% end %>
18
+ </li>
19
+ <% end %>
@@ -1,42 +1,19 @@
1
1
  <% if current_settings.votes_enabled? && (show_endorsements_card? || current_user) %>
2
- <section class="layout-aside__section">
3
- <div class="proposal__aside-vote layout-aside__ctas-buttons" data-sticky-buttons>
4
- <%= render partial: "vote_button", locals: { proposal: @proposal, from_proposals_list: false } unless @proposal.withdrawn? %>
5
- <%= render partial: "votes_count", locals: { proposal: @proposal, from_proposals_list: false } %>
6
- </div>
7
- </section>
2
+ <section class="layout-aside__section">
3
+ <div class="proposal__aside-vote layout-aside__ctas-buttons" data-sticky-buttons>
4
+ <%= render partial: "vote_button", locals: { proposal: @proposal, from_proposals_list: false } unless @proposal.withdrawn? %>
5
+ <%= render partial: "votes_count", locals: { proposal: @proposal, from_proposals_list: false } %>
6
+ </div>
7
+ </section>
8
8
  <% end %>
9
9
 
10
- <% if (@proposal.amendable? && allowed_to?(:edit, :proposal, proposal: @proposal)) || (amendments_enabled? && @proposal.amendable? && current_component.current_settings.amendment_creation_enabled && can_participate_in_private_space?) || amendments_enabled? && can_react_to_emendation?(@proposal) || @proposal.withdrawable_by?(current_user) %>
11
- <section class="layout-aside__section layout-aside__buttons">
12
- <% if @proposal.amendable? && allowed_to?(:edit, :proposal, proposal: @proposal) %>
13
- <%= link_to edit_proposal_path(@proposal), class: "button button__sm button__transparent-secondary w-full" do %>
14
- <span><%= t("edit_proposal", scope: "decidim.proposals.proposals.show") %></span>
15
- <%= icon "pencil-line" %>
16
- <% end %>
17
- <% else %>
18
- <%= amend_button_for @proposal %>
19
- <% end %>
20
-
21
- <% if amendments_enabled? && can_react_to_emendation?(@proposal) %>
10
+ <% if ( amendments_enabled? && can_react_to_emendation?(@proposal) ) %>
11
+ <section class="layout-aside__section layout-aside__buttons">
22
12
  <%= emendation_actions_for @proposal %>
23
- <% end %>
24
-
25
- <% if @proposal.withdrawable_by?(current_user) %>
26
- <%= action_authorized_link_to :withdraw, withdraw_proposal_path(@proposal), method: :put, class: "button button__sm button__transparent-secondary w-full", title: t("withdraw_btn_hint", scope: "decidim.proposals.proposals.show" ), data: { confirm: t("withdraw_confirmation_html", scope: "decidim.proposals.proposals.show" ) } do %>
27
- <span><%= t("withdraw_proposal", scope: "decidim.proposals.proposals.show") %></span>
28
- <% end %>
29
- <% end %>
30
- </section>
13
+ </section>
31
14
  <% end %>
32
15
 
33
16
  <section class="layout-aside__section">
34
17
  <%= cell "decidim/proposals/proposal_link_to_collaborative_draft", @proposal %>
35
18
  <%= cell "decidim/proposals/proposal_link_to_rejected_emendation", @proposal %>
36
19
  </section>
37
-
38
- <section class="layout-aside__section actions__secondary">
39
- <%= follow_button_for(@proposal) %>
40
- <%= cell "decidim/share_button", nil %>
41
- <%= cell "decidim/report_button", @proposal %>
42
- </section>
@@ -0,0 +1,33 @@
1
+ <div id="proposal-voting-rules" class="flash flex-col p-0 gap-0">
2
+ <button id="dropdown-trigger-proposal-voting-rules" data-component="dropdown" data-target="dropdown-menu-proposal-voting-rules" class="flash__title">
3
+ <%= t("title", scope: "decidim.proposals.proposals.voting_rules") %>
4
+ <%= icon "arrow-down-s-line" %>
5
+ <%= icon "arrow-up-s-line" %>
6
+ </button>
7
+
8
+ <div class="flash__message">
9
+ <div class="text-base editor-content">
10
+ <ul id="dropdown-menu-proposal-voting-rules" class="mt-0 mb-2">
11
+ <% if vote_limit_enabled? %>
12
+ <li><%= t("vote_limit.description", scope: "decidim.proposals.proposals.voting_rules", limit: component_settings.vote_limit) %></li>
13
+ <% end %>
14
+
15
+ <% if proposal_limit_enabled? %>
16
+ <li><%= t("proposal_limit.description", scope: "decidim.proposals.proposals.voting_rules", limit: proposal_limit) %></li>
17
+ <% end %>
18
+
19
+ <% if threshold_per_proposal_enabled? %>
20
+ <li><%= t("threshold_per_proposal.description", scope: "decidim.proposals.proposals.voting_rules", limit: threshold_per_proposal) %></li>
21
+ <% end %>
22
+
23
+ <% if can_accumulate_votes_beyond_threshold? %>
24
+ <li><%= t("can_accumulate_votes_beyond_threshold.description", scope: "decidim.proposals.proposals.voting_rules", limit: threshold_per_proposal) %></li>
25
+ <% end %>
26
+
27
+ <% if minimum_votes_per_user_enabled? %>
28
+ <li><%= t("minimum_votes_per_user.description", scope: "decidim.proposals.proposals.voting_rules", votes: minimum_votes_per_user) %></li>
29
+ <% end %>
30
+ </ul>
31
+ </div>
32
+ </div>
33
+ </div>
@@ -1,3 +1,3 @@
1
- <div id="remaining-votes-count">
2
- <%= t("votes", scope: "decidim.proposals.proposals.voting_rules.vote_limit", number: remaining_votes_count_for(current_user)) %>
1
+ <div data-remaining-votes-count="true">
2
+ <%= t("votes", scope: "decidim.proposals.proposals.voting_rules.vote_limit", number: remaining_minimum_votes_count_for(current_user)) %>
3
3
  </div>
@@ -0,0 +1,12 @@
1
+ <%= alert_box(
2
+ message(
3
+ content_tag(:div, class: "") do
4
+ concat content_tag(:strong, t("already_vote.title", scope: "decidim.proposals.proposals.voting_rules", number: remaining_minimum_votes_count_for(current_user)))
5
+ concat content_tag(:p, t("already_vote.description", scope: "decidim.proposals.proposals.voting_rules", number: remaining_minimum_votes_count_for(current_user)))
6
+ concat link_to(t("already_vote.see_other_proposals", scope: "decidim.proposals.proposals.voting_rules"), proposals_path, class: "no-modal")
7
+ end
8
+ ),
9
+ :secondary,
10
+ true,
11
+ { id: "remaining-votes-notification", class: "flash secondary #{"hidden" unless remaining_minimum_votes_count_for(current_user).positive?}" }
12
+ ) %>
@@ -0,0 +1,6 @@
1
+ <% if show_voting_rules? %>
2
+ <div class="item_voting_rules">
3
+ <%= render partial: "remaining_votes_notification" %>
4
+ <%= render partial: "proposal_voting_rules" %>
5
+ </div>
6
+ <% end %>
@@ -4,12 +4,14 @@
4
4
  <% if component_settings.participatory_texts_enabled? && from_proposals_list %>
5
5
  <%= render partial: "decidim/proposals/proposals/participatory_texts/proposal_vote_button", locals: { proposal:, from_proposals_list: true } %>
6
6
  <% else %>
7
- <div id="proposal-<%= proposal.id %>-vote-button">
7
+ <div id="proposal-<%= proposal.id %>-vote-button" class="card__proposals-votes-container">
8
8
  <% if !current_user %>
9
9
  <% if current_settings.votes_blocked? %>
10
- <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.votes_blocked"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: button_classes, disabled: true %>
10
+ <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: button_classes, data: { "proposal-vote-button": true }, disabled: true do %>
11
+ <%= t("decidim.proposals.proposals.vote_button.votes_blocked") %>
12
+ <% end %>
11
13
  <% else %>
12
- <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: button_classes, data: { disable: true, "redirect-url": proposal_path(proposal) } do %>
14
+ <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: button_classes, data: { "proposal-vote-button": true, disable: true, "redirect-url": proposal_path(proposal) } do %>
13
15
  <%= t("decidim.proposals.proposals.vote_button.vote") %>
14
16
  <span class="sr-only"><%= decidim_html_escape(present(proposal).title) %></span>
15
17
  <% end %>
@@ -26,24 +28,26 @@
26
28
  disable: true,
27
29
  original: t("decidim.proposals.proposals.vote_button.already_voted"),
28
30
  replace: t("decidim.proposals.proposals.vote_button.already_voted_hover"),
31
+ "proposal-vote-button": true,
29
32
  "redirect-url": proposal_path(proposal)
30
33
  },
31
- class: "#{button_classes} is-hover",
34
+ class: "#{button_classes}",
32
35
  id: "vote_button-#{proposal.id}"
33
36
  ) do %>
34
37
  <%= t("decidim.proposals.proposals.vote_button.already_voted") %>
38
+ <%= icon "check-line", class: "already-voted-icon" %>
35
39
  <span class="sr-only"><%= decidim_html_escape(present(proposal).title) %></span>
36
40
  <% end %>
37
41
  <% else %>
38
42
  <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_votes_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
39
- <%= content_tag :button, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: button_classes, disabled: true %>
43
+ <%= content_tag :button, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: button_classes, data: { "proposal-vote-button": true }, disabled: true %>
40
44
  <% else %>
41
45
  <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
42
- <%= content_tag :button, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: button_classes, disabled: true %>
46
+ <%= content_tag :button, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: button_classes, data: { "proposal-vote-button": true }, disabled: true %>
43
47
  <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
44
- <%= content_tag :button, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: button_classes, disabled: true %>
48
+ <%= content_tag :button, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: button_classes, data: { "proposal-vote-button": true }, disabled: true %>
45
49
  <% else %>
46
- <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, remote: true, data: { disable: true, "redirect-url": proposal_path(proposal) }, class: button_classes do %>
50
+ <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, remote: true, data: { "proposal-vote-button": true, disable: true, "redirect-url": proposal_path(proposal) }, class: button_classes do %>
47
51
  <%= t("decidim.proposals.proposals.vote_button.vote") %>
48
52
  <span class="sr-only"><%= decidim_html_escape(present(proposal).title) %></span>
49
53
  <% end %>
@@ -9,7 +9,8 @@
9
9
  progress,
10
10
  total:,
11
11
  units_name: "decidim.proposals.proposals.votes_count.count",
12
- element_id: "proposal-#{proposal.id}-votes-count"
12
+ element_id: "proposal-#{proposal.id}-votes-count",
13
+ class: total.positive? ? "card__proposals-votes-limited" : "card__proposals-votes-unlimited"
13
14
  ) %>
14
15
  <% end %>
15
16
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <% if show_voting_rules? %>
2
2
  <% announcement_body = capture do %>
3
3
  <div class="editor-content">
4
- <ul>
4
+ <ul class="mt-0 mb-2">
5
5
  <% if vote_limit_enabled? %>
6
6
  <li><%= t(".vote_limit.description", limit: component_settings.vote_limit) %></li>
7
7
  <% end %>
@@ -21,15 +21,9 @@
21
21
  <% if minimum_votes_per_user_enabled? %>
22
22
  <li>
23
23
  <%= t(".minimum_votes_per_user.description", votes: minimum_votes_per_user) %>
24
- <% if votes_given >= minimum_votes_per_user %>
25
- <%= t(".minimum_votes_per_user.given_enough_votes") %>
26
- <% else %>
27
- <%= t(".minimum_votes_per_user.votes_remaining", remaining_votes: minimum_votes_per_user - votes_given) %>
28
- <% end %>
29
24
  </li>
30
25
  <% end %>
31
26
  </ul>
32
- <%= render partial: "decidim/proposals/proposals/remaining_votes_count" if current_user_can_vote? %>
33
27
  </div>
34
28
  <% end %>
35
29
 
@@ -1,4 +1,11 @@
1
- <% add_decidim_page_title(t("name", scope: "decidim.components.proposals")) %>
1
+ <% add_decidim_meta_tags(
2
+ description: translated_attribute(current_participatory_space.short_description),
3
+ title: t("decidim.components.pagination.page_title",
4
+ component_name: component_name,
5
+ current_page: @proposals.current_page,
6
+ total_pages: @proposals.total_pages ),
7
+ url: proposals_url,
8
+ resource: current_component) %>
2
9
 
3
10
  <% append_stylesheet_pack_tag "decidim_proposals", media: "all" %>
4
11
  <% append_javascript_pack_tag "decidim_proposals" %>
@@ -8,7 +15,7 @@
8
15
 
9
16
  <div class="proposal-list__aside__button-container">
10
17
  <% if current_settings.creation_enabled && current_component.participatory_space.can_participate?(current_user) %>
11
- <%= action_authorized_link_to :create, new_proposal_path, class: "button button__xl button__secondary w-full", data: { "redirect_url" => new_proposal_path } do %>
18
+ <%= action_authorized_link_to :create, new_proposal_path, permissions_holder: current_component, class: "button button__xl button__secondary w-full", data: { "redirect_url" => new_proposal_path } do %>
12
19
  <span><%= t("new_proposal", scope: "decidim.proposals.proposals.index") %></span>
13
20
  <%= icon "add-line" %>
14
21
  <% end %>
@@ -31,22 +38,7 @@
31
38
 
32
39
  <% if Decidim::Map.available?(:geocoding, :dynamic) && component_settings.geocoding_enabled? %>
33
40
  <div class="proposal-list__map">
34
- <%= dynamic_map_for proposals_data_for_map(@proposals) do %>
35
- <template id="marker-popup">
36
- <div class="space-y-6">
37
- <a href="${link}" class="card__list">
38
- <div class="card__list-content">
39
- <h3 class="h4 card__list-title">${title}</h3>
40
- <div class="card__list-metadata">
41
- {{each JSON.parse(items)}}
42
- <span>{{html icon}}{{html text}}</span>
43
- {{/each}}
44
- </div>
45
- </div>
46
- </a>
47
- </div>
48
- </template>
49
- <% end %>
41
+ <%= cell "decidim/map", @proposals, metadata_card: "decidim/proposals/proposal_metadata" %>
50
42
  </div>
51
43
  <% end %>
52
44
 
@@ -8,7 +8,7 @@ $orderFilterInput.val('<%= order %>');
8
8
  var $map = $("#map");
9
9
  var controller = $map.data("map-controller");
10
10
  if (controller) {
11
- var markerData = JSON.parse('<%= escape_javascript proposals_data_for_map(@proposals).to_json.html_safe %>');
11
+ var markerData = JSON.parse('<%= escape_javascript cell("decidim/map", @proposals, metadata_card: "decidim/proposals/proposal_metadata").geocoded_data.to_json.html_safe %>');
12
12
  controller.clearMarkers();
13
13
  if (markerData.length > 0 ) {
14
14
  controller.addMarkers(markerData);
@@ -4,7 +4,9 @@
4
4
  <div id="proposal-<%= proposal.id %>-vote-button">
5
5
  <% if !current_user %>
6
6
  <% if current_settings.votes_blocked? %>
7
- <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.votes_blocked"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: "column button light button--sc disabled", disabled: true %>
7
+ <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: "column button light button--sc disabled", disabled: true do %>
8
+ <%= t("decidim.proposals.proposals.vote_button.votes_blocked") %>
9
+ <% end %>
8
10
  <% else %>
9
11
  <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: "column button light button--sc", data: { disable: true, "redirect-url": proposal_path(proposal) } do %>
10
12
  <%= t("decidim.proposals.proposals.vote_button.vote") %>
@@ -1,8 +1,8 @@
1
- <% add_decidim_meta_tags({
2
- description: present(@proposal).body,
3
- title: present(@proposal).title,
4
- url: proposal_url(@proposal.id)
5
- }) %>
1
+ <% add_decidim_meta_tags(
2
+ description: present(@proposal).body,
3
+ title: present(@proposal).title,
4
+ url: proposal_url(@proposal.id),
5
+ resource: @proposal) %>
6
6
 
7
7
  <%
8
8
  edit_link(
@@ -26,6 +26,14 @@ extra_admin_link(
26
26
  <% append_stylesheet_pack_tag "decidim_proposals", media: "all" %>
27
27
  <% append_javascript_pack_tag "decidim_proposals" %>
28
28
 
29
+ <% content_for :item_header do %>
30
+ <% if show_voting_rules? %>
31
+ <div class="layout-item-complementary">
32
+ <%= render partial: "update_proposal_voting_rules" %>
33
+ </div>
34
+ <% end %>
35
+ <% end %>
36
+
29
37
  <% content_for :aside do %>
30
38
  <%= render partial: "proposal_aside" %>
31
39
  <% end %>
@@ -33,7 +41,9 @@ extra_admin_link(
33
41
  <%= render layout: "layouts/decidim/shared/layout_item", locals: { back_path: component_settings.participatory_texts_enabled? ? main_component_path(current_component) : proposals_path } do %>
34
42
 
35
43
  <section class="layout-main__section layout-main__heading">
36
- <%= render partial: "voting_rules" %>
44
+ <% if show_voting_rules? && remaining_minimum_votes_count_for(current_user).positive? && current_component.participatory_space.can_participate?(current_user) %>
45
+ <%= render partial: "exit_modal" %>
46
+ <% end %>
37
47
 
38
48
  <%= cell("decidim/announcement", proposal_reason_callout_announcement, callout_styles: @proposal.proposal_state&.css_style) if @proposal.answered? && @proposal.published_state? %>
39
49
 
@@ -46,12 +56,20 @@ extra_admin_link(
46
56
  <% end %>
47
57
 
48
58
  <% unless component_settings.participatory_texts_enabled? %>
49
- <div class="layout-author">
50
- <%= cell "decidim/coauthorships", @proposal, context_actions: [:date] %>
51
-
52
- <% if not ["section","subsection"].include? @proposal.participatory_text_level %>
59
+ <% unless ["section","subsection"].include?(@proposal.participatory_text_level) %>
60
+ <div class="layout-author has_status">
53
61
  <%= cell("decidim/proposals/proposal_metadata", @proposal).state_item&.dig(:text) %>
54
- <% end %>
62
+ </div>
63
+ <% end %>
64
+ <div class="layout-author <%= "has_status" unless %w(section subsection).include?(@proposal.participatory_text_level) %>">
65
+ <div class="relative flex items-center justify-center w-full">
66
+ <div class="w-10/12 flex items-center gap-4">
67
+ <%= cell "decidim/coauthorships", @proposal, context_actions: [:date] %>
68
+ </div>
69
+ <%= render "decidim/shared/resource_actions", resource: @proposal do %>
70
+ <%= render "decidim/proposals/proposals/proposal_actions" %>
71
+ <% end %>
72
+ </div>
55
73
  </div>
56
74
  <% end %>
57
75
  </section>
@@ -88,6 +106,8 @@ extra_admin_link(
88
106
  <%= cell "decidim/amendable/amendments", @proposal %>
89
107
  </section>
90
108
 
109
+ <%= cell "decidim/tags", @proposal %>
110
+
91
111
  <%= render partial: "actions" %>
92
112
 
93
113
  <% content_for :item_footer do %>
@@ -97,10 +117,10 @@ extra_admin_link(
97
117
  <%= content_tag :li, resource_reference(@proposal), class: "metadata__item" %>
98
118
  <%= content_tag :li, resource_version(proposal_presenter, versions_path: proposal_version_path(@proposal, proposal_presenter.versions.count)), class: "metadata__item" %>
99
119
 
100
- <% fingerprint_id = dom_id(@proposal, :fingerprint_dialog) %>
101
- <%= content_tag :li, class: "metadata__item" do %>
102
- <%= content_tag :button, t("decidim.fingerprint.check"), data: { dialog_open: fingerprint_id } %>
103
- <% end %>
120
+ <% fingerprint_id = dom_id(@proposal, :fingerprint_dialog) %>
121
+ <%= content_tag :li, class: "metadata__item" do %>
122
+ <%= content_tag :button, t("decidim.fingerprint.check"), data: { dialog_open: fingerprint_id } %>
123
+ <% end %>
104
124
  </ul>
105
125
  <%= decidim_modal id: fingerprint_id, class: "fingerprint-modal" do %>
106
126
  <div data-dialog-container>