From 9154614577d8f06980d6f87102ed29fc4026bdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 1 Oct 2021 02:06:42 +0200 Subject: [PATCH 1/6] Always show not allowed message in legislation debates This message is only shown in the `show` action, so it's shown at most once in the whole page, so it doesn't take up too much space and it isn't as overwhelming as if we were showing it on the index page, once per debate. We're only showing it when there are closed options, though, since there's already a message to sign in to comment when the question accepts open answers. --- app/assets/javascripts/votes.js | 1 - app/assets/stylesheets/participation.scss | 4 ++++ app/views/legislation/questions/_answer_form.html.erb | 4 +++- .../questions/_participation_not_allowed.html.erb | 8 ++++---- app/views/legislation/questions/show.html.erb | 1 - 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/votes.js b/app/assets/javascripts/votes.js index c782d428b..be8f73a51 100644 --- a/app/assets/javascripts/votes.js +++ b/app/assets/javascripts/votes.js @@ -14,7 +14,6 @@ initialize: function() { App.Votes.hoverize("div.votes"); App.Votes.hoverize("div.supports"); - App.Votes.hoverize("div.debate-questions"); App.Votes.hoverize("div.comment-footer"); } }; diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 33509d545..6a80b0ed8 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -327,6 +327,10 @@ } } +.debate-questions .debate-questions .participation-not-allowed { + position: static; +} + .bullet { color: $text; } diff --git a/app/views/legislation/questions/_answer_form.html.erb b/app/views/legislation/questions/_answer_form.html.erb index 6030b57de..8499082fa 100644 --- a/app/views/legislation/questions/_answer_form.html.erb +++ b/app/views/legislation/questions/_answer_form.html.erb @@ -1,5 +1,5 @@ <% if question.question_options.any? %> - <% if process.debate_phase.open? && !answer.persisted? %> + <% if process.debate_phase.open? && !answer.persisted? && can?(:create, Legislation::Answer) %> <%= form_for answer, url: legislation_process_question_answers_path(process, question, answer), remote: true, html: { class: "controls-stacked" } do |f| %> <% question.question_options.each do |question_option| %> @@ -25,4 +25,6 @@ <% end %> + + <%= render "participation_not_allowed" %> <% end %> diff --git a/app/views/legislation/questions/_participation_not_allowed.html.erb b/app/views/legislation/questions/_participation_not_allowed.html.erb index 9bbc88c9a..4e72372bb 100644 --- a/app/views/legislation/questions/_participation_not_allowed.html.erb +++ b/app/views/legislation/questions/_participation_not_allowed.html.erb @@ -1,23 +1,23 @@ <% if user_signed_in? && current_user.organization? %> - <% end %> - <% if reason.present? && !voted? %> -
- -
- <% end %> + <%= render Shared::ParticipationNotAllowedComponent.new(investment, cannot_vote_text: cannot_vote_text) %> diff --git a/app/components/budgets/investments/ballot_component.rb b/app/components/budgets/investments/ballot_component.rb index 016ff1bac..539e80afd 100644 --- a/app/components/budgets/investments/ballot_component.rb +++ b/app/components/budgets/investments/ballot_component.rb @@ -1,7 +1,6 @@ class Budgets::Investments::BallotComponent < ApplicationComponent attr_reader :investment, :investment_ids, :ballot, :assigned_heading - delegate :current_user, :heading_link, :link_to_signin, :link_to_signup, - :link_to_verify_account, to: :helpers + delegate :current_user, :heading_link, :link_to_verify_account, to: :helpers def initialize(investment:, investment_ids:, ballot:, assigned_heading:) @investment = investment @@ -42,4 +41,14 @@ class Budgets::Investments::BallotComponent < ApplicationComponent link_to(t("budgets.ballots.reasons_for_not_balloting.change_ballot"), budget_ballot_path(budget)) end + + def cannot_vote_text + if reason.present? && !voted? + t("budgets.ballots.reasons_for_not_balloting.#{reason}", + verify_account: link_to_verify_account, + my_heading: link_to_my_heading, + change_ballot: link_to_change_ballot, + heading_link: heading_link(assigned_heading, budget)) + end + end end diff --git a/app/components/budgets/investments/votes_component.html.erb b/app/components/budgets/investments/votes_component.html.erb index 5ba4b299c..bb16453c3 100644 --- a/app/components/budgets/investments/votes_component.html.erb +++ b/app/components/budgets/investments/votes_component.html.erb @@ -34,21 +34,7 @@ <% end %> - <% if reason.present? && !user_voted_for? %> -
- -
- <% end %> + <%= render Shared::ParticipationNotAllowedComponent.new(investment, cannot_vote_text: cannot_vote_text) %> <% if user_voted_for? && setting["twitter_handle"] %>
diff --git a/app/components/budgets/investments/votes_component.rb b/app/components/budgets/investments/votes_component.rb index 65e6251b4..2a8877db2 100644 --- a/app/components/budgets/investments/votes_component.rb +++ b/app/components/budgets/investments/votes_component.rb @@ -1,7 +1,6 @@ class Budgets::Investments::VotesComponent < ApplicationComponent attr_reader :investment - delegate :namespace, :current_user, :image_absolute_url, - :link_to_verify_account, :link_to_signin, :link_to_signup, to: :helpers + delegate :namespace, :current_user, :image_absolute_url, :link_to_verify_account, to: :helpers def initialize(investment) @investment = investment @@ -59,4 +58,13 @@ class Budgets::Investments::VotesComponent < ApplicationComponent def remove_support_aria_label t("budgets.investments.votes.remove_support_label", investment: investment.title) end + + def cannot_vote_text + if reason.present? && !user_voted_for? + t("votes.budget_investments.#{reason}", + count: investment.group.max_votable_headings, + verify_account: link_to_verify_account, + supported_headings: (current_user && current_user.headings_voted_within_group(investment.group).map(&:name).sort.to_sentence)) + end + end end diff --git a/app/components/debates/votes_component.html.erb b/app/components/debates/votes_component.html.erb index 659a5054c..d822145d4 100644 --- a/app/components/debates/votes_component.html.erb +++ b/app/components/debates/votes_component.html.erb @@ -5,21 +5,5 @@ <%= t("debates.debate.votes", count: debate.votes_score) %> - <% if !current_user %> -
- <%= render "shared/login_to_vote" %> -
- <% elsif organization? %> - - <% elsif !can_vote? %> - - <% end %> + <%= render Shared::ParticipationNotAllowedComponent.new(debate, cannot_vote_text: cannot_vote_text) %>
diff --git a/app/components/debates/votes_component.rb b/app/components/debates/votes_component.rb index b8fbed82b..7ebba83cf 100644 --- a/app/components/debates/votes_component.rb +++ b/app/components/debates/votes_component.rb @@ -12,7 +12,7 @@ class Debates::VotesComponent < ApplicationComponent debate.votable_by?(current_user) end - def organization? - current_user&.organization? + def cannot_vote_text + t("votes.anonymous", verify_account: link_to_verify_account) unless can_vote? end end diff --git a/app/components/legislation/proposals/votes_component.html.erb b/app/components/legislation/proposals/votes_component.html.erb index 86620b33e..c85edf51c 100644 --- a/app/components/legislation/proposals/votes_component.html.erb +++ b/app/components/legislation/proposals/votes_component.html.erb @@ -7,24 +7,7 @@ <%= t("proposals.proposal.votes", count: proposal.votes_score) %> - <% if !current_user %> -
- <%= render "shared/login_to_vote" %> -
- <% elsif organization? %> - - <% elsif !can_vote? %> - - <% end %> + <%= render Shared::ParticipationNotAllowedComponent.new(proposal, cannot_vote_text: cannot_vote_text) %> <% if current_user&.voted_as_when_voted_for(proposal) && setting["twitter_handle"] %>
diff --git a/app/components/legislation/proposals/votes_component.rb b/app/components/legislation/proposals/votes_component.rb index a93d69683..96495800f 100644 --- a/app/components/legislation/proposals/votes_component.rb +++ b/app/components/legislation/proposals/votes_component.rb @@ -12,7 +12,7 @@ class Legislation::Proposals::VotesComponent < ApplicationComponent proposal.votable_by?(current_user) end - def organization? - current_user&.organization? + def cannot_vote_text + t("legislation.proposals.not_verified", verify_account: link_to_verify_account) unless can_vote? end end diff --git a/app/components/proposals/votes_component.html.erb b/app/components/proposals/votes_component.html.erb index 667a92fb0..1d1ea009d 100644 --- a/app/components/proposals/votes_component.html.erb +++ b/app/components/proposals/votes_component.html.erb @@ -19,25 +19,7 @@ <% end %>
- <% if !current_user %> -
- <%= render "shared/login_to_vote" %> -
- <% elsif organization? %> - - <% elsif !can_vote? %> -
- -
- <% end %> + <%= render Shared::ParticipationNotAllowedComponent.new(proposal, cannot_vote_text: cannot_vote_text) %> <% if voted? && setting["twitter_handle"] %>
diff --git a/app/components/proposals/votes_component.rb b/app/components/proposals/votes_component.rb index 6fbf7d351..5718b72eb 100644 --- a/app/components/proposals/votes_component.rb +++ b/app/components/proposals/votes_component.rb @@ -25,7 +25,7 @@ class Proposals::VotesComponent < ApplicationComponent t("proposals.proposal.support_label", proposal: proposal.title) end - def organization? - current_user&.organization? + def cannot_vote_text + t("votes.verified_only", verify_account: link_to_verify_account) unless can_vote? end end diff --git a/app/components/shared/participation_not_allowed_component.html.erb b/app/components/shared/participation_not_allowed_component.html.erb new file mode 100644 index 000000000..6a7459e64 --- /dev/null +++ b/app/components/shared/participation_not_allowed_component.html.erb @@ -0,0 +1,5 @@ +
+ +
diff --git a/app/components/shared/participation_not_allowed_component.rb b/app/components/shared/participation_not_allowed_component.rb new file mode 100644 index 000000000..1cabdb53c --- /dev/null +++ b/app/components/shared/participation_not_allowed_component.rb @@ -0,0 +1,30 @@ +class Shared::ParticipationNotAllowedComponent < ApplicationComponent + attr_reader :votable, :cannot_vote_text + delegate :current_user, :link_to_signin, :link_to_signup, to: :helpers + + def initialize(votable, cannot_vote_text:) + @votable = votable + @cannot_vote_text = cannot_vote_text + end + + def render? + body.present? + end + + private + + def body + @body ||= + if !current_user + sanitize(t("users.login_to_continue", signin: link_to_signin, signup: link_to_signup)) + elsif organization? + tag.p t("votes.organizations") + elsif cannot_vote_text.present? + tag.p sanitize(cannot_vote_text) + end + end + + def organization? + current_user&.organization? + end +end diff --git a/app/views/shared/_login_to_vote.html.erb b/app/views/shared/_login_to_vote.html.erb deleted file mode 100644 index 20ff9c5ce..000000000 --- a/app/views/shared/_login_to_vote.html.erb +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml index 4e2fb88bb..99a49af9a 100644 --- a/config/locales/en/budgets.yml +++ b/config/locales/en/budgets.yml @@ -31,9 +31,7 @@ en: voted_info_2: "But you can change your vote at any time until this phase is closed." zero: You have not voted any investment project. reasons_for_not_balloting: - not_logged_in: You must %{signin} or %{signup} to continue. not_verified: Only verified users can vote on investments; %{verify_account}. - organization: Organizations are not permitted to vote not_selected: Unselected investment projects can not be supported not_enough_money: "You have already assigned the available budget.
Remember you can %{change_ballot} at any time" no_ballots_allowed: Selecting phase is closed diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index eebed8c93..01477295b 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -855,9 +855,7 @@ en: supports: Supports verified_only: Only verified users can vote on proposals; %{verify_account}. budget_investments: - not_logged_in: You must %{signin} or %{signup} to continue. not_verified: Only verified users can vote on investment projects; %{verify_account}. - organization: Organizations are not permitted to vote unfeasible: Unfeasible investment projects can not be supported not_voting_allowed: Voting phase is closed different_heading_assigned: diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml index 6d892076b..1fea405b4 100644 --- a/config/locales/es/budgets.yml +++ b/config/locales/es/budgets.yml @@ -31,9 +31,7 @@ es: voted_info_2: "Pero puedes cambiarlos en cualquier momento hasta el cierre de esta fase." zero: Todavía no has votado ningún proyecto de gasto. reasons_for_not_balloting: - not_logged_in: Necesitas %{signin} o %{signup} para continuar. not_verified: Los proyectos de gasto sólo pueden ser apoyados por usuarios verificados, %{verify_account}. - organization: Las organizaciones no pueden votar. not_selected: No se pueden votar proyectos inviables. not_enough_money: "Ya has asignado el presupuesto disponible.
Recuerda que puedes %{change_ballot} en cualquier momento" no_ballots_allowed: El periodo de votación está cerrado. diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 3c18e9b39..c76541d7e 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -855,9 +855,7 @@ es: supports: Apoyos verified_only: Las propuestas sólo pueden ser votadas por usuarios verificados, %{verify_account}. budget_investments: - not_logged_in: Necesitas %{signin} o %{signup} para continuar. not_verified: Los proyectos de gasto sólo pueden ser apoyadas por usuarios verificados, %{verify_account}. - organization: Las organizaciones no pueden votar. unfeasible: No se pueden votar propuestas inviables. not_voting_allowed: El periodo de votación está cerrado. different_heading_assigned: diff --git a/spec/components/shared/participation_not_allowed_component_spec.rb b/spec/components/shared/participation_not_allowed_component_spec.rb new file mode 100644 index 000000000..10faf446a --- /dev/null +++ b/spec/components/shared/participation_not_allowed_component_spec.rb @@ -0,0 +1,70 @@ +require "rails_helper" + +describe Shared::ParticipationNotAllowedComponent do + let(:votable) { create(:proposal) } + + context "Without cannot vote text" do + let(:component) { Shared::ParticipationNotAllowedComponent.new(votable, cannot_vote_text: nil) } + + it "asks anonymous users to sign in or sign up" do + render_inline component + + expect(page).to have_content "You must sign in or sign up to continue" + expect(page).to have_link "sign in" + expect(page).to have_link "sign up" + end + + it "says voting is not allowed to organizations" do + sign_in(create(:organization, user: create(:user, :level_two)).user) + + render_inline component + + expect(page).to have_content "Organizations are not permitted to vote" + expect(page).not_to have_link "sign in", visible: :all + expect(page).not_to have_link "sign up", visible: :all + end + + it "is not rendered to regular users" do + sign_in(create(:user)) + + render_inline component + + expect(page).not_to be_rendered + end + end + + context "With cannot vote text" do + let(:component) { Shared::ParticipationNotAllowedComponent.new(votable, cannot_vote_text: "Too old") } + + it "ignores the text and asks anonymous users to sign in or sign up" do + render_inline component + + expect(page).to have_content "You must sign in or sign up to continue" + expect(page).to have_link "sign in" + expect(page).to have_link "sign up" + expect(page).not_to have_content "Too old" + end + + it "ignores the text and says voting is not allowed to organizations" do + sign_in(create(:organization, user: create(:user, :level_two)).user) + + render_inline component + + expect(page).to have_content "Organizations are not permitted to vote" + expect(page).not_to have_link "sign in", visible: :all + expect(page).not_to have_link "sign up", visible: :all + expect(page).not_to have_content "Too old" + end + + it "renders the cannot vote text to regular users" do + sign_in(create(:user)) + + render_inline component + + expect(page).to have_content "Too old" + expect(page).not_to have_content "Organizations are not permitted to vote" + expect(page).not_to have_link "sign in", visible: :all + expect(page).not_to have_link "sign up", visible: :all + end + end +end From abec716308535fc93201cfbeb5b0259d37e36e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 19 Feb 2022 13:05:56 +0100 Subject: [PATCH 6/6] Show "not allowed" message on click Defining a behavior on hover means making it different for people using a keyboard or a touchscreen (most of the population, nowadays). In this case, we had an accessibility issue where the message wouldn't disappear once it appeared. That meant that, after tabbing through all the links and buttons in, for instance, the debates index, the page would be filled with "participation not allowed" messages, and in order to see the information about how many people have voted, reloading the page was required. For touchscreen users the behavior was similar to what we get on hover, although we've found some inconsistencies when trying to support several elements on the same page. We think in proposals it makes sense to hide the "support" button when users click on it, and the same applies to the buttonsto support and vote investment projects. However, we aren't hiding the buttons to agree/disagree with a debate in order to keep the information about the current number of people agreeing and disagreeing visible. Note we're removing some support spec methods because after these changes the duplication isn't as obvious as it was in the past. --- app/assets/javascripts/application.js | 4 +- .../javascripts/participation_not_allowed.js | 29 ++++++++++ app/assets/javascripts/votes.js | 19 ------- app/assets/stylesheets/in_favor_against.scss | 32 ++++++----- app/assets/stylesheets/participation.scss | 12 +--- .../investments/ballot_component.html.erb | 1 - .../investments/votes_component.html.erb | 1 - .../debates/votes_component.html.erb | 4 +- .../proposals/votes_component.html.erb | 4 +- .../proposals/votes_component.html.erb | 1 - .../in_favor_against_component.html.erb | 6 +- ...rticipation_not_allowed_component.html.erb | 6 +- .../investments/ballot_component_spec.rb | 2 +- .../investments/votes_component_spec.rb | 5 +- .../debates/votes_component_spec.rb | 6 +- .../proposals/votes_component_spec.rb | 6 +- .../proposals/votes_component_spec.rb | 10 ++-- spec/support/common_actions.rb | 1 - spec/support/common_actions/budgets.rb | 5 -- spec/support/common_actions/votes.rb | 16 ------ spec/system/budget_polls/voter_spec.rb | 6 +- spec/system/budgets/ballots_spec.rb | 57 +++++++++---------- spec/system/budgets/votes_spec.rb | 5 +- spec/system/votes_spec.rb | 43 +++++++++----- 24 files changed, 135 insertions(+), 146 deletions(-) create mode 100644 app/assets/javascripts/participation_not_allowed.js delete mode 100644 app/assets/javascripts/votes.js delete mode 100644 spec/support/common_actions/votes.rb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0521eac84..6f6203f6e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -65,7 +65,7 @@ //= require jquery.amsify.suggestags //= require tags //= require users -//= require votes +//= require participation_not_allowed //= require advanced_search //= require registration_form //= require suggest @@ -122,7 +122,7 @@ var initialize_modules = function() { App.Questions.initialize(); App.Comments.initialize(); App.Users.initialize(); - App.Votes.initialize(); + App.ParticipationNotAllowed.initialize(); App.Tags.initialize(); App.FoundationExtras.initialize(); App.LocationChanger.initialize(); diff --git a/app/assets/javascripts/participation_not_allowed.js b/app/assets/javascripts/participation_not_allowed.js new file mode 100644 index 000000000..7c1ddb5b8 --- /dev/null +++ b/app/assets/javascripts/participation_not_allowed.js @@ -0,0 +1,29 @@ +(function() { + "use strict"; + + App.ParticipationNotAllowed = { + not_allowed: function(votes_selector) { + var buttons_selector = votes_selector + " [type='submit']"; + + $("body").on("click", buttons_selector, function(event) { + var votes = $(event.target).closest(votes_selector); + var not_allowed = $("div.participation-not-allowed", votes); + + if (not_allowed.length > 0) { + event.preventDefault(); + not_allowed.show().focus(); + + if (votes_selector === "div.votes") { + $("button", votes).prop("disabled", true); + } else { + $(event.target).closest("form").remove(); + } + } + }); + }, + initialize: function() { + App.ParticipationNotAllowed.not_allowed("div.votes"); + App.ParticipationNotAllowed.not_allowed("div.supports"); + } + }; +}).call(this); diff --git a/app/assets/javascripts/votes.js b/app/assets/javascripts/votes.js deleted file mode 100644 index 890ff1e9c..000000000 --- a/app/assets/javascripts/votes.js +++ /dev/null @@ -1,19 +0,0 @@ -(function() { - "use strict"; - App.Votes = { - hoverize: function(votes) { - $(document).on({ - "mouseenter focus": function() { - $("div.participation-not-allowed", this).show(); - }, - mouseleave: function() { - $("div.participation-not-allowed", this).hide(); - } - }, votes); - }, - initialize: function() { - App.Votes.hoverize("div.votes"); - App.Votes.hoverize("div.supports"); - } - }; -}).call(this); diff --git a/app/assets/stylesheets/in_favor_against.scss b/app/assets/stylesheets/in_favor_against.scss index 71b80bc5f..1c46a449d 100644 --- a/app/assets/stylesheets/in_favor_against.scss +++ b/app/assets/stylesheets/in_favor_against.scss @@ -23,31 +23,37 @@ padding: rem-calc(3) rem-calc(6) rem-calc(6); position: relative; - &:hover, - &:active { - color: #fff; - cursor: pointer; - opacity: 1 !important; + &:not([disabled]) { + &:hover, + &:active { + color: #fff; + cursor: pointer; + opacity: 1 !important; + } } } .in-favor button { @include has-fa-icon(thumbs-up, solid); - &:hover, - &:active { - background: $like; - border: 2px solid $like; + &:not([disabled]) { + &:hover, + &:active { + background: $like; + border: 2px solid $like; + } } } .against button { @include has-fa-icon(thumbs-down, solid); - &:hover, - &:active { - background: $unlike; - border: 2px solid $unlike; + &:not([disabled]) { + &:hover, + &:active { + background: $unlike; + border: 2px solid $unlike; + } } } diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index ecc13411d..86b891563 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -98,15 +98,11 @@ .participation-not-allowed { background: $warning-bg; color: $color-warning; - left: 0; + display: none; line-height: $line-height; - min-height: 100%; padding: $line-height / 2; - position: absolute; text-align: center; - top: 0; width: 100%; - z-index: 2; &, p { @@ -327,7 +323,7 @@ } .debate-questions .debate-questions .participation-not-allowed { - position: static; + display: block; } .bullet { @@ -667,10 +663,6 @@ font-size: $base-font-size; font-weight: bold; - &:disabled { - opacity: 1; - } - &:hover { background: $budget-hover; color: #fff; diff --git a/app/components/budgets/investments/ballot_component.html.erb b/app/components/budgets/investments/ballot_component.html.erb index 2863bb8f1..7331a5176 100644 --- a/app/components/budgets/investments/ballot_component.html.erb +++ b/app/components/budgets/investments/ballot_component.html.erb @@ -32,7 +32,6 @@ title: t("budgets.investments.investment.support_title"), method: :post, remote: true, - disabled: reason.present?, "aria-label": vote_aria_label do %> <%= t("budgets.investments.investment.add") %> <% end %> diff --git a/app/components/budgets/investments/votes_component.html.erb b/app/components/budgets/investments/votes_component.html.erb index bb16453c3..0ce045d3d 100644 --- a/app/components/budgets/investments/votes_component.html.erb +++ b/app/components/budgets/investments/votes_component.html.erb @@ -28,7 +28,6 @@ method: "post", remote: !display_support_alert?, data: ({ confirm: confirm_vote_message } if display_support_alert?), - disabled: !current_user, "aria-label": support_aria_label %> <% end %> <% end %> diff --git a/app/components/debates/votes_component.html.erb b/app/components/debates/votes_component.html.erb index d822145d4..9fdd8bba2 100644 --- a/app/components/debates/votes_component.html.erb +++ b/app/components/debates/votes_component.html.erb @@ -1,9 +1,9 @@
<%= render Shared::InFavorAgainstComponent.new(debate) %> + <%= render Shared::ParticipationNotAllowedComponent.new(debate, cannot_vote_text: cannot_vote_text) %> + <%= t("debates.debate.votes", count: debate.votes_score) %> - - <%= render Shared::ParticipationNotAllowedComponent.new(debate, cannot_vote_text: cannot_vote_text) %>
diff --git a/app/components/legislation/proposals/votes_component.html.erb b/app/components/legislation/proposals/votes_component.html.erb index c85edf51c..84e1bd29e 100644 --- a/app/components/legislation/proposals/votes_component.html.erb +++ b/app/components/legislation/proposals/votes_component.html.erb @@ -3,12 +3,12 @@ <%= render Shared::InFavorAgainstComponent.new(proposal) %> <% end %> + <%= render Shared::ParticipationNotAllowedComponent.new(proposal, cannot_vote_text: cannot_vote_text) %> + <%= t("proposals.proposal.votes", count: proposal.votes_score) %> - <%= render Shared::ParticipationNotAllowedComponent.new(proposal, cannot_vote_text: cannot_vote_text) %> - <% if current_user&.voted_as_when_voted_for(proposal) && setting["twitter_handle"] %>