AlchemyCMS/alchemy_cms

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

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="<%= ::I18n.locale %>" class="no-js">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><%= render_alchemy_title %></title>
    <link rel="shortcut icon" href="<%= asset_path('alchemy/favicon.ico') %>">
    <%= csrf_meta_tag %>
    <meta name="robots" content="noindex">
    <meta name="alchemy-icon-sprite" content="<%= asset_path("remixicon.symbol.svg") %>">
    <%= stylesheet_link_tag('alchemy/admin/all', media: 'screen', 'data-turbo-track' => true) %>
    <%= stylesheet_link_tag('alchemy/print', media: 'print', 'data-turbo-track' => true) %>
    <%= yield :stylesheets %>
    <script>
      // Global Alchemy JavaScript object.
      var Alchemy = {};
      // Store regular expression for external link url matching.
      Alchemy.link_url_regexp = <%= link_url_regexp.inspect %>;
    </script>
    <%= render 'alchemy/admin/tinymce/setup' %>
    <%= render 'alchemy/admin/partials/routes' %>
    <%= javascript_include_tag('alchemy/admin/all', 'data-turbo-track' => true) %>
    <%= javascript_importmap_tags("alchemy_admin", importmap: Alchemy.importmap) %>
    <% if Alchemy.admin_js_imports.any? %>
      <script type="module">
        <% Alchemy.admin_js_imports.each do |path| %>
          import "<%= path %>"
        <% end %>
      </script>
    <% end %>
    <%= yield :javascript_includes %>
  </head>
  <%= content_tag :body, id: 'alchemy', class: alchemy_body_class + ["alchemy-light"] do %>
    <noscript>
      <h1><%= Alchemy.t(:javascript_disabled_headline) %></h1>
      <p><%= Alchemy.t(:javascript_disabled_text) %></p>
    </noscript>
    <alchemy-overlay text="<%= Alchemy.t(:please_wait) %>"></alchemy-overlay>
    <div id="left_menu">
      <div id="main_navi">
        <% sorted_alchemy_modules.each do |alchemy_module| %>
          <%= alchemy_main_navigation_entry(alchemy_module) %>
        <% end %>
        <%= yield(:alchemy_main_navigation) %>
      </div>
      <div id="logout" class="main_navi_entry">
        <% if current_alchemy_user %>
          <%= link_to_dialog(
            %(
              #{render_icon('logout-box-r', class: 'module')}
              <label>#{Alchemy.t(:leave)}</label>
            ).html_safe,
            alchemy.leave_admin_path, {
              size: "300x155",
              title: Alchemy.t("Leave Alchemy")
          }, {'data-alchemy-hotkey' => 'alt+q'}) %>
        <% else %>
          <%= link_to(alchemy.root_path) do %>
            <%= render_icon "logout-box-r", size: "lg" %>
            <label><%= Alchemy.t(:leave) %></label>
          <% end %>
        <% end %>
      </div>
    </div>
    <% if current_alchemy_user %>
    <div id="top_menu">
      <div id="header">
        <% if @locked_pages.present? %>
          <div id="locked_pages">
            <%= render partial: 'alchemy/admin/pages/locked_page', collection: @locked_pages %>
          </div>
        <% end %>
        <div id="user_info">
          <%= current_alchemy_user_name %>
          <% if Alchemy::I18n.available_locales.length > 1 %>
            <%= select_tag 'change_locale',
              options_for_select(translations_for_select, ::I18n.locale) %>
          <% end %>
        </div>
      </div>
      <div id="toolbar">
        <%= yield(:toolbar) %>
      </div>
    </div>
    <% end %>
    <%= render 'alchemy/admin/partials/flash_notices' %>
    <div id="main_content">
      <%= yield %>
    </div>
    <script>
      // Setting the correct locale for select2 dropdown replacement.
      $.extend($.fn.select2.defaults, $.fn.select2.locales['<%= ::I18n.locale %>']);
    </script>
    <%= render 'alchemy/admin/uploader/setup' %>
    <%= yield(:javascripts) %>
  <% end %>
</html>