<% button_classes = "button button__lg button__secondary w-full" %> <% unless proposal.rejected? || proposal.withdrawn? %> <% if component_settings.participatory_texts_enabled? && from_proposals_list %> <%= render partial: "decidim/proposals/proposals/participatory_texts/proposal_vote_button", locals: { proposal:, from_proposals_list: true } %> <% 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:), resource: proposal, class: button_classes, disabled: true %> <% else %> <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, class: button_classes, data: { disable: true, "redirect-url": proposal_path(proposal) } do %> <%= t("decidim.proposals.proposals.vote_button.vote") %> <%= decidim_html_escape(present(proposal).title) %> <% end %> <% 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:), resource: proposal, 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_classes} is-hover", id: "vote_button-#{proposal.id}" ) do %> <%= t("decidim.proposals.proposals.vote_button.already_voted") %> <%= decidim_html_escape(present(proposal).title) %> <% end %> <% else %> <% if proposal.maximum_votes_reached? && !proposal.can_accumulate_votes_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %> <%= content_tag :button, t("decidim.proposals.proposals.vote_button.maximum_votes_reached"), class: button_classes, disabled: true %> <% else %> <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %> <%= content_tag :button, t("decidim.proposals.proposals.vote_button.no_votes_remaining"), class: button_classes, disabled: true %> <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %> <%= content_tag :button, t("decidim.proposals.proposals.vote_button.votes_blocked"), class: button_classes, disabled: true %> <% else %> <%= action_authorized_button_to :vote, proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list:), resource: proposal, remote: true, data: { disable: true, "redirect-url": proposal_path(proposal) }, class: button_classes do %> <%= t("decidim.proposals.proposals.vote_button.vote") %> <%= decidim_html_escape(present(proposal).title) %> <% end %> <% end %> <% end %> <% end %> <% end %>
<% end %> <% end %>