anyone-oslo/pages

View on GitHub
app/views/layouts/admin.html.erb

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <%= [content_for(:page_title), "Pages"].reject(&:blank?).uniq.join(" - ") %>
    </title>

    <link rel="shortcut icon"
          href="<%= asset_path 'pages/favicon.gif' %>"
          type="image/gif" />
    <link rel="icon"
          href="<%= asset_path 'pages/favicon.gif' %>"
          type="image/gif" />

    <%= stylesheet_link_tag "pages_core/admin" %>

    <% if Dir.glob(Rails.root.join("app/assets/stylesheets/admin.*")).any? %>
      <%= stylesheet_link_tag "admin" %>
    <% end %>

    <% if File.exist?(Rails.root.join("app/assets/builds/admin.js")) %>
      <%= javascript_include_tag("admin", defer: true) %>
    <% else %>
      <%= javascript_include_tag("pages_core/admin-dist", defer: true) %>
      <% if Dir.glob(Rails.root.join("app/assets/javascripts/admin.*")).any? %>
        <%= javascript_include_tag("admin", defer: true) %>
      <% end %>
    <% end %>

    <%= csrf_meta_tag %>
    <%= csp_meta_tag %>
    <meta name="viewport"
          content="width=device-width, initial-scale=1, user-scalable=no">
  </head>

  <body class="<%= content_for(:body_class) %>"
        data-controller="<%= controller.class.to_s %>"
        data-action="<%= controller.action_name %>"
        data-locale="<%= content_locale %>">

    <div class="wrapper">
      <%= render partial: "layouts/admin/header" %>
      <% if content_for?(:main_wrapper) %>
        <%= yield :main_wrapper %>
      <% else %>
        <div class="main-wrapper">
          <main>
            <%= render(partial: "layouts/admin/page_header") %>
            <%= yield %>
          </main>

          <% if content_for?(:sidebar) %>
            <aside class="sidebar">
              <%= content_for(:sidebar) %>
            </aside>
          <% end %>
        </div>
      <% end %>
    </div>
    <%= react_component "Modal", {} %>
    <%= render(partial: "layouts/admin/toast") %>
  </body>
</html>