decidim-proposals 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -0
  3. data/app/assets/config/decidim_proposals_manifest.js +1 -0
  4. data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +1 -1
  5. data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +23 -0
  6. data/app/cells/decidim/proposals/collaborative_draft_cell.rb +0 -2
  7. data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +5 -1
  8. data/app/cells/decidim/proposals/highlighted_proposals/show.erb +3 -0
  9. data/app/cells/decidim/proposals/highlighted_proposals_cell.rb +25 -0
  10. data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +19 -0
  11. data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +34 -0
  12. data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +33 -0
  13. data/app/cells/decidim/proposals/participatory_text_proposal/show.erb +9 -0
  14. data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +77 -0
  15. data/app/cells/decidim/proposals/proposal_cell.rb +0 -2
  16. data/app/cells/decidim/proposals/proposal_m/footer.erb +1 -1
  17. data/app/cells/decidim/proposals/proposal_m_cell.rb +6 -1
  18. data/app/commands/decidim/proposals/accept_access_to_collaborative_draft.rb +3 -3
  19. data/app/commands/decidim/proposals/admin/answer_proposal.rb +2 -1
  20. data/app/commands/decidim/proposals/admin/create_proposal.rb +7 -7
  21. data/app/commands/decidim/proposals/admin/import_participatory_text.rb +8 -8
  22. data/app/commands/decidim/proposals/admin/update_proposal.rb +13 -6
  23. data/app/commands/decidim/proposals/admin/update_proposal_category.rb +1 -1
  24. data/app/commands/decidim/proposals/create_collaborative_draft.rb +6 -3
  25. data/app/commands/decidim/proposals/create_proposal.rb +25 -11
  26. data/app/commands/decidim/proposals/endorse_proposal.rb +1 -2
  27. data/app/commands/decidim/proposals/hashtags_methods.rb +36 -0
  28. data/app/commands/decidim/proposals/publish_collaborative_draft.rb +39 -34
  29. data/app/commands/decidim/proposals/publish_proposal.rb +13 -17
  30. data/app/commands/decidim/proposals/reject_access_to_collaborative_draft.rb +2 -3
  31. data/app/commands/decidim/proposals/request_access_to_collaborative_draft.rb +1 -2
  32. data/app/commands/decidim/proposals/update_collaborative_draft.rb +11 -8
  33. data/app/commands/decidim/proposals/update_proposal.rb +37 -13
  34. data/app/commands/decidim/proposals/withdraw_collaborative_draft.rb +3 -3
  35. data/app/commands/decidim/proposals/withdraw_proposal.rb +14 -1
  36. data/app/controllers/decidim/proposals/admin/participatory_texts_controller.rb +2 -1
  37. data/app/controllers/decidim/proposals/admin/proposals_controller.rb +9 -1
  38. data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +8 -0
  39. data/app/controllers/decidim/proposals/proposals_controller.rb +64 -27
  40. data/app/controllers/decidim/proposals/versions_controller.rb +5 -1
  41. data/app/events/decidim/proposals/accepted_proposal_event.rb +8 -0
  42. data/app/events/decidim/proposals/evaluating_proposal_event.rb +3 -0
  43. data/app/events/decidim/proposals/proposal_endorsed_event.rb +4 -0
  44. data/app/events/decidim/proposals/publish_proposal_event.rb +4 -0
  45. data/app/events/decidim/proposals/rejected_proposal_event.rb +8 -0
  46. data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +4 -0
  47. data/app/forms/decidim/proposals/admin/proposal_form.rb +49 -0
  48. data/app/forms/decidim/proposals/collaborative_draft_form.rb +2 -0
  49. data/app/forms/decidim/proposals/proposal_form.rb +32 -0
  50. data/app/helpers/decidim/proposals/admin/proposals_helper.rb +19 -0
  51. data/app/helpers/decidim/proposals/application_helper.rb +48 -12
  52. data/app/helpers/decidim/proposals/control_version_helper.rb +61 -0
  53. data/app/helpers/decidim/proposals/participatory_texts_helper.rb +8 -0
  54. data/app/helpers/decidim/proposals/proposal_cells_helper.rb +7 -1
  55. data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +8 -6
  56. data/app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb +2 -2
  57. data/app/jobs/decidim/proposals/settings_change_job.rb +8 -6
  58. data/app/models/decidim/proposals/collaborative_draft.rb +3 -0
  59. data/app/models/decidim/proposals/proposal.rb +20 -8
  60. data/app/permissions/decidim/proposals/admin/permissions.rb +1 -1
  61. data/app/presenters/decidim/proposals/admin_log/value_types/proposal_title_body_presenter.rb +2 -1
  62. data/app/presenters/decidim/proposals/collaborative_draft_presenter.rb +15 -2
  63. data/app/presenters/decidim/proposals/official_author_presenter.rb +4 -0
  64. data/app/presenters/decidim/proposals/proposal_presenter.rb +10 -14
  65. data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +54 -0
  66. data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +56 -0
  67. data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +64 -0
  68. data/app/services/decidim/proposals/proposal_search.rb +46 -5
  69. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +1 -1
  70. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +43 -2
  71. data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +6 -2
  72. data/app/views/decidim/proposals/admin/proposals/edit.html.erb +1 -1
  73. data/app/views/decidim/proposals/admin/proposals/new.html.erb +1 -1
  74. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +81 -0
  75. data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +1 -49
  76. data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +1 -29
  77. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +5 -5
  78. data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +27 -3
  79. data/app/views/decidim/proposals/proposals/_filters.html.erb +5 -2
  80. data/app/views/decidim/proposals/proposals/_proposal.html.erb +5 -1
  81. data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +2 -2
  82. data/app/views/decidim/proposals/proposals/_vote_button.html.erb +39 -35
  83. data/app/views/decidim/proposals/proposals/_votes_count.html.erb +16 -12
  84. data/app/views/decidim/proposals/proposals/new.html.erb +1 -1
  85. data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +19 -0
  86. data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +46 -0
  87. data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_votes_count.html.erb +41 -0
  88. data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +10 -0
  89. data/app/views/decidim/proposals/proposals/participatory_texts/participatory_text.html.erb +15 -0
  90. data/app/views/decidim/proposals/proposals/show.html.erb +45 -4
  91. data/app/views/decidim/proposals/versions/_version.html.erb +2 -2
  92. data/app/views/decidim/proposals/versions/index.html.erb +1 -1
  93. data/app/views/decidim/proposals/versions/show.html.erb +2 -2
  94. data/config/locales/ca.yml +87 -33
  95. data/config/locales/de.yml +87 -36
  96. data/config/locales/en.yml +87 -33
  97. data/config/locales/es-PY.yml +87 -33
  98. data/config/locales/es.yml +88 -34
  99. data/config/locales/eu.yml +87 -33
  100. data/config/locales/fi-pl.yml +87 -33
  101. data/config/locales/fi.yml +87 -33
  102. data/config/locales/fr.yml +87 -33
  103. data/config/locales/gl.yml +87 -33
  104. data/config/locales/hu.yml +87 -33
  105. data/config/locales/id-ID.yml +84 -30
  106. data/config/locales/it.yml +87 -33
  107. data/config/locales/nl.yml +87 -33
  108. data/config/locales/pl.yml +87 -33
  109. data/config/locales/pt-BR.yml +87 -33
  110. data/config/locales/pt.yml +87 -33
  111. data/config/locales/ru.yml +21 -38
  112. data/config/locales/sv.yml +87 -33
  113. data/config/locales/tr-TR.yml +86 -32
  114. data/config/locales/uk.yml +21 -38
  115. data/db/migrate/20181026073215_add_created_in_meeting.rb +7 -0
  116. data/lib/decidim/proposals.rb +2 -0
  117. data/lib/decidim/proposals/component.rb +74 -0
  118. data/lib/decidim/proposals/doc_to_markdown.rb +40 -0
  119. data/lib/decidim/proposals/engine.rb +52 -35
  120. data/lib/decidim/proposals/odt_to_markdown.rb +46 -0
  121. data/lib/decidim/proposals/proposal_serializer.rb +29 -13
  122. data/lib/decidim/proposals/test/factories.rb +76 -0
  123. data/lib/decidim/proposals/version.rb +1 -1
  124. metadata +56 -20
  125. data/app/views/decidim/participatory_spaces/_highlighted_proposals.html.erb +0 -15
