decidim-proposals 0.30.0.rc3 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +0 -12
  3. data/app/cells/decidim/proposals/proposal_g_cell.rb +3 -1
  4. data/app/cells/decidim/proposals/proposal_l_cell.rb +5 -0
  5. data/app/cells/decidim/proposals/proposal_vote/show.erb +12 -8
  6. data/app/controllers/decidim/proposals/proposals_controller.rb +0 -9
  7. data/app/controllers/decidim/proposals/versions_controller.rb +1 -1
  8. data/app/forms/decidim/proposals/admin/proposal_answer_form.rb +0 -15
  9. data/app/helpers/decidim/proposals/application_helper.rb +0 -13
  10. data/app/helpers/decidim/proposals/proposal_votes_helper.rb +39 -16
  11. data/app/helpers/decidim/proposals/proposals_helper.rb +1 -3
  12. data/app/models/decidim/proposals/collaborative_draft.rb +2 -3
  13. data/app/models/decidim/proposals/proposal.rb +0 -5
  14. data/app/models/decidim/proposals/proposal_vote.rb +1 -0
  15. data/app/packs/stylesheets/decidim/proposals/proposals.scss +6 -0
  16. data/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +3 -6
  17. data/app/views/decidim/proposals/proposals/_exit_modal.html.erb +3 -3
  18. data/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +1 -1
  19. data/app/views/decidim/proposals/proposals/_remaining_votes_notification.html.erb +3 -3
  20. data/app/views/decidim/proposals/proposals/_vote_button.html.erb +2 -2
  21. data/app/views/decidim/proposals/proposals/_votes_count.html.erb +1 -1
  22. data/app/views/decidim/proposals/proposals/_voting_rules.html.erb +27 -24
  23. data/app/views/decidim/proposals/proposals/index.html.erb +1 -6
  24. data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +2 -2
  25. data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_votes_count.html.erb +2 -2
  26. data/app/views/decidim/proposals/proposals/show.html.erb +1 -1
  27. data/config/locales/ar.yml +1 -1
  28. data/config/locales/bg.yml +0 -3
  29. data/config/locales/ca-IT.yml +1079 -0
  30. data/config/locales/ca.yml +1 -2
  31. data/config/locales/cs.yml +4 -3
  32. data/config/locales/de.yml +6 -4
  33. data/config/locales/el.yml +2 -1
  34. data/config/locales/en.yml +2 -3
  35. data/config/locales/es-MX.yml +2 -3
  36. data/config/locales/es-PY.yml +2 -3
  37. data/config/locales/es.yml +2 -3
  38. data/config/locales/eu.yml +96 -97
  39. data/config/locales/fi-plain.yml +3 -3
  40. data/config/locales/fi.yml +3 -3
  41. data/config/locales/fr-CA.yml +3 -4
  42. data/config/locales/fr.yml +3 -4
  43. data/config/locales/ga-IE.yml +2 -0
  44. data/config/locales/gl.yml +2 -0
  45. data/config/locales/hu.yml +2 -5
  46. data/config/locales/id-ID.yml +3 -1
  47. data/config/locales/is-IS.yml +5 -0
  48. data/config/locales/it.yml +3 -2
  49. data/config/locales/ja.yml +5 -3
  50. data/config/locales/lt.yml +2 -2
  51. data/config/locales/lv.yml +2 -0
  52. data/config/locales/nl.yml +4 -3
  53. data/config/locales/no.yml +2 -0
  54. data/config/locales/pl.yml +0 -3
  55. data/config/locales/pt-BR.yml +0 -2
  56. data/config/locales/pt.yml +2 -0
  57. data/config/locales/ro-RO.yml +4 -0
  58. data/config/locales/ru.yml +5 -1
  59. data/config/locales/sk.yml +2 -0
  60. data/config/locales/sv.yml +2 -3
  61. data/config/locales/tr-TR.yml +2 -0
  62. data/config/locales/uk.yml +5 -1
  63. data/config/locales/zh-CN.yml +2 -0
  64. data/config/locales/zh-TW.yml +2 -1
  65. data/lib/decidim/proposals/version.rb +1 -1
  66. metadata +21 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 555324c80eedfe348072f67f5b6334273f5422024ecd000e0a3a09c4e32eec42
