osunyorg/admin

View on GitHub
app/views/server/websites/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @website.to_s_in(current_language) %>

<% content_for :title_left do %>
  <%= simple_form_for @website, url: server_website_path(@website) do |f| %>
    <%= f.input :highlighted_in_showcase,
                wrapper: :custom_boolean_switch,
                input_html: {
                  data: {
                    remote: true,
                    method: :patch,
                    params: "context=showcase_highlight",
                    url: server_website_path(@website)
                  }
                } %>
  <% end %>
<% end %>

<% content_for :title_right do %>
  <%= link_to @website.university, server_university_path(@website.university) %><br>
<% end %>

<div class="row g-2">
  <div class="col-xl-4">
    <div class="card">
      <div class="card-body">
        <%= t('server_admin.websites.pages_count', count: @website.pages.count) %>
      </div>
    </div>
  </div>
  <div class="col-xl-4">
    <div class="card">
      <div class="card-body">
        <%= t('server_admin.websites.posts_count', count: @website.posts.count) %>
      </div>
    </div>
  </div>
  <div class="col-xl-4">
    <div class="card">
      <div class="card-body">
        <%= t('server_admin.websites.events_count', count: @website.events.count) %>
      </div>
    </div>
  </div>
  <div class="col-xl-6">
    <div class="card">
      <div class="card-body">
        <%= t('server_admin.websites.connections_count', count: @website.connections.count) %><br>
        <%= link_to t('server_admin.websites.details'), admin_communication_website_connections_url(@website, lang: @website.default_language, host: @website.university.url), target: :_blank %>
      </div>
    </div>
  </div>
  <div class="col-xl-6">
    <div class="card">
      <div class="card-body">
        <%= t('server_admin.websites.recursive_dependencies_count', count: @website.recursive_dependencies(follow_direct: true).count) %><br>
        <%= link_to t('server_admin.websites.details'), admin_communication_website_dependencies_url(@website, lang: @website.default_language, host: @website.university.url), target: :_blank %>
      </div>
    </div>
  </div>
</div>

<% if @website.git_files_analysed_at %>
  <div class="table-responsive">
    <table class="<%= table_classes(with_actions: false) %>">
      <thead>
        <tr>
          <th><%= Communication::Website::GitFile::Layout.model_name.human %></th>
        </tr>
      </thead>
      <tbody>
        <% @layouts.each do |layout| %>
          <tr>
            <td><%= link_to layout.path, layout.git_url, target: :_blank %></td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
  <p>Analyse le <%= l @website.git_files_analysed_at %></p>
<% end %>

<% if @website.locked_at.present? %>
  <div class="alert alert-warning">
    <p><%= Communication::Website.human_attribute_name(:locked_at) %> : <%= l(@website.locked_at, format: :long) %> (<%= @website.locked_by_job_id %>)</p>
    <%= link_to t('server_admin.websites.unlock_for_background_jobs_btn'), unlock_for_background_jobs_server_website_path(@website), method: :post, class: "btn btn-primary" %>
  </div>
<% end %>

<% content_for :action_bar_right do %>
  <%= link_to 'Analyser',
              analyse_server_website_path(@website),
              method: :post,
              class: button_classes %>
  <%= link_to 'Reconstruire (clean and rebuild)',
              clean_and_rebuild_server_website_path(@website),
              method: :post,
              class: button_classes %>
  <%= link_to 'Changer d\'université',
              edit_server_website_path(@website),
              class: button_classes %>
<% end %>