@@ -7,55 +7,7 @@
7
7
  <div class="card">
8
8
  <div class="card__content">
9
9
  <%= decidim_form_for(@form) do |form| %>
10
- <div class="field">
11
- <%= form.text_field :title %>
12
- </div>
13
-
14
- <div class="field">
15
- <%= form.text_area :body, rows: 10 %>
16
- </div>
17
-
18
- <% if component_settings.geocoding_enabled? %>
19
- <div class="field">
20
- <%= form.check_box :has_address, class: "has_address" %>
21
- </div>
22
- <div class="field" id="address_input">
23
- <%= form.text_field :address %>
24
- </div>
25
- <% end %>
26
-
27
- <% if @form.categories&.any? %>
28
- <div class="field">
29
- <%= form.categories_select :category_id, @form.categories, prompt: t(".select_a_category") %>
30
- </div>
31
- <% end %>
32
-
33
- <% if current_participatory_space.has_subscopes? %>
34
- <div class="field">
35
- <%= scopes_picker_field form, :scope_id %>
36
- </div>
37
- <% end %>
38
-
39
- <% if Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
40
- <div class="field">
41
- <%= user_group_select_field form, :user_group_id %>
42
- </div>
43
- <% end %>
44
-
45
- <% if component_settings.attachments_allowed? %>
46
- <fieldset>
47
- <legend><%= t(".attachment_legend") %></legend>
48
- <%= form.fields_for :attachment, @form.attachment do |form| %>
49
- <div class="field">
50
- <%= form.text_field :title %>
51
- </div>
52
-
53
- <div class="field">
54
- <%= form.upload :file, optional: false %>
55
- </div>
56
- <% end %>
57
- </fieldset>
58
- <% end %>
10
+ <%= render partial: "edit_form_fields", locals: { form: form } %>
59
11
 