4
- data.tar.gz: ae328a90906fd92093c6255fa69cd8925393754f85e28243ff1f5605c55ddec7
3
+ metadata.gz: 81bba03dc800ce062b503bcaad10e09f1b3bc016dd02c647dc08f1e893a64f68
4
+ data.tar.gz: 4770709bececf57eef406cf4e879f7be42132a81782911c79c3dc8f16d690035
5
5
  SHA512:
6
- metadata.gz: 49260eaf53b5f57edeaed6e8823c9d653fc73c8dcb12c3e96e14a59f7284e58951a119152624252f68a6861fd9aad6a6ff3e08b584280f82f93cf01152d9bd7f
7
- data.tar.gz: c735d0fdba1fd18fec70df9f03351167a838d12ba9a042674fe43d9355eab0598543091fd8a5597f15ac784bbe11fa3eddcbeba8745c4cf4fe4b32e0a48c0471
6
+ metadata.gz: dc1bf3583428e26ca578f26d84a24cb0b5cb36da2938e143d9fbb23d009b8487a8270e1dc40ab3df9e370cd79bf636a974f22c1b238581aa6e770a995bbe6d2c
7
+ data.tar.gz: 551a0f369ace9f5881edb71d6fc4bc9b4c212e597e5df2cd67b01bbf0300f321db1729ac5fa132d02ebd55763fa18b7247c9522cf22ac8a7ac034738ec958cc9
@@ -10,18 +10,6 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
  </div>
13
-
14
- <div class="flex items-center justify-between space-x-6">
15
- <span class="content-block__span flex-shrink-0">
16
- <%= t("decidim.participatory_spaces.highlighted_proposals.last") %>
17
- </span>
18
- <% if single_component? %>
19
- <%= link_to decidim_proposals.new_proposal_path, class: "button button__xs md:button__lg button__secondary" do %>
20
- <span class="text-center"><%= t("decidim.proposals.actions.new") %></span>
21
- <%= icon "add-line" %>
22
- <% end %>
23
- <% end %>
24
- </div>
25
13
  <div class="flex items-start justify-between">
26
14
  <div class="grow space-y-6">
27
15
  <% proposals_to_render.each do |p| %>
@@ -46,6 +46,7 @@ module Decidim
46
46
 
47
47
  private
48
48
 
49
+ # rubocop:disable Metrics/CyclomaticComplexity
49
50
  def cache_hash
50
51
  @cache_hash ||= begin
51
52
  hash = []
@@ -63,10 +64,11 @@ module Decidim
63
64
  hash << Digest::MD5.hexdigest(model.authors.map(&:cache_key_with_version).to_s)
64
65
  hash << (model.must_render_translation?(model.organization) ? 1 : 0) if model.respond_to?(:must_render_translation?)
65
66
  hash << model.component.participatory_space.active_step.id if model.component.participatory_space.try(:active_step)
66
-
67
+ hash << (current_user&.id || 0)
67
68
  hash.join(Decidim.cache_key_separator)
68
69
  end
69
70
  end
71
+ # rubocop:enable Metrics/CyclomaticComplexity
70
72
 
71
73
  def classes
72
74
  super.merge(metadata: "card__list-metadata")
@@ -27,6 +27,8 @@ module Decidim
27
27
  "decidim/proposals/proposal_vote"
28
28
  end
29
29
 
30
+ # rubocop:disable Metrics/CyclomaticComplexity
31
+ # rubocop:disable Metrics/PerceivedComplexity
30
32
  def cache_hash
31
33
  @cache_hash ||= begin
32
34
  hash = []
@@ -44,9 +46,12 @@ module Decidim
44
46
  hash << Digest::MD5.hexdigest(model.authors.map(&:cache_key_with_version).to_s)
45
47
  hash << (model.must_render_translation?(model.organization) ? 1 : 0) if model.respond_to?(:must_render_translation?)
46
48
  hash << model.component.participatory_space.active_step.id if model.component.participatory_space.try(:active_step)
49
+ hash << (current_user&.id || 0)
47
50
 
48
51
  hash.join(Decidim.cache_key_separator)
49
52
  end
53
+ # rubocop:enable Metrics/PerceivedComplexity
54
+ # rubocop:enable Metrics/CyclomaticComplexity
50
55
  end
