<% if proposal.rejected? %>
<% else %>
<% if !current_user %> <% if current_settings.votes_blocked? %> <%= 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), class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %> <% else %> <%= 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), class: "button #{vote_button_classes(from_proposals_list)}", data: { disable: true, "redirect-url": proposal_path(proposal) } %> <% end %> <% else %> <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %> <%= action_authorized_button_to( :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), method: :delete, remote: true, data: { disable: true, original: t("decidim.proposals.proposals.vote_button.already_voted"), replace: t("decidim.proposals.proposals.vote_button.already_voted_hover"), "redirect-url": proposal_path(proposal) }, class: "button #{vote_button_classes(from_proposals_list)} success light", id: "vote_button" ) do %> <%= icon("check", class: "icon--small") %> <%= t("decidim.proposals.proposals.vote_button.already_voted") %> <% end %> <% else %> <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %> <%= content_tag :span, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %> <% else %> <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %> <%= content_tag :span, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: "button #{vote_button_classes(from_proposals_list)}", disabled: true %> <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %> <%= content_tag :span, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: "button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %> <% else %> <%= 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), remote: true, data: { disable: true, "redirect-url": proposal_path(proposal) }, class: "button #{vote_button_classes(from_proposals_list)}" %> <% end %> <% end %> <% end %> <% end %>
<% end %>