60
12
  <div class="actions">
61
13
  <%= form.submit t(".send"), class: "button expanded mt-s mb-none", data: { disable: true } %>
@@ -15,35 +15,7 @@
15
15
 
16
16
  <div class="card__content">
17
17
  <%= decidim_form_for(@form) do |form| %>
18
- <div class="field">
19
- <%= form.text_field :title %>
20
- </div>
21
-
22
- <div class="field">
23
- <%= form.text_area :body, rows: 10 %>
24
- </div>
25
-
26
- <% if component_settings.geocoding_enabled? %>
27
- <div class="field">
28
- <%= form.check_box :has_address, class: "has_address" %>
29
- </div>
30
-
31
- <div class="field" id="address_input">
32
- <%= form.text_field :address %>
33
- </div>
34
- <% end %>
35
-
36
- <% if @form.categories&.any? %>
37
- <div class="field">
38
- <%= form.categories_select :category_id, @form.categories, prompt: t(".select_a_category") %>
39
- </div>
40
- <% end %>
41
-
42
- <% if current_participatory_space.has_subscopes? %>
43
- <div class="field">
44
- <%= scopes_picker_field form, :scope_id %>
45
- </div>
46
- <% end %>
18
+ <%= render partial: "edit_form_fields", locals: { form: form } %>
47
19
 
48
20
  <div class="actions">
49
21
  <%= form.submit t(".send"), class: "button expanded", data: { disable: true } %>
@@ -1,6 +1,6 @@
1
1
  <% add_decidim_meta_tags({
2
- description: @collaborative_draft.body,
3
- title: @collaborative_draft.title,
2
+ description: present(@collaborative_draft).body,
3
+ title: present(@collaborative_draft).title,
4
4
  url: collaborative_draft_url(@collaborative_draft.id)
5
5
  }) %>
6
6
 
@@ -19,10 +19,10 @@
19
19
  <% end %>
20
20
 
21
21
  <h2 class="heading2">
22
- <%= @collaborative_draft.title %>
22
+ <%= present(@collaborative_draft).title(links: true) %>
23
23
  </h2>
24
24
 
25
- <%= cell("decidim/coauthorships", @collaborative_draft, has_actions: true, size: 3) %>
25
+ <%= cell("decidim/coauthorships", @collaborative_draft, has_actions: true, size: 3, context: { current_user: current_user }) %>
26
26
  </div>