51
56
  end
52
57
  end
@@ -1,4 +1,4 @@
1
- <% if !current_settings.votes_hidden? && current_component.participatory_space.can_participate?(current_user) %>
1
+ <% if !current_settings.votes_hidden? && (current_component.participatory_space.can_participate?(current_user) || current_user.admin?) %>
2
2
  <% if component_settings.participatory_texts_enabled? && from_proposals_list %>
3
3
  <%= render partial: "decidim/proposals/proposals/participatory_texts/proposal_votes_count", locals: { proposal: resource, from_proposals_list: true } %>
4
4
  <% else %>
@@ -24,7 +24,7 @@
24
24
  <div id="proposal-<%= resource.id %>-vote-button" class="card__proposals-votes-container">
25
25
  <% if !current_user %>
26
26
  <% if current_settings.votes_blocked? %>
27
- <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.votes_blocked"), proposal_proposal_vote_path(proposal_id: resource, from_proposals_list:), resource: , class: button_classes, disabled: true %>
27
+ <%= action_authorized_button_to :vote, t("decidim.proposals.proposals.vote_button.votes_blocked"), proposal_proposal_vote_path(proposal_id: resource, from_proposals_list:), resource: , class: button_classes, disabled: true, data: { "proposal-vote-button": true } %>
28
28
  <% else %>
29
29
  <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: resource, from_proposals_list:), resource: , class: button_classes, data: { "proposal-vote-button": true, disable: true, "redirect-url": proposal_path(resource) } do %>
30
30
  <%= t("decidim.proposals.proposals.vote_button.vote") %>
@@ -32,7 +32,7 @@
32
32
  <% end %>
33
33
  <% end %>
34
34
  <% else %>
35
- <% if @voted_proposals ? @voted_proposals.include?(resource.id) : resource.voted_by?(current_user) %>
35
+ <% if proposal_voted_by_user?(resource) %>
36
36
  <%= action_authorized_button_to(
37
37
  :vote,
38
38
  proposal_proposal_vote_path(proposal_id: resource, from_proposals_list:),
@@ -40,6 +40,7 @@
40
40
  method: :delete,
41
41
  remote: true,
42
42
  data: {
43
+ "proposal-vote-button": true,
43
44
  disable: true,
44
45
  original: t("decidim.proposals.proposals.vote_button.already_voted"),
45
46
  replace: t("decidim.proposals.proposals.vote_button.already_voted_hover"),
@@ -55,14 +56,17 @@
55
56
  <% end %>
56
57
  <% else %>
57
58
  <% if resource.maximum_votes_reached? && !resource.can_accumulate_votes_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
58
- <%= content_tag :button, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: button_classes, disabled: true %>
59
+ <%= content_tag :button, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: button_classes, disabled: true, data: { "proposal-vote-button": true } %>
59
60
  <% else %>
60
- <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
61
- <%= content_tag :button, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: button_classes, disabled: true %>
61
+ <% if vote_limit_enabled? && remaining_votes_count_for_user == 0 %>
62
+ <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: resource, from_proposals_list:), resource: , remote: true, disabled: true, data: { "proposal-vote-button": true, disable: true, "redirect-url": proposal_path(resource) }, class: button_classes do %>
63
+ <%= t("decidim.proposals.proposals.vote_button.vote") %>
64
+ <span class="sr-only"><%= decidim_html_escape(present(resource).title) %></span>
65
+ <% end %>
62
66
  <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
63
- <%= content_tag :button, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: button_classes, disabled: true %>
67
+ <%= content_tag :button, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: button_classes, disabled: true, data: { "proposal-vote-button": true } %>
64
68
  <% else %>
65
- <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: resource, from_proposals_list:), resource: , remote: true, data: { disable: true, "redirect-url": proposal_path(resource) }, class: button_classes do %>
69
+ <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: resource, from_proposals_list:), resource: , remote: true, data: { "proposal-vote-button": true, "redirect-url": proposal_path(resource) }, class: button_classes do %>
66
70
  <%= t("decidim.proposals.proposals.vote_button.vote") %>
67
71
  <span class="sr-only"><%= decidim_html_escape(present(resource).title) %></span>
68
72
  <% end %>
@@ -48,15 +48,6 @@ module Decidim
48
48
  @proposals = reorder(@proposals)
