noesya/osuny

View on GitHub
app/views/admin/communication/websites/menus/items/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @item %>

<div class="row">
  <div class="col-xl-8">
    <%= render 'admin/communication/websites/menus/items/list', items: @children, item: @item if @children.any? %>
  </div>
  <div class="col-xl-4">
    <%= osuny_panel t('metadata') do %>
      <%= osuny_label Communication::Website::Menu::Item.human_attribute_name('kind') %>
      <p><%= @item.kind_i18n %></p>
      <% if @item.kind_url? %>
        <%= osuny_label Communication::Website::Menu::Item.human_attribute_name('url') %>
        <p><%= link_to @item.url, @item.url, target: '_blank' unless @item.url.blank? %></p>
      <% elsif @item.has_about? %>
        <%= osuny_label Communication::Website::Menu::Item.human_attribute_name('about') %>
        <p>
          <%= osuny_link_localized_if can?(:read, @item.about), 
                                      @item.about, 
                                      [:admin, @item.about.becomes(@item.about.class.base_class)] %>
        </p>
      <% end %>
    <% end %>
  </div>
</div>

<% content_for :action_bar_left do %>
  <%= link_to t('delete'),
              admin_communication_website_menu_item_path(website_id: @item.website.id, menu_id: @item.menu.id, id: @item.id),
              method: :delete,
              data: { confirm: t('please_confirm') },
              class: button_classes_danger if can?(:destroy, @item) %>
<% end %>

<% content_for :action_bar_right do %>
  <%= link_to t('edit'),
              edit_admin_communication_website_menu_item_path(@item, website_id: @website, menu_id: @menu.id),
              class: button_classes %>
  <%= link_to t('create'),
              new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id, parent_id: @item.id),
              class: button_classes if can?(:create, Communication::Website::Menu::Item) %>
<% end %>