27
27
 
28
28
  <div class="row">
@@ -110,7 +110,7 @@
110
110
  <div class="section">
111
111
  <%== cell("decidim/proposals/collaborative_draft_m", @collaborative_draft, full_badge: true).badge %>
112
112
 
113
- <%= simple_format @collaborative_draft.body %>
113
+ <%= simple_format present(@collaborative_draft).body(links: true) %>
114
114
 
115
115
  <% if component_settings.geocoding_enabled? %>
116
116
  <%= render partial: "decidim/shared/static_map", locals: { icon_name: "proposals", geolocalizable: @collaborative_draft } %>
@@ -1,11 +1,35 @@
1
1
  <div class="field hashtags__container">
2
- <%= form.text_field :title, class: "js-hashtags", hashtaggable: true, value: present(@proposal).title %>
2
+ <%= form.text_field :title, class: "js-hashtags", hashtaggable: true, value: form_presenter.title %>
3
3
  </div>
4
4
 
5
5
  <div class="field hashtags__container">
6
- <%= form.text_area :body, rows: 10, class: "js-hashtags", hashtaggable: true, value: present(@proposal).body %>
6
+ <%= form.text_area :body, rows: 10, class: "js-hashtags", hashtaggable: true, value: form_presenter.body(extras: false).strip %>
7
7
  </div>
8
8
 
9
+ <% if @form.component_automatic_hashtags.any? %>
10
+ <div class="field">
11
+ <%= form.label :automatic_hashtags %>
12
+ <div class="checkboxes hashtags">
13
+ <% @form.component_automatic_hashtags.each do |hashtag| %>
14
+ <label>
15
+ <%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
16
+ </label>
17
+ <% end %>
18
+ </div>
19
+ </div>
20
+ <% end %>
21
+
22
+ <% if @form.component_suggested_hashtags.any? %>
23
+ <div class="field">
24
+ <%= form.label :suggested_hashtags %>
25
+ <div class="checkboxes hashtags">
26
+ <%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map {|hashtag| [hashtag.downcase, "##{hashtag}"]}, :first, :last do |option|
27
+ option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text }
28
+ end %>
29
+ </div>
30
+ </div>
31
+ <% end %>
32
+
9
33
  <% if component_settings.geocoding_enabled? %>
10
34
  <div class="field">
11
35
  <%= form.check_box :has_address, checked: form_has_address? %>
@@ -28,7 +52,7 @@
28
52
  </div>
29
53
  <% end %>
30
54
 
31
- <% if Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
55
+ <% if current_organization.user_groups_enabled? && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
32
56
  <div class="field">
33
57
  <%= user_group_select_field form, :user_group_id %>
34
58
  </div>
@@ -12,12 +12,15 @@
12
12
  </div>
13
13
  </div>
14
14
 
15
+ <% if component_settings.amendments_enabled %>
16
+ <%= form.collection_radio_buttons :type, filter_type_values, :first, :last, legend_title: t(".amendment_type") %>
17
+ <% end %>
15
18
  <% if component_settings.official_proposals_enabled %>
16
- <%= form.collection_radio_buttons :origin, [["all", t(".all")], ["official", t(".official")], ["citizens", t(".citizens")]], :first, :last, legend_title: t(".origin") %>
19
+ <%= form.collection_radio_buttons :origin, filter_origin_values, :first, :last, legend_title: t(".origin") %>
17
20
  <% end %>
18
21
 
19
22
  <% if component_settings.proposal_answering_enabled && current_settings.proposal_answering_enabled %>
20
- <%= form.collection_radio_buttons :state, [["except_rejected", t(".except_rejected")], ["accepted", t(".accepted")], ["evaluating", t(".evaluating")], ["rejected", t(".rejected")], ["all", t(".all")]], :first, :last, legend_title: t(".state") %>
23
+ <%= form.collection_radio_buttons :state, filter_state_values, :first, :last, legend_title: t(".state") %>
21
24
  <% end %>
22
25
 
23
26
  <% if linked_classes_for(Decidim::Proposals::Proposal).any? %>