49
49
  @proposals = paginate(@proposals)
50
50
  @proposals = @proposals.includes(:component, :coauthorships, :attachments)
51
-
52
- @voted_proposals = if current_user
53
- ProposalVote.where(
54
- author: current_user,
55
- proposal: @proposals.pluck(:id)
56
- ).pluck(:decidim_proposal_id)
57
- else
58
- []
59
- end
60
51
  end
61
52
  end
62
53
 
@@ -11,7 +11,7 @@ module Decidim
11
11
  def versioned_resource
12
12
  @versioned_resource ||=
13
13
  if params[:proposal_id]
14
- present(Proposal.where(component: current_component).find(params[:proposal_id]))
14
+ present(Proposal.not_hidden.published.where(component: current_component).find(params[:proposal_id]))
15
15
  else
16
16
  CollaborativeDraft.where(component: current_component).find(params[:collaborative_draft_id])
17
17
  end
@@ -16,20 +16,9 @@ module Decidim
16
16
  attribute :internal_state, String
17
17
 
18
18
  validates :internal_state, presence: true, inclusion: { in: :proposal_states }
19
- validates :answer, translatable_presence: true, if: ->(form) { form.state == "rejected" }
20
-
21
- with_options if: :costs_required? do
22
- validates :cost, numericality: true, presence: true
23
- validates :cost_report, translatable_presence: true
24
- validates :execution_period, translatable_presence: true
25
- end
26
19
 
27
20
  alias state internal_state
28
21
 
29
- def costs_required?
30
- costs_enabled? && state == "accepted"
31
- end
32
-
33
22
  def publish_answer?
34
23
  current_component.current_settings.publish_answers_immediately?
35
24
  end
@@ -39,10 +28,6 @@ module Decidim
39
28
  def proposal_states
40
29
  Decidim::Proposals::ProposalState.where(component: current_component).pluck(:token).map(&:to_s) + ["not_answered"]
41
30
  end
42
-
43
- def costs_enabled?
44
- current_component.current_settings.answers_with_costs?
45
- end
46
31
  end
47
32
  end
48
33
  end
@@ -17,8 +17,6 @@ module Decidim
17
17
  include Decidim::RichTextEditorHelper
18
18
  include Decidim::CheckBoxesTreeHelper
19
19
 
20
- delegate :minimum_votes_per_user, to: :component_settings
21
-
22
20
  # Public: The state of a proposal in a way a human can understand.
23
21
  #
24
22
  # state - The String state of the proposal.
@@ -85,10 +83,6 @@ module Decidim
85
83
  proposal_limit.present?
86
84
  end
87
85
 
88
- def minimum_votes_per_user_enabled?
89
- minimum_votes_per_user.positive?
90
- end
91
-
92
86
  def not_from_collaborative_draft(proposal)
93
87
  proposal.linked_resources(:proposals, "created_from_collaborative_draft").empty?
94
88
  end
@@ -138,13 +132,6 @@ module Decidim
138
132
  component_settings.proposal_limit
139
133
  end
140
134
 
141
- def votes_given
142
- @votes_given ||= ProposalVote.where(
143
- proposal: Proposal.where(component: current_component),
144
- author: current_user
145
- ).count
146
- end
147
-
148
135
  def layout_item_classes
149
136
  if show_voting_rules?
150
137
  "layout-item lg:pt-4"
@@ -4,14 +4,7 @@ module Decidim
4
4
  module Proposals
5
5
  # Simple helpers to handle markup variations for proposal votes partials
6
6
  module ProposalVotesHelper
7
- # Public: Gets the vote limit for each user, if set.
8
- #
9
- # Returns an Integer if set, nil otherwise.
10
- def vote_limit
11
- return nil if component_settings.vote_limit&.zero?
12
-
13
- component_settings.vote_limit
14
- end
7
+ delegate :minimum_votes_per_user, to: :component_settings
15
8
 
16
9
  # Check if the vote limit is enabled for the current component
17
10
  #
@@ -20,6 +13,10 @@ module Decidim
20
13
  vote_limit.present?
21
14
  end
22
15
 
16
+ def minimum_votes_per_user_enabled?
17
+ minimum_votes_per_user.positive?
18
+ end
19
+
23
20
  # Public: Checks if threshold per proposal are set.
