OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/views/layouts/base.html.erb

216 lines
8.6 KiB

<%#-- copyright
OpenProject is a project management system.
Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2017 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See docs/COPYRIGHT.rdoc for more details.
++#%><!DOCTYPE html>
<% show_decoration = params["layout"].nil? %>
<html xmlns="http://www.w3.org/1999/xhtml"
lang="<%= I18n.locale.to_s %>"
xml:lang="<%= I18n.locale.to_s %>"
ng-csp="no-unsafe-eval"
class="<%= 'in_modal' unless show_decoration %>">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width">
<%= output_title_and_meta_tags %>
<% relative_url_root = OpenProject::Configuration['rails_relative_url_root'] || '' %>
<meta name="app_base_path" content="<%= relative_url_root %>"/>
<base href="<%= relative_url_root %>/" />
<% if @project %>
<meta name="current_project"
data-project-name="<%= h @project.name %>"
data-project-id="<%= @project.id %>"
data-project-identifier="<%= @project.identifier %>"/>
<% end %>
<% unless User.current.anonymous? %>
<meta name="current_user"
data-name="<%= User.current.name %>"
data-id="<%= User.current.id %>" />
<% end %>
<meta name="openproject_initializer"
data-locale="<%= I18n.locale %>"
data-first-day-of-week="<%= locale_first_day_of_week %>"
data-default-locale="<%= I18n.default_locale %>"
data-environment="<%= Rails.env %>"/>
<meta name="current_menu_item" content="<%= current_menu_item %>"/>
<meta name="demo_projects_available" content="<%= Setting.demo_projects_available %>"/>
<%= csrf_meta_tags %>
<%= render 'common/favicons' %>
<%= stylesheet_link_tag 'openproject', media: "all" %>
<%# Include CLI assets (development) or prod build assets %>
<%= include_frontend_assets %>
<%= javascript_include_tag 'application' %>
<%= javascript_include_tag "locales/#{I18n.locale}" %>
<!-- Text formatting specific includes -->
<%= text_formatting_js_includes %>
<!-- Onboarding specific includes -->
<%= javascript_include_tag 'vendor/enjoyhint.js'%>
<!-- project specific tags -->
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= content_for(:header_tags) if content_for?(:header_tags) %>
<% if EnterpriseToken.allows_to?(:define_custom_style) && CustomStyle.try(:current).present? %>
<% cache(CustomStyle.current) do %>
<%= render partial: "custom_styles/inline_css" %>
<% if CustomStyle.current.favicon.present? %>
<link rel="icon" type="image/png" href="<%= custom_style_favicon_path(digest: CustomStyle.current.digest, filename: CustomStyle.current.favicon_identifier) %>" sizes="32x32">
<% end %>
<% if CustomStyle.current.touch_icon.present? %>
<link rel="apple-touch-icon" sizes="180x180" href="<%= custom_style_touch_icon_path(digest: CustomStyle.current.digest, filename: CustomStyle.current.touch_icon_identifier) %>">
<% end %>
<% end %>
<% end %>
<%= crowdin_in_context_translation %>
</head>
<body class="<%= body_css_classes %>" data-relative_url_root="<%= root_path %>">
<noscript>
<div class="top-shelf icon icon-warning">
<h1><%= l(:noscript_heading) %></h1>
<p>
<%= l(:noscript_description) %>
</p>
<h2>
<a href="http://www.enable-javascript.com/" target="_blank"><%= l(:noscript_learn_more) %></a>
</h2>
</div>
</noscript>
<% main_menu = render_main_menu(local_assigns.fetch(:menu_name, nil), @project) %>
<% side_displayed = content_for?(:sidebar) || content_for?(:main_menu) || !main_menu.blank? %>
<% initial_classes = initial_menu_classes(side_displayed, show_decoration) %>
<div id="wrapper" style="<%= initial_menu_styles %>" class="<%= initial_classes %>">
<% if show_decoration %>
<div id="top-menu">
<div id="header">
<div id="top-menu-items">
<h1 class="hidden-for-sighted">
<%= l(:label_top_menu) %>
</h1>
<main-menu-toggle></main-menu-toggle>
<a href="" class="hidden-for-sighted skip-navigation-link"
aria-label="<%= I18n.t('js.work_packages.jump_marks.label_content') %>">
<%= I18n.t('js.work_packages.jump_marks.content') %>
</a>
<%= render_top_menu_left %>
<div id="logo" class="hidden-for-mobile">
<%= link_to(I18n.t('label_home'), home_url, class: 'home-link') %>
</div>
<%= call_hook :view_layouts_base_top_menu %>
<div class="top-menu-items-right">
<%= render partial: 'search/mini_form' %>
<%= render_top_menu_right %>
</div>
</div>
</div>
</div>
<% end %>
<div id="main"
class="<%= initial_classes %>">
<% if (side_displayed && show_decoration) %>
<div id="main-menu" class="main-menu">
<h1 class="hidden-for-sighted"><%= l(:label_main_menu) %></h1>
<main-menu-resizer></main-menu-resizer>
<div id="menu-sidebar">
<%= main_menu %>
<%= content_for :main_menu %>
<%= call_hook :view_layouts_base_main_menu %>
<!-- Sidebar -->
<div id="sidebar">
<%= content_for :sidebar %>
<%= call_hook :view_layouts_base_sidebar %>
</div>
</div>
</div>
<% end %>
<div id="content-wrapper" class="<%= initial_classes %>">
<% if show_decoration %>
<div id="breadcrumb" class="<%= initial_classes %><%= show_breadcrumb ? ' -show' : '' %>">
<%= you_are_here_info %>
<%= full_breadcrumb %>
<%= call_hook :view_layouts_base_breadcrumb %>
</div>
<% end %>
<%= render_flash_messages %>
<notifications-container></notifications-container>
<% if show_onboarding_modal? %>
<section data-augmented-model-wrapper
data-modal-initialize-now="true"
data-modal-class-name="onboarding-modal -highlight">
<%= render partial: '/onboarding/configuration_modal' %>
</section>
<% end %>
<div id="content" class="<%= initial_classes %>">
<h1 class="hidden-for-sighted"><%= l(:label_content) %></h1>
<%= content_for :content_body %>
<% unless local_assigns[:no_action_menu] %>
<!-- Action menu -->
<%= render partial: 'layouts/action_menu' %>
<%= yield %>
<% end %>
<%= call_hook :view_layouts_base_content %>
<% unless local_assigns[:no_action_menu] %>
<div style="clear:both;">&nbsp;</div>
<% end %>
</div>
<% unless local_assigns[:no_action_menu] %>
<div style="clear:both;">&nbsp;</div>
<% end %>
</div>
</div>
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
</div>
<%# Properly decides main menu expanded state and width before its drawn. Fixes flickering side menu
where menu is first expanded, then being collapsed in angular. %>
<%= nonced_javascript_tag do %>
// execute these lines to prevent flickering when page loads:
(function($) {
var wrapper = $('#wrapper');
var savedMainMenuWidth = window.OpenProject.guardedLocalStorage("openProject-mainMenuWidth");
if (window.innerWidth < 680) {
// force hide on load for mobile
$('.can-hide-navigation').addClass('hidden-navigation');
}
if (savedMainMenuWidth) {
document.documentElement.style.setProperty("--main-menu-width", savedMainMenuWidth + 'px');
}
wrapper.show();
// Wrapper for page-specific JS from deprecated inline functions
// no longer available with CSP.
<%= content_for :additional_js_dom_ready %>
}(jQuery));
<% end %>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>