@@ -1 +1,5 @@
1
- <%= card_for proposal, from: proposal %>
1
+ <% if amendments_enabled? %>
2
+ <%= card_for proposal, from: proposal %>
3
+ <% else %>
4
+ <%= card_for proposal, from: proposal if !proposal.emendation? %>
5
+ <% end %>
@@ -5,7 +5,7 @@
5
5
  <%= link_to proposal, target: "_blank" do %>
6
6
  <h5 class="card__title"><%= present(proposal).title %></h5>
7
7
  <% end %>
8
- <%= cell("decidim/coauthorships", proposal, has_actions: false) %>
8
+ <%= cell("decidim/coauthorships", proposal, has_actions: false, context: { current_user: current_user }) %>
9
9
 
10
10
  <div class="tech-info tech-info--text-left">
11
11
  <%= t("decidim.proposals.proposals.proposal.creation_date", date: l(proposal.created_at, format: :decidim_short)) %>
@@ -15,7 +15,7 @@
15
15
 
16
16
  <%== cell("decidim/proposals/proposal_m", proposal).badge %>
17
17
 
18
- <p><%= truncate(present(proposal).html_body, length: 100) %></p>
18
+ <p><%= truncate(present(proposal).body, length: 100) %></p>
19
19
  <%= cell "decidim/tags", proposal, context: { extra_classes: ["tags--proposal"] } %>
20
20
  </div>
21
21
  </article>
@@ -1,46 +1,50 @@
1
1
  <% if proposal.rejected? %>
2
2
  <div></div>
3
3
  <% else %>
4
- <div id="proposal-<%= proposal.id %>-vote-button">
5
- <% if !current_user %>
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: from_proposals_list), resource: proposal, class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
8
- <% else %>
9
- <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.vote"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), resource: proposal, class: "button #{vote_button_classes(from_proposals_list)}", data: { disable: true, "redirect-url": proposal_path(proposal) } %>
10
- <% end %>
11
- <% else %>
12
- <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
13
- <%= action_authorized_button_to(
14
- :vote,
15
- proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list),
16
- resource: proposal,
17
- method: :delete,
18
- remote: true,
19
- data: {
20
- disable: true,
21
- original: t("decidim.proposals.proposals.vote_button.already_voted"),
22
- replace: t("decidim.proposals.proposals.vote_button.already_voted_hover"),
23
- "redirect-url": proposal_path(proposal)
24
- },
25
- class: "button #{vote_button_classes(from_proposals_list)} success light",
26
- id: "vote_button"
27
- ) do %>
28
- <%= icon("check", class: "icon--small") %>
29
- <%= t("decidim.proposals.proposals.vote_button.already_voted") %>
4
+ <% if component_settings.participatory_texts_enabled? && from_proposals_list %>
5
+ <%= render partial: "decidim/proposals/proposals/participatory_texts/proposal_vote_button", locals: { proposal: proposal, from_proposals_list: true } %>
6
+ <% else %>
7
+ <div id="proposal-<%= proposal.id %>-vote-button">
8
+ <% if !current_user %>
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: from_proposals_list), resource: proposal, class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
11
+ <% else %>
12
+ <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.vote"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), resource: proposal, class: "button #{vote_button_classes(from_proposals_list)}", data: { disable: true, "redirect-url": proposal_path(proposal) } %>
30
13
  <% end %>
31
14
  <% else %>
32
- <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
33
- <%= content_tag :span, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
15
+ <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
16
+ <%= action_authorized_button_to(
17
+ :vote,
18
+ proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list),
19
+ resource: proposal,
20
+ method: :delete,
21
+ remote: true,
22
+ data: {
23
+ disable: true,
24
+ original: t("decidim.proposals.proposals.vote_button.already_voted"),
25
+ replace: t("decidim.proposals.proposals.vote_button.already_voted_hover"),
26
+ "redirect-url": proposal_path(proposal)
27
+ },
28
+ class: "button #{vote_button_classes(from_proposals_list)} success light",
29
+ id: "vote_button-#{proposal.id}"
30
+ ) do %>
31
+ <%= icon("check", class: "icon--small") %>
32
+ <%= t("decidim.proposals.proposals.vote_button.already_voted") %>
33
+ <% end %>
34
34
  <% else %>