24
21
  #
25
22
  # Returns true if set, false otherwise.
@@ -64,17 +61,21 @@ module Decidim
64
61
  current_user && votes_enabled? && vote_limit_enabled? && !votes_blocked?
65
62
  end
66
63
 
64
+ def proposal_voted_by_user?(proposal)
65
+ return false if current_user.blank? || proposal.blank?
66
+
67
+ all_voted_proposals_by_user.include?(proposal.id)
68
+ end
69
+
67
70
  # Return the remaining votes for a user if the current component has a vote limit
68
71
  #
69
72
  # user - A User object
70
73
  #
71
74
  # Returns a number with the remaining votes for that user
72
- def remaining_votes_count_for(user)
75
+ def remaining_votes_count_for_user
73
76
  return 0 unless vote_limit_enabled?
74
77
 
75
- proposals = Proposal.where(component: current_component)
76
- votes_count = ProposalVote.where(author: user, proposal: proposals).size
77
- component_settings.vote_limit - votes_count
78
+ component_settings.vote_limit - votes_given
78
79
  end
79
80
 
80
81
  # Return the remaining minimum votes for a user if the current component has a vote limit
@@ -82,12 +83,34 @@ module Decidim
82
83
  # user - A User object
83
84
  #
84
85
  # Returns a number with the remaining minimum votes for that user
85
- def remaining_minimum_votes_count_for(user)
86
- return 0 unless vote_limit_enabled?
86
+ def remaining_minimum_votes_count_for_user
87
+ return 0 unless minimum_votes_per_user_enabled?
88
+
89
+ component_settings.minimum_votes_per_user - votes_given
90
+ end
91
+
92
+ private
93
+
94
+ def votes_given
95
+ @votes_given ||= all_voted_proposals_by_user.length
96
+ end
97
+
98
+ # Gets the vote limit for each user, if set.
99
+ #
100
+ # Returns an Integer if set, nil otherwise.
101
+ def vote_limit
102
+ return nil if component_settings.vote_limit&.zero?
103
+
104
+ component_settings.vote_limit
105
+ end
87
106
 
88
- votes_count = Decidim::Proposals::ProposalVote.joins(:proposal).where(decidim_proposals_proposals: { decidim_component_id: current_component.id }).where(author: user).count
107
+ def all_voted_proposals_by_user
108
+ return [] if current_user.blank?
89
109
 
90
- component_settings.minimum_votes_per_user - votes_count
110
+ @all_voted_proposals ||= ProposalVote.where(
111
+ proposal: Proposal.where(component: current_component),
112
+ author: current_user
113
+ ).pluck(:decidim_proposal_id)
91
114
  end
92
115
  end
93
116
  end
@@ -12,9 +12,7 @@ module Decidim
12
12
  end
13
13
 
14
14
  def proposal_has_costs?
15
- @proposal.cost.present? &&
16
- translated_attribute(@proposal.cost_report).present? &&
17
- translated_attribute(@proposal.execution_period).present?
15
+ @proposal.cost.present?
18
16
  end
19
17
 
20
18
  def toggle_view_mode_link(current_mode, target_mode, title, params)
@@ -46,9 +46,8 @@ module Decidim
46
46
  authored_by?(user)
47
47
  end
48
48
 
49
- # Public: Overrides the `reported_content_url` Reportable concern method.
50
- def reported_content_url
51
- ResourceLocatorPresenter.new(self).url
49
+ def presenter
50
+ Decidim::Proposals::CollaborativeDraftPresenter.new(self)
52
51
  end
53
52
 
54
53
  # Public: Overrides the `reported_attributes` Reportable concern method.
@@ -303,11 +303,6 @@ module Decidim
303
303
  state == "evaluating"
304
304
  end
305
305
 
306
- # Public: Overrides the `reported_content_url` Reportable concern method.
307
- def reported_content_url
308
- ResourceLocatorPresenter.new(self).url
309
- end
310
-
311
306
  # Returns the presenter for this author, to be used in the views.
312
307
  # Required by ResourceRenderer.
313
308
  def presenter
@@ -31,6 +31,7 @@ module Decidim
31
31
 
32
32
  def update_proposal_votes_count
