diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 85f8683e0..4bab52179 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1038,6 +1038,7 @@ content: none; } + .progress, .total-supports { display: none; } @@ -1070,7 +1071,11 @@ } .supported { + background: none; + border: 0; + margin-bottom: 0; margin-top: 0; + padding: 0; font-size: $small-font-size; } } diff --git a/app/components/proposals/votes_component.rb b/app/components/proposals/votes_component.rb index 5f74d362c..0b42839c8 100644 --- a/app/components/proposals/votes_component.rb +++ b/app/components/proposals/votes_component.rb @@ -1,9 +1,13 @@ class Proposals::VotesComponent < ApplicationComponent - attr_reader :proposal, :vote_url + attr_reader :proposal delegate :current_user, :link_to_verify_account, :user_signed_in?, to: :helpers - def initialize(proposal, vote_url:) + def initialize(proposal, vote_url: nil) @proposal = proposal @vote_url = vote_url end + + def vote_url + @vote_url || vote_proposal_path(proposal, value: "yes") + end end diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index d9857837b..9fbf8b271 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -71,11 +71,6 @@ class ProposalsController < ApplicationController def retire_form end - def vote_featured - @follow = Follow.find_or_create_by!(user: current_user, followable: @proposal) - @proposal.register_vote(current_user, "yes") - end - def summary @proposals = Proposal.for_summary @tag_cloud = tag_cloud diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index da8fa7197..049a2c8b5 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -85,7 +85,6 @@ module Abilities if user.level_two_or_three_verified? can :vote, Proposal, &:published? - can :vote_featured, Proposal can :vote, Legislation::Proposal can :create, Legislation::Answer diff --git a/app/views/proposals/_featured_proposal.html.erb b/app/views/proposals/_featured_proposal.html.erb index d2f7dac89..b19f6adc6 100644 --- a/app/views/proposals/_featured_proposal.html.erb +++ b/app/views/proposals/_featured_proposal.html.erb @@ -22,6 +22,6 @@
- <%= render "featured_votes", proposal: proposal %> + <%= render Proposals::VotesComponent.new(proposal) %>
diff --git a/app/views/proposals/_featured_votes.html.erb b/app/views/proposals/_featured_votes.html.erb deleted file mode 100644 index 96021e5bd..000000000 --- a/app/views/proposals/_featured_votes.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -
-
- <% if current_user&.voted_for?(proposal) %> -
- <%= t("proposals.proposal.already_supported") %> -
- <% else %> - <%= link_to vote_featured_proposal_path(proposal, value: "yes"), - class: "button button-support small expanded", - title: t("proposals.proposal.support_title"), method: "post", remote: true do %> - <%= t("proposals.proposal.support") %> - <% end %> - <% end %> -
- - <% if user_signed_in? && current_user.organization? %> - - <% elsif user_signed_in? && !proposal.votable_by?(current_user) %> - - <% elsif !user_signed_in? %> - <%= render "shared/login_to_vote" %> - <% end %> - - <% if current_user&.voted_for?(proposal) %> - <% if setting["twitter_handle"] %> -
- <%= render "shared/social_share", - title: proposal.title, - url: proposal_url(proposal), - description: proposal.summary, - mobile: proposal.title %> -
- <% end %> - <% end %> -
diff --git a/app/views/proposals/_proposal.html.erb b/app/views/proposals/_proposal.html.erb index 496f0f4a1..733e3adf2 100644 --- a/app/views/proposals/_proposal.html.erb +++ b/app/views/proposals/_proposal.html.erb @@ -77,8 +77,7 @@

<%= t("proposals.proposal.archived") %>

<% else %> - <%= render "votes", - { proposal: proposal, vote_url: vote_proposal_path(proposal, value: "yes") } %> + <%= render "votes", proposal: proposal %> <% end %> <% end %> diff --git a/app/views/proposals/_support_status.html.erb b/app/views/proposals/_support_status.html.erb index 49fce905f..a5a0b961a 100644 --- a/app/views/proposals/_support_status.html.erb +++ b/app/views/proposals/_support_status.html.erb @@ -32,7 +32,7 @@

<%= t("proposals.proposal.archived") %>

<% else %> - <%= render "votes", { proposal: proposal, vote_url: vote_proposal_path(proposal, value: "yes") } %> + <%= render "votes", proposal: proposal %> <% end %> diff --git a/app/views/proposals/_votes.html.erb b/app/views/proposals/_votes.html.erb index 9e8784e57..1360152bc 100644 --- a/app/views/proposals/_votes.html.erb +++ b/app/views/proposals/_votes.html.erb @@ -1 +1 @@ -<%= render Proposals::VotesComponent.new(proposal, vote_url: vote_url) %> +<%= render Proposals::VotesComponent.new(proposal, vote_url: local_assigns[:vote_url]) %> diff --git a/app/views/proposals/vote.js.erb b/app/views/proposals/vote.js.erb index ca1ffc15b..6dceb49cc 100644 --- a/app/views/proposals/vote.js.erb +++ b/app/views/proposals/vote.js.erb @@ -1,4 +1,4 @@ -$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("proposals/votes", proposal: @proposal, vote_url: nil) %>"); +$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("proposals/votes", proposal: @proposal) %>"); App.Followable.update("<%= dom_id(@follow.followable) %>", "<%= j render("follows/follow_button", follow: @follow) %>", "<%= j render("layouts/flash") %>") diff --git a/app/views/proposals/vote_featured.js.erb b/app/views/proposals/vote_featured.js.erb deleted file mode 100644 index ee4c20d5a..000000000 --- a/app/views/proposals/vote_featured.js.erb +++ /dev/null @@ -1 +0,0 @@ -$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("proposals/featured_votes", proposal: @proposal) %>"); diff --git a/app/views/welcome/_votes.html.erb b/app/views/welcome/_votes.html.erb index a7d72d397..ba458452a 100644 --- a/app/views/welcome/_votes.html.erb +++ b/app/views/welcome/_votes.html.erb @@ -1,2 +1 @@ -<%= render "proposals/votes", - { proposal: proposal, vote_url: vote_proposal_path(proposal, value: "yes") } %> +<%= render "proposals/votes", proposal: proposal %> diff --git a/config/routes/proposal.rb b/config/routes/proposal.rb index 8e1bc54e4..6b21a4e93 100644 --- a/config/routes/proposal.rb +++ b/config/routes/proposal.rb @@ -34,7 +34,6 @@ resources :proposals do member do post :vote - post :vote_featured put :flag put :unflag get :retire_form diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb index 5299d068c..44ddb5e15 100644 --- a/spec/models/abilities/common_spec.rb +++ b/spec/models/abilities/common_spec.rb @@ -69,7 +69,6 @@ describe Abilities::Common do it { should be_able_to(:index, Proposal) } it { should be_able_to(:show, proposal) } it { should_not be_able_to(:vote, Proposal) } - it { should_not be_able_to(:vote_featured, Proposal) } it { should_not be_able_to(:comment_as_administrator, debate) } it { should_not be_able_to(:comment_as_moderator, debate) } @@ -212,7 +211,6 @@ describe Abilities::Common do describe "Proposal" do it { should be_able_to(:vote, Proposal) } - it { should be_able_to(:vote_featured, Proposal) } end describe "Direct Message" do @@ -292,7 +290,6 @@ describe Abilities::Common do before { user.update(verified_at: Time.current) } it { should be_able_to(:vote, Proposal) } - it { should be_able_to(:vote_featured, Proposal) } it { should be_able_to(:new, DirectMessage) } it { should be_able_to(:create, DirectMessage) }