35
- <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
36
- <%= content_tag :span, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: "button #{vote_button_classes(from_proposals_list)}", disabled: true %>
37
- <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
38
- <%= content_tag :span, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
35
+ <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
36
+ <%= content_tag :span, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
39
37
  <% else %>
40
- <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.vote"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), resource: proposal, remote: true, data: { disable: true, "redirect-url": proposal_path(proposal) }, class: "button #{vote_button_classes(from_proposals_list)}" %>
38
+ <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
39
+ <%= content_tag :span, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: "button #{vote_button_classes(from_proposals_list)}", disabled: true %>
40
+ <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
41
+ <%= content_tag :span, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
42
+ <% else %>
43
+ <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.vote"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), resource: proposal, remote: true, data: { disable: true, "redirect-url": proposal_path(proposal) }, class: "button #{vote_button_classes(from_proposals_list)}" %>
44
+ <% end %>
41
45
  <% end %>
42
46
  <% end %>
43
47
  <% end %>
44
- <% end %>
45
- </div>
48
+ </div>
49
+ <% end %>
46
50
  <% end %>
@@ -1,14 +1,18 @@
1
1
  <% if !current_settings.votes_hidden? && current_component.participatory_space.can_participate?(current_user) %>
2
- <% progress ||= proposal.proposal_votes_count || 0 %>
3
- <% total ||= proposal.maximum_votes || 0 %>
4
- <% subtitle_text = progress >= total ? t("decidim.proposals.proposals.votes_count.most_popular_proposal") : t("decidim.proposals.proposals.votes_count.need_more_votes") %>
5
- <%= cell(
6
- "decidim/progress_bar",
7
- progress,
8
- total: total,
9
- units_name: "decidim.proposals.proposals.votes_count.count",
10
- element_id: "proposal-#{proposal.id}-votes-count",
11
- subtitle_text: subtitle_text,
12
- small: from_proposals_list
13
- ) %>
2
+ <% if component_settings.participatory_texts_enabled? && from_proposals_list %>
3
+ <%= render partial: "decidim/proposals/proposals/participatory_texts/proposal_votes_count", locals: { proposal: proposal, from_proposals_list: true } %>
4
+ <% else %>
5
+ <% progress ||= proposal.proposal_votes_count || 0 %>
6
+ <% total ||= proposal.maximum_votes || 0 %>
7
+ <% subtitle_text = progress >= total ? t("decidim.proposals.proposals.votes_count.most_popular_proposal") : t("decidim.proposals.proposals.votes_count.need_more_votes") %>
8
+ <%= cell(
9
+ "decidim/progress_bar",
10
+ progress,
11
+ total: total,
12
+ units_name: "decidim.proposals.proposals.votes_count.count",
13
+ element_id: "proposal-#{proposal.id}-votes-count",
14
+ subtitle_text: subtitle_text,
15
+ small: from_proposals_list
16
+ ) %>
17
+ <% end %>
14
18
  <% end %>
@@ -15,7 +15,7 @@
15
15
  <%= form.text_area :body, rows: 10, class: "js-hashtags", hashtaggable: true %>
16
16
  </div>
17
17
 
18
- <% if Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
18
+ <% if current_organization.user_groups_enabled? && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
19
19
  <div class="field">
20
20
  <%= user_group_select_field form, :user_group_id %>
21
21
  </div>
