decidim/decidim

View on GitHub
decidim-proposals/app/views/decidim/proposals/admin/proposal_states/index.html.erb

Summary

Maintainability
Test Coverage
<% add_decidim_page_title(t(".title")) %>
<div class="card">
  <div class="item_show__header">
    <h1 class="item_show__header-title">
      <%= t(".title") %>
      <%= link_to t("actions.new_proposal_state", scope: "decidim.proposals"), new_proposal_state_path, class: "button button__sm button__secondary" if allowed_to? :create, :proposal_state %>
    </h1>
  </div>
  <div class="table-scroll mt-16">
    <table class="table-list">
      <thead>
        <tr>
          <th class="!text-left">
            <%= t("models.proposal_state.title", scope: "decidim.proposals") %>
          </th>
          <th>
            <%= t("models.proposal_state.css_class", scope: "decidim.proposals") %>
          </th>
          <th><%= t("actions.title", scope: "decidim.proposals") %></th>
        </tr>
      </thead>
      <tbody>
        <% proposal_states.each do |state| %>
          <tr>
            <td>
              <%= translated_attribute(state.title) %>
            </td>
            <td>
              <strong class="label" style="<%= state.css_style %>">
                <%= decidim_sanitize_translated(state.token) %>
              </strong>
            </td>
            <td>
              <% if allowed_to? :update, :proposal_state, proposal_state: state %>
                <%= icon_link_to "pencil-line", edit_proposal_state_path(state), t("actions.edit_proposal_state", scope: "decidim.proposals"), class: "action-icon--edit-proposal" %>
              <% else %>
                <span class="action-space icon"></span>
              <% end %>
              <% if allowed_to?(:destroy, :proposal_state, proposal_state: state) %>
                <%= icon_link_to "delete-bin-line", proposal_state_path(state), t("actions.destroy", scope: "decidim.proposals"), method: :delete, data: { confirm: t("actions.delete_proposal_state_confirm", scope: "decidim.proposals") }, class: "action-icon--delete-proposal" %>
              <% end %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>

<%= decidim_paginate proposal_states %>