decidim/decidim

View on GitHub
decidim-proposals/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb

Summary

Maintainability
Test Coverage
<% if amendment_creation_enabled? || visible_emendations.any? %>
  <%= action_authorized_link_to :amend, amend_resource_path, resource: model, disabled: amend_button_disabled?, class: "proposal-participatory__button" do %>
    <%= icon "chat-1-line" %>
    <span><%= t("amend", scope: "decidim.proposals.participatory_text_proposal.buttons") %></span>
    <div class="label"><%= visible_emendations.count %></div>
  <% end %>
<% end %>

<% if component_settings.comments_enabled? %>
  <% if current_settings.comments_blocked? %>
    <%= content_tag :button, disabled: true, class: "proposal-participatory__button" do %>
      <%= icon "chat-1-line" %>
      <span><%= t("comment", scope: "decidim.proposals.participatory_text_proposal.buttons") %></span>
      <div class="label"><%= model.comments_count %></div>
    <% end %>
  <% else %>
    <%= action_authorized_link_to :comment, resource_comments_path, resource: model, class: "proposal-participatory__button" do %>
      <%= icon "chat-1-line" %>
      <span><%= t("comment", scope: "decidim.proposals.participatory_text_proposal.buttons") %></span>
      <div class="label"><%= model.comments_count %></div>
    <% end %>
  <% end %>
<% end %>