noesya/osuny

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

Summary

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

<% content_for :title_right do %>
  <%= render 'admin/application/favorites/widget', about: @website %>
  <%= link_to @website.url, @website.url, target: :_blank unless @website.url.blank? %>
  <div class="small">
    <% if @website.about.present? %>
      <%= I18n.t("activerecord.attributes.communication/website.about_#{@website.about_type}") %>
      — <%= osuny_link_localized_if can?(:read, @website.about), @website.about, [:admin, @website.about] %>
    <% end %>
  </div>
<% end %>

<%
number_of_panels = 0
%>
<div class="row gx-5">
  <% if @website.feature_posts && @posts.any? && can?(:read, Communication::Website::Post) %>
    <% number_of_panels += 1 %>
    <div class="col-lg-6">
    <%= render 'admin/communication/websites/show/posts'  %>
    </div>
  <% end %>
  <% if @website.feature_agenda && @events.any? && can?(:read, Communication::Website::Agenda::Event) %>
    <% number_of_panels += 1 %>
    <div class="col-lg-6">
      <%= render 'admin/communication/websites/show/events' %>
    </div>
  <% end %>
  <% if @website.feature_portfolio && @projects.any? && can?(:read, Communication::Website::Portfolio::Project) %>
    <% number_of_panels += 1 %>
    <div class="col-lg-6">
      <%= render 'admin/communication/websites/show/projects' %>
    </div>
  <% end %>
  <div class="col-lg-<%= number_of_panels.even? ? 12 : 6 %>">
    <%= render 'admin/communication/websites/show/pages', large: number_of_panels.even? if can?(:read, Communication::Website::Page) %>
  </div>
</div>

<%= image_tag @website.deployment_status_badge, alt: '' if @website.deployment_status_badge.present? %>

<%= render 'admin/application/l10n/widget', about: @website, l10n: @l10n, small: true %>

<% content_for :action_bar_left do %>
  <%= destroy_link @website %>
  <%= static_link static_admin_communication_website_path(@website, website_id: nil) %>
<% end %>

<% content_for :action_bar_right do %>
  <%= edit_link @website %>
  <%= link_to t('communication.website.golive.button'),
              production_admin_communication_website_path(@website),
              class: button_classes unless @website.in_production %>
<% end %>