33
33
  proposal.update_votes_count
34
+ proposal.touch # rubocop:disable Rails/SkipsModelValidations
34
35
  end
35
36
 
36
37
  # Private: check if the proposal and the author have the same organization
@@ -400,3 +400,9 @@
400
400
  @apply lg:col-start-2 lg:col-span-10;
401
401
  }
402
402
  }
403
+
404
+ .card__proposals-item {
405
+ & + & {
406
+ @apply mt-6;
407
+ }
408
+ }
@@ -23,12 +23,10 @@
23
23
  morphdom($remainingVotesCount[0], '<%= j(render partial: "decidim/proposals/proposals/remaining_votes_count").strip.html_safe %>');
24
24
  }
25
25
 
26
- <% if remaining_votes_count_for(current_user) == 0 %>
26
+ <% if remaining_votes_count_for_user == 0 %>
27
27
  $notVotedButtons.attr('disabled', true);
28
- $notVotedButtons.text('<%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %>');
29
28
  <% else %>
30
29
  $notVotedButtons.attr('disabled', false);
31
- $notVotedButtons.text('<%= t("decidim.proposals.proposals.vote_button.vote") %>');
32
30
  <% end %>
33
31
  }());
34
32
  <% end %>
@@ -44,9 +42,8 @@
44
42
  morphdom($votingRules[0], '<%= j(render partial: "decidim/proposals/proposals/voting_rules").strip.html_safe %>');
45
43
  }
46
44
 
47
- <% if remaining_minimum_votes_count_for(current_user).zero? %>
45
+ <% if minimum_votes_per_user_enabled? && remaining_minimum_votes_count_for_user.zero? %>
48
46
  $votingRulesNode.prepend(`<%= j(render partial: "decidim/proposals/proposals/notification_alert_box").strip.html_safe %>`)
49
-
50
47
  <% end %>
51
48
  if ($exitProposalModal[0]) {
52
49
  morphdom($exitProposalModal[0], '<%= j(render partial: "decidim/proposals/proposals/exit_modal").strip.html_safe %>')
@@ -56,7 +53,7 @@
56
53
  }
57
54
 
58
55
  if ($remainingVotesNotification[0]) {
59
- morphdom($remainingVotesNotification[0], '<%= j(render partial: "decidim/proposals/proposals/remaining_votes_notification").strip.html_safe %>')
56
+ morphdom($remainingVotesNotification[0], '<%= j(render partial: "decidim/proposals/proposals/remaining_votes_notification").strip.html_safe %>');
60
57
  }
61
58
  }());
62
59
  <% end %>
@@ -1,11 +1,11 @@
1
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) %>">
2
+ <div data-dialog-container data-minimum-votes-reached="<%= remaining_minimum_votes_count_for_user.zero? %>" data-minimum-votes-count="<%= minimum_votes_per_user - remaining_minimum_votes_count_for_user %>">
3
3
  <%= icon "information-line" %>
4
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)) %>
5
+ <%= t("title", scope: "decidim.proposals.exit_modal", number: remaining_minimum_votes_count_for_user) %>
6
6
  </h3>
7
7
  <p id="dialog-desc-budget-modal">
8
- <%= t("message", scope: "decidim.proposals.exit_modal", number: remaining_minimum_votes_count_for(current_user)) %>
8
+ <%= t("message", scope: "decidim.proposals.exit_modal", number: remaining_minimum_votes_count_for_user) %>
9
9
  </p>
10
10
  </div>
11
11
  <div data-dialog-actions>
@@ -1,3 +1,3 @@
1
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)) %>
2
+ <%= t("votes", scope: "decidim.proposals.proposals.voting_rules.vote_limit", number: remaining_minimum_votes_count_for_user) %>
3
3
  </div>
@@ -1,12 +1,12 @@
1
1
  <%= alert_box(
2
2
  message(
3
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)))
4
+ concat content_tag(:strong, t("already_vote.title", scope: "decidim.proposals.proposals.voting_rules", number: remaining_minimum_votes_count_for_user))
5
+ concat content_tag(:p, t("already_vote.description", scope: "decidim.proposals.proposals.voting_rules", number: remaining_minimum_votes_count_for_user))
6
6
  concat link_to(t("already_vote.see_other_proposals", scope: "decidim.proposals.proposals.voting_rules"), proposals_path, class: "no-modal")
