<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Version: <%= version %> -->
    <title><%= content_for?(:title) ? yield(:title) : _('%{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %> 
    </title>
    <%= favicon_link_tag "favicon.ico" %>
    <!--[ if lte IE 9]>
      <script src="https://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
         <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.js"></script>
         <style type="text/css">
           .navbar {
             filter:none !important;
           }
         </style>
    <![endif]-->

    <!--[if gte IE 9]>
        <style type="text/css">
          .gradient {
               filter: none;
          }
        </style>
    <![endif]-->

    <!--[if IE]>
          <script>
            $(function() {
              // Invoke the plugin
              $('input, textarea').placeholder();
              $('input, iframe').placeholder();
          });
        </script>
    <![endif]-->

    <%= stylesheet_link_tag(stylesheet_manifest_file) %>
    <%= javascript_pack_tag(javascript_manifest_file) %>
    <%= javascript_tag do %>
      var options = { 
        message: '<%= d_("dmpopidor", "By continuing to browse, without changing your settings, you accept the use of cookies to measure the traffic of the website with the software Matomo. For more information, to change or manage your settings, please visit our Privacy Statement page.")%>',
        moreinfo: '<%= privacy_path %>',
        'close-text': '<%= d_("dmpopidor", "Accept") %>',
        'close-precedes': false,
        'close-style': 'padding-left:5px; color: rgb(170, 170, 170);',
        linkmsg: '<%= d_("dmpopidor", "Learn more") %>'
      };
      var cb = new Cookiebanner(options); cb.run();
    <% end %>
    <%= csrf_meta_tags %>

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="keywords" content="plan de gestion de données, PGD, data management plan, DMP, OPIDoR, H2020, Horizon2020, CNRS, INIST, ANR, software management plan, SMP, CNRS">
    <meta name="description" content="DMP OPIDoR vous accompagne à travers l’élaboration et la mise en pratique de plans de gestion de données et de logiciels.">

  </head>
  <body>
      <div class="skip">
        <a href="#maincontent"> _('Skip to main content') </a> 
      </div>
      <!-- header rendering -->
      <header class="dmpopidor-branding">
        <%= render partial: "layouts/header" %>
      </header>

      <%
      has_alert = (alert || flash[:alert] || flash[:error])
      has_notice = (notice || flash[:notice])
      %>

      <!-- main page content rendering -->
      <main class="container dmpopidor-branding" id="maincontent">
        <div id="notification-area"
             class="notification-area alert <%= has_alert ? 'alert-warning ' : 'alert-info ' %>
                    <%= (has_alert or has_notice) ? 'show' : 'hide' %>"
             role="<%= (has_notice ? 'status' : (has_alert ? 'alert' : '')) %>">
          <i class="fa <%= has_alert ? ' fa-times-circle' : ' fa-check-circle' %>" aria-hidden="true"></i>
          <span class="aria-only"><%= has_alert ? _('Error:') : _('Notice:') %></span>
          <span><%= sanitize (has_alert ? alert : notice) %></span>
          <%= yield :errors %>
        </div>
        <%= render "layouts/notifications", notifications: Notification.active_per_user(current_user) %>
        <%= yield %>
      </main>

      <!-- footer rendering -->
      <footer id="dmpopidor-footer">
        <%= render "layouts/footer" %>
      </footer>

      <!-- piwik -->
      <%= render "layouts/piwik" %>

    <%
    constants_json = {
      HOST: (Rails.env.development? || Rails.env.test? ? 'localhost' : Socket.gethostname),
      PASSWORD_MIN_LENGTH: 8,
      PASSWORD_MAX_LENGTH: 128,
      MAX_NUMBER_ORG_URLS: 3,
      MAX_NUMBER_GUIDANCE_SELECTIONS: 6,

      REQUIRED_FIELD_TEXT: _('This field is required.'),

      SHOW_PASSWORD_MESSAGE: _('Show password'),
      SHOW_SELECT_ORG_MESSAGE: _('Select an organisation from the list.'),
      SHOW_OTHER_ORG_MESSAGE: _('My organisation isn\'t listed'),

      PLAN_VISIBILITY_WHEN_TEST: _('N/A'),
      PLAN_VISIBILITY_WHEN_NOT_TEST: _('Private'),
      PLAN_VISIBILITY_WHEN_NOT_TEST_TOOLTIP: _('Private: restricted to me and people I invite.'),

      SHIBBOLETH_DISCOVERY_SERVICE_HIDE_LIST: _('Hide list.'),
      SHIBBOLETH_DISCOVERY_SERVICE_SHOW_LIST: _('See the full list of partner institutions.'),

      NO_TEMPLATE_FOUND_ERROR: _('Unable to find a suitable template for the research organisation and funder you selected.'),
      NEW_PLAN_DISABLED_TOOLTIP: _('Please select a research organisation and funder to continue.'),

      AJAX_LOADING: _('Loading ...'),
      AJAX_UNABLE_TO_LOAD_TEMPLATE_SECTION: _('Unable to load the section\'s content at this time.'),
      AJAX_UNABLE_TO_LOAD_TEMPLATE_SECTION_QUESTION: _('Unable to load the question\'s content at this time.')
    }.to_json
    %>

    <input type="hidden" id="js-constants" value="<%= constants_json %>" />
  </body>
</html>