@@ -0,0 +1,19 @@
1
+ <div class="p-s">
2
+ <h4><%= t(".document_index") %></h4>
3
+ <div class="text-muted">
4
+ <% @proposals.each do |proposal| %>
5
+ <div class="mb-s">
6
+ <p>
7
+ <%= link_to resource_locator(proposal).path do %>
8
+ <% if proposal.participatory_text_level == "article" %>
9
+ <u><%= present(proposal).title %></u>
10
+ <% else %>
11
+ <u class="text-uppercase"><%= present(proposal).title %></u>
12
+ <% end %>
13
+ <br />
14
+ <% end %>
15
+ </p>
16
+ </div>
17
+ <% end %>
18
+ </div>
19
+ </div>
@@ -0,0 +1,46 @@
1
+ <% if proposal.rejected? %>
2
+ <div></div>
3
+ <% else %>
4
+ <div id="proposal-<%= proposal.id %>-vote-button">
5
+ <% if !current_user %>
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: from_proposals_list), resource: proposal, class: "column button light button--sc disabled", disabled: true %>
8
+ <% else %>
9
+ <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.vote"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), resource: proposal, class: "column button light button--sc", data: { disable: true, "redirect-url": proposal_path(proposal) } %>
10
+ <% end %>
11
+ <% else %>
12
+ <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
13
+ <%= action_authorized_button_to(
14
+ :vote,
15
+ proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list),
16
+ resource: proposal,
17
+ method: :delete,
18
+ remote: true,
19
+ data: {
20
+ disable: true,
21
+ original: t("decidim.proposals.proposals.vote_button.already_voted"),
22
+ replace: t("decidim.proposals.proposals.vote_button.already_voted_hover"),
23
+ "redirect-url": proposal_path(proposal)
24
+ },
25
+ class: "column button light button--sc success",
26
+ id: "vote_button-#{proposal.id}"
27
+ ) do %>
28
+ <%= icon("check", class: "icon--small") %>
29
+ <%= t("decidim.proposals.proposals.vote_button.already_voted") %>
30
+ <% end %>
31
+ <% else %>
32
+ <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
33
+ <%= content_tag :span, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: "column button light button--sc disabled", disabled: true %>
34
+ <% else %>
35
+ <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
36
+ <%= content_tag :span, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: "column button light button--sc", disabled: true %>
37
+ <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
38
+ <%= content_tag :span, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: "column button light button--sc disabled", disabled: true %>
39
+ <% else %>
40
+ <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.vote"), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), resource: proposal, remote: true, data: { disable: true, "redirect-url": proposal_path(proposal) }, class: "column button light button--sc" %>
41
+ <% end %>
42
+ <% end %>
43
+ <% end %>
44
+ <% end %>
45
+ </div>
46
+ <% end %>
@@ -0,0 +1,41 @@
1
+ <% if proposal.rejected? %>
2
+ <div></div>
3
+ <% else %>
4
+ <% if !current_user %>
5
+ <% if current_settings.votes_blocked? %>
6
+ <button type="button" name="button" class="column medium-4 button primary button--sc button--shadow disabled" disabled id="proposal-<%= proposal.id %>-votes-count">
7
+ <%= proposal.proposal_votes_count || 0 %>
8
+ </button>
9
+ <% else %>
10
+ <button type="button" name="button" class="column medium-4 button primary button--sc button--shadow" id="proposal-<%= proposal.id %>-votes-count">
11
+ <%= proposal.proposal_votes_count || 0 %>
12
+ </button>
13
+ <% end %>
14
+ <% else %>
15
+ <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
16
+ <button type="button" name="button" class="column medium-4 button success button--sc button--shadow" id="proposal-<%= proposal.id %>-votes-count">
17
+ <%= proposal.proposal_votes_count || 0 %>
18
+ </button>
19
+ <% else %>
20
+ <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
21
+ <button type="button" name="button" class="column medium-4 button primary button--sc button--shadow disabled" disabled id="proposal-<%= proposal.id %>-votes-count">
22
+ <%= proposal.proposal_votes_count || 0 %>
23
+ </button>
24
+ <% else %>
25
+ <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
26
+ <button type="button" name="button" class="column medium-4 button primary button--sc button--shadow" disabled id="proposal-<%= proposal.id %>-votes-count">
27
+ <%= proposal.proposal_votes_count || 0 %>
28
+ </button>
29
+ <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
30
+ <button type="button" name="button" class="column medium-4 button primary button--sc button--shadow disabled" disabled id="proposal-<%= proposal.id %>-votes-count">
31
+ <%= proposal.proposal_votes_count || 0 %>
32
+ </button>
33
+ <% else %>
34
+ <button type="button" name="button" class="column medium-4 button primary button--sc button--shadow" id="proposal-<%= proposal.id %>-votes-count">
35
+ <%= proposal.proposal_votes_count || 0 %>
36
+ </button>
37
+ <% end %>
38
+ <% end %>
39
+ <% end %>
40
+ <% end %>
41
+ <% end %>