7
7
  end
8
8
  ),
9
9
  :secondary,
10
10
  true,
11
- { id: "remaining-votes-notification", class: "flash secondary #{"hidden" unless remaining_minimum_votes_count_for(current_user).positive?}" }
11
+ { id: "remaining-votes-notification", class: "flash secondary #{"hidden" unless remaining_minimum_votes_count_for_user.positive?}" }
12
12
  ) %>
@@ -17,7 +17,7 @@
17
17
  <% end %>
18
18
  <% end %>
19
19
  <% else %>
20
- <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
20
+ <% if proposal_voted_by_user?(proposal) %>
21
21
  <%= action_authorized_button_to(
22
22
  :vote,
23
23
  proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:),
@@ -42,7 +42,7 @@
42
42
  <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_votes_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
43
43
  <%= content_tag :button, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: button_classes, data: { "proposal-vote-button": true }, disabled: true %>
44
44
  <% else %>
45
- <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
45
+ <% if vote_limit_enabled? && remaining_votes_count_for_user == 0 %>
46
46
  <%= content_tag :button, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: button_classes, data: { "proposal-vote-button": true }, disabled: true %>
47
47
  <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
48
48
  <%= content_tag :button, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: button_classes, data: { "proposal-vote-button": true }, disabled: true %>
@@ -1,4 +1,4 @@
1
- <% if !current_settings.votes_hidden? && current_component.participatory_space.can_participate?(current_user) %>
1
+ <% if !current_settings.votes_hidden? && (current_component.participatory_space.can_participate?(current_user) || current_user.admin?) %>
2
2
  <% if component_settings.participatory_texts_enabled? && from_proposals_list %>
3
3
  <%= render partial: "decidim/proposals/proposals/participatory_texts/proposal_votes_count", locals: { proposal:, from_proposals_list: true } %>
4
4
  <% else %>
@@ -1,31 +1,34 @@
1
1
  <% if show_voting_rules? %>
2
- <% announcement_body = capture do %>
3
- <div class="editor-content">
4
- <ul class="mt-0 mb-2">
5
- <% if vote_limit_enabled? %>
6
- <li><%= t(".vote_limit.description", limit: component_settings.vote_limit) %></li>
7
- <% end %>
2
+ <div class="item_voting_rules">
3
+ <%= render partial: "decidim/proposals/proposals/remaining_votes_notification" %>
4
+ <% announcement_body = capture do %>
5
+ <div class="editor-content">
6
+ <ul class="mt-0 mb-2">
7
+ <% if vote_limit_enabled? %>
8
+ <li><%= t(".vote_limit.description", limit: component_settings.vote_limit) %></li>
9
+ <% end %>
8
10
 
9
- <% if proposal_limit_enabled? %>
10
- <li><%= t(".proposal_limit.description", limit: proposal_limit) %></li>
11
- <% end %>
11
+ <% if proposal_limit_enabled? %>
12
+ <li><%= t(".proposal_limit.description", limit: proposal_limit) %></li>
13
+ <% end %>
12
14
 
13
- <% if threshold_per_proposal_enabled? %>
14
- <li><%= t(".threshold_per_proposal.description", limit: threshold_per_proposal) %></li>
15
- <% end %>
15
+ <% if threshold_per_proposal_enabled? %>
16
+ <li><%= t(".threshold_per_proposal.description", limit: threshold_per_proposal) %></li>
17
+ <% end %>
16
18
 
17
- <% if can_accumulate_votes_beyond_threshold? %>
18
- <li><%= t(".can_accumulate_votes_beyond_threshold.description", limit: threshold_per_proposal) %></li>
19
- <% end %>
19
+ <% if can_accumulate_votes_beyond_threshold? %>
20
+ <li><%= t(".can_accumulate_votes_beyond_threshold.description", limit: threshold_per_proposal) %></li>
21
+ <% end %>
20
22
 
21
- <% if minimum_votes_per_user_enabled? %>
22
- <li>
23
- <%= t(".minimum_votes_per_user.description", votes: minimum_votes_per_user) %>
24
- </li>
25
- <% end %>
26
- </ul>
27
- </div>
28
- <% end %>
23
+ <% if minimum_votes_per_user_enabled? %>
24
+ <li>
25
+ <%= t(".minimum_votes_per_user.description", votes: minimum_votes_per_user) %>
26
+ </li>
27
+ <% end %>
28
+ </ul>
29
+ </div>
30
+ <% end %>
29
31
 
