<% if paragraph.rejected? || paragraph.withdrawn? %>
<% else %>
<% if !current_user %> <% if current_settings.votes_blocked? %> <%= action_authorized_button_to :vote, t("decidim.enhanced_textwork.paragraphs.vote_button.votes_blocked"), paragraph_paragraph_vote_path(paragraph_id: paragraph, from_paragraphs_list: from_paragraphs_list), resource: paragraph, class: "column light disabled", disabled: true %> <% else %> <%= action_authorized_button_to :vote, paragraph_paragraph_vote_path(paragraph_id: paragraph, from_paragraphs_list: from_paragraphs_list), resource: paragraph, class: "column ", data: { disable: true, "redirect-url": paragraph_path(paragraph) } do %> <%= t("decidim.enhanced_textwork.paragraphs.vote_button.vote") %> <%= decidim_html_escape(present(paragraph).title) %> <% end %> <% end %> <% else %> <% if @voted_paragraphs ? @voted_paragraphs.include?(paragraph.id) : paragraph.voted_by?(current_user) %> <%= action_authorized_button_to( :vote, paragraph_paragraph_vote_path(paragraph_id: paragraph, from_paragraphs_list: from_paragraphs_list), resource: paragraph, method: :delete, remote: true, data: { disable: true, original: t("decidim.enhanced_textwork.paragraphs.vote_button.already_voted"), replace: t("decidim.enhanced_textwork.paragraphs.vote_button.already_voted_hover"), "redirect-url": paragraph_path(paragraph) }, class: "column light success", id: "vote_button-#{paragraph.id}" ) do %> <%= icon("check", class: "icon--small", role: "img", "aria-hidden": true) %> <%= t("decidim.enhanced_textwork.paragraphs.vote_button.already_voted") %> <%= decidim_html_escape(present(paragraph).title) %> <% end %> <% else %> <% if paragraph.maximum_votes_reached? && !paragraph.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %> <%= content_tag :span, t("decidim.enhanced_textwork.paragraphs.vote_button.maximum_votes_reached"), class: "column light disabled", disabled: true %> <% else %> <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %> <%= content_tag :span, t("decidim.enhanced_textwork.paragraphs.vote_button.no_votes_remaining"), class: "column light", disabled: true %> <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %> <%= content_tag :span, t("decidim.enhanced_textwork.paragraphs.vote_button.votes_blocked"), class: "column light disabled", disabled: true %> <% else %> <%= action_authorized_button_to :vote, paragraph_paragraph_vote_path(paragraph_id: paragraph, from_paragraphs_list: from_paragraphs_list), resource: paragraph, remote: true, data: { disable: true, "redirect-url": paragraph_path(paragraph) }, class: "column light" do %> <%= t("decidim.enhanced_textwork.paragraphs.vote_button.vote") %> <%= decidim_html_escape(present(paragraph).title) %> <% end %> <% end %> <% end %> <% end %> <% end %>
<% end %>