<% include_calendar_headers_tags -%>
<% include_filters_headers_tags %>
<% heads_for_wiki_formatter -%>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <%= call_hook :view_layouts_base_html_head_top %>
  <title><%= html_title %></title>
  <meta name="description" content="<%= EasyExtensions::EasyProjectSettings.app_name %>" />
  <meta name="keywords" content="issue,bug,tracker,<%= EasyExtensions::EasyProjectSettings.app_name %>" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
  <meta name="application-name" content="<%= EasyExtensions::EasyProjectSettings.app_name %>"/>
  <meta name="msapplication-config" content="browserconfig.xml"/>
  <%= csrf_meta_tag %>
  <%= easy_favicon %>
  <%#= stylesheet_link_tag 'responsive', :media => 'all' %>
  <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
  <%#= stylesheet_link_tag 'context_menu' %>
  <%= stylesheet_link_tag 'easy_jquery_ui/jquery-ui.css' %>
  <%= easy_theme_tag -%>
  <%= stylesheet_link_tag 'easy_extensions' %>
  <%= stylesheet_link_tag('easy_print', :media => 'print') -%>
  <%= javascript_include_tag('easy_extensions') %>
  <%= javascript_heads %>

  <script type="text/javascript">
    ERUI.isMobile = <%= is_mobile_device? %>
    $(window).load(function(){
      if (top.location !== self.location) {
        $("#header, #top-menu").remove();
        $("body").addClass('in-iframe');
      }
    });
    shortcut.add('Alt+Shift+N', function() {
      window.location.href = '<%= j new_issue_path %>';
    });
    shortcut.add('Alt+Shift+F', EASY.utils.toggleSidebar);

    moment.locale('<%= j momentjs_locale %>');
    window.momentjsFormat = '<%= j momentjs_date_format %>';

    window.urlPrefix = '<%= j get_easy_absolute_uri_for.to_s %>';

    <%
      lang_keys = {
        titleInlineEditable: l(:title_inline_editable),
        titleInlineEditableAll: l(:title_inline_editable_all),
        buttonSave: l(:button_save),
        buttonCancel: l(:button_cancel),
        buttonClear: l(:button_clear),
        meetingDestroyConfirmation: l(:text_meeting_destroy_confirmation),
        meetingAccept: l(:button_meeting_accept),
        meetingDecline: l(:button_meeting_decline),
        textWarnLeavingUnsaved: l(:text_warn_on_leaving_unsaved),
        meetingEdit: l(:button_edit),
        textPleaseFillName: l(:text_please_fill_name),
        fieldPossibleValues: l(:field_possible_values),
        labelFilterPlural: l(:label_filter_plural),
        labelNoFiltersDetected: l(:label_no_filters_detected)
      }
    %>

    window.I18n = <%= lang_keys.to_json.html_safe %>;
    window.saveButtonSettingsUrl = '<%=j users_save_button_settings_path %>';
    <% user_current_attributes = %w(id login firstname lastname mail).map{|attr| [attr, User.current.send(attr)]}.to_h
       user_current_attributes['avatar_url'] = avatar_url
    %>
    window.easyClasses.User.current = new easyClasses.User(<%= raw user_current_attributes.to_json %>)

    <%
      active_services = EasyExtensions::EasyBackgroundService.active(self).keys.to_json.html_safe
    %>

      EASY.backgroundServices.active = <%= active_services %>
  </script>
  <%= call_hook :view_layouts_base_html_head %>

  <%= yield :header_tags -%>
</head>