30
- <%= cell("decidim/announcement", { title: t(".title"), body: announcement_body }, id: "voting-rules") %>
32
+ <%= cell("decidim/announcement", { title: t(".title"), body: announcement_body }, id: "voting-rules") %>
33
+ </div>
31
34
  <% end %>
@@ -43,12 +43,7 @@
43
43
  <% end %>
44
44
 
45
45
  <%= render partial: "decidim/shared/component_announcement" %>
46
-
47
- <% if show_voting_rules? %>
48
- <section class="layout-main__section">
49
- <%= render partial: "voting_rules" %>
50
- </section>
51
- <% end %>
46
+ <%= render partial: "voting_rules" %>
52
47
 
53
48
  <section id="proposals" class="layout-main__section layout-main__heading">
54
49
  <%= render partial: "proposals" %>
@@ -14,7 +14,7 @@
14
14
  <% end %>
15
15
  <% end %>
16
16
  <% else %>
17
- <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
17
+ <% if proposal_voted_by_user?(proposal) %>
18
18
  <%= action_authorized_button_to(
19
19
  :vote,
20
20
  proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:),
@@ -38,7 +38,7 @@
38
38
  <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_votes_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
39
39
  <%= content_tag :span, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: "column button light button--sc disabled", disabled: true %>
40
40
  <% else %>
41
- <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
41
+ <% if vote_limit_enabled? && remaining_votes_count_for_user == 0 %>
42
42
  <%= content_tag :span, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: "column button light button--sc", disabled: true %>
43
43
  <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
44
44
  <%= content_tag :span, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: "column button light button--sc disabled", disabled: true %>
@@ -12,7 +12,7 @@
12
12
  </button>
13
13
  <% end %>
14
14
  <% else %>
15
- <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
15
+ <% if proposal_voted_by_user?(proposal) %>
16
16
  <button type="button" name="button" class="column button success button--sc" id="proposal-<%= proposal.id %>-votes-count">
17
17
  <%= proposal.proposal_votes_count || 0 %>
18
18
  </button>
@@ -22,7 +22,7 @@
22
22
  <%= proposal.proposal_votes_count || 0 %>
23
23
  </button>
24
24
  <% else %>
25
- <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
25
+ <% if vote_limit_enabled? && remaining_votes_count_for_user == 0 %>
26
26
  <button type="button" name="button" class="column button button--sc" disabled id="proposal-<%= proposal.id %>-votes-count">
27
27
  <%= proposal.proposal_votes_count || 0 %>
28
28
  </button>
@@ -41,7 +41,7 @@ extra_admin_link(
41
41
  <%= render layout: "layouts/decidim/shared/layout_item", locals: { back_path: component_settings.participatory_texts_enabled? ? main_component_path(current_component) : proposals_path } do %>
42
42
 
43
43
  <section class="layout-main__section layout-main__heading">
44
- <% if show_voting_rules? && remaining_minimum_votes_count_for(current_user).positive? && current_component.participatory_space.can_participate?(current_user) %>
44
+ <% if show_voting_rules? && remaining_minimum_votes_count_for_user.positive? && current_component.participatory_space.can_participate?(current_user) %>
45
45
  <%= render partial: "exit_modal" %>
46
46
  <% end %>
47
47
 
@@ -299,6 +299,7 @@ ar:
299
299
  title: اقتراحات
300
300
  votes:
301
301
  object: أصوات
302
+ title: الأصوات
302
303
  participatory_spaces:
303
304
  highlighted_proposals:
304
305
  see_all: شاهد الكل
@@ -631,7 +632,6 @@ ar:
631
632
  text_banner: أنت تتطلع على قائمة الاقتراحات المسحوبة من قبل مؤلفيها. %{go_back_link}.
632
633
  new:
633
634
  send: استمر
634
- title: إنشاء اقتراحك
635
635
  orders:
636
636
  label: 'ترتيب المقترحات حسب:'
637
637
  most_commented: الأكثر تعليقًا عليها