Sha256: b84ded603d23302696d52c6719036c2ffa44e336bb312221f25ecf9572a9c2ff

Contents?: true

Size: 1.78 KB

Versions: 2

Compression:

Stored size: 1.78 KB

Contents

<% content_for :page_title do %>
  <%= I18n.t("spree.user_roles") %>
<% end %>

<% content_for :page_actions do %>
  <% if can?(:admin, Spree::Role) && can?(:create, Spree::Role) %>
    <li>
      <%= link_to I18n.t("spree.new_user_role"), new_admin_role_url, :icon => 'plus', :id => 'admin_new_role_link', class: "btn btn-primary" %>
    </li>
  <% end %>
<% end %>

<% if @roles.non_base_roles.any? %>
  <table class="index">
    <colgroup>
      <col style="width: 50%">
      <col style="width: 50%">
    </colgroup>
    <thead>
      <tr data-hook="role_header">
        <th><%= I18n.t("spree.name") %></th>
        <th><%= I18n.t("spree.permissions") %></th>
        <th class="actions"></th>
      </tr>
    </thead>
    <tbody>
      <% @roles.non_base_roles.each do |role|%>
      <tr id="<%= spree_dom_id role %>" data-hook="rate_row" class="<%= cycle('odd', 'even')%>">
        <td class="align-center"><%=role.try(:name) || I18n.t("spree.not_available") %></td>
        <td class="align-center"><%= role.permission_sets.map(&:name).to_sentence %></td>
        <td class="actions">
          <% if can?(:update, role) %>
            <%= link_to_edit role, :no_text => true %>
          <% end %>
          <% if can?(:destroy, role) %>
            <%= link_to_delete role, :no_text => true %>
          <% end %>
        </td>
      </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <div class="content row">
    <div class="content col-12">
      <div class= "no-objects-found">
        <%= I18n.t("spree.no_resource_found", resource: I18n.t(:other, scope: 'activerecord.models.spree/role')) %>
        <% if can?(:admin, Spree::Role) && can?(:create, Spree::Role) %>
          <%= link_to I18n.t("spree.add_one"), spree.new_admin_role_path %>!
        <% end %>
      </div>
    </div>
  </div>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_user_roles-2.0.1 app/views/spree/admin/roles/index.html.erb
solidus_user_roles-2.0.0 app/views/spree/admin/roles/index.html.erb