libertarian-party/partynest

View on GitHub
app/views/staffs/org_units/show.html.erb

Summary

Maintainability
Test Coverage
<div class="container">
  <%= nav_breadcrumb(
      [translate(:staff_services), staff_root_path],
      [OrgUnit.model_name.human(count: 0), staff_org_units_path],
      @org_unit.short_name,
    ) %>

  <dl>
    <dt><%= OrgUnit.human_attribute_name :kind %></dt>
    <dd>
      <% if @org_unit.kind.nil? %>
        <%= none %>
      <% elsif policy([:staff, @org_unit.kind]).show? %>
        <%= link_to @org_unit.kind.name,
                    [:staff, @org_unit.kind] %>
      <% else %>
        <%= @org_unit.kind.name %>
      <% end %>
    </dd>

    <dt><%= OrgUnit.human_attribute_name :short_name %></dt>
    <dd><%= @org_unit.short_name %></dd>

    <dt><%= OrgUnit.human_attribute_name :name %></dt>
    <dd><%= @org_unit.name %></dd>

    <dt><%= OrgUnit.human_attribute_name :parent_unit %></dt>
    <dd>
      <% if @org_unit.parent_unit.nil? %>
        <%= none %>
      <% elsif policy([:staff, @org_unit.parent_unit]).show? %>
        <%= link_to @org_unit.parent_unit.name,
                    [:staff, @org_unit.parent_unit] %>
      <% else %>
        <%= @org_unit.parent_unit.name %>
      <% end %>
    </dd>

    <dt><%= OrgUnit.human_attribute_name :resource %></dt>
    <dd>
      <%= render partial: 'resource_link',
                 locals: { resource: @org_unit.resource } %>
    </dd>
  </dl>
</div>