osunyorg/admin

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

Summary

Maintainability
Test Coverage
<div class="table-responsive">
  <table class="<%= table_classes %> table-hover">
    <thead>
      <tr>
        <th><%= Communication::Website.human_attribute_name('name') %></th>
        <th><%= University.model_name.human %></th>
        <th><%= Communication::Website.human_attribute_name('url') %></th>
        <th><%= t('server_admin.websites.git_repo.status') %></th>
        <th><%= t('server_admin.websites.theme_version') %></th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      <% websites.each do |website| %>
        <tr id="website-<%= website.id %>">
          <td>
            <%= link_to website.to_s_in(current_language), server_website_path(website) %>
            <% if website.in_production? %>
              <span class="badge bg-success"><%= t('server_admin.websites.production') %></span>
            <% end %>
          </td>
          <td><%= link_to website.university,
                          [:server, website.university] %></td>
          <td>
            <%= link_to t('server_admin.websites.admin'),
                        admin_communication_website_url(website, host: website.university.url, lang: website.default_language),
                        target: :_blank,
                        class: 'action' %>
            <%= link_to Communication::Website.human_attribute_name('url'),
                        website.url,
                        target: :_blank,
                        class: 'action' if website.url.present? %>
            <%= link_to t('server_admin.websites.git_repo.short'),
                        website.repository_url,
                        target: :_blank,
                        class: 'action' if website.repository.present? %>
          </td>
          <td><%= image_tag website.deployment_status_badge,
                            alt: '' if website.deployment_status_badge.present? %></td>
          <td class="js-version">
            <%= website.theme_version %>
            <%= link_to t('server_admin.websites.buttons.theme.sync'),
                        sync_theme_version_server_website_path(website),
                        method: :post,
                        remote: true,
                        class: "action js-sync-theme-version" if website.theme_updatable? %>
          </td>
          <td>
            <%= link_to t('server_admin.websites.buttons.theme.update'),
                        update_theme_server_website_path(website),
                        method: :post,
                        remote: true,
                        class: button_classes if website.github? && website.url.present? %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>