<!DOCTYPE html>
<html lang="<%= I18n.locale %>" ng-app="application" class="app" ng-strict-di>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">

  <title><%=Setting.get('fablab_name')%></title>

  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic,700,800,700italic' rel='stylesheet' type='text/css'>
  <link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700,300italic' rel='stylesheet' type='text/css'>
  <link href='https://fonts.googleapis.com/css?family=Loved+by+the+King' rel='stylesheet' type='text/css'>
  <% if Rails.env.staging? && Rails.application.secrets.enable_in_context_translation %>
    <script type="text/javascript">
      var _jipt = [];
      _jipt.push(['project', 'fab-manager']);
    </script>
    <script type="text/javascript" src="//cdn.crowdin.com/jipt/jipt.js"></script>
  <% end %>
  <script type="text/javascript" src="https://js.stripe.com/v3/"></script>
  <script type="text/javascript">
      var Fablab = Fablab || {};

      Fablab.plansModule = ('<%= Setting.get('plans_module') %>' === 'true');
      Fablab.spacesModule = ('<%= Setting.get('spaces_module') %>' === 'true');
      Fablab.walletModule = ('<%= Setting.get('wallet_module') %>' === 'true');
      Fablab.statisticsModule = ('<%= Setting.get('statistics_module') %>' === 'true');
      Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
      Fablab.trackingId = "<%= Setting.get('tracking_id') %>";
      Fablab.superadminId = parseInt("<%= User.superadmin&.id %>", 10);
      Fablab.baseHostUrl = "<%= Rails.application.secrets.default_host %>";

      // i18n stuff
      Fablab.locale = "<%= Rails.application.secrets.app_locale %>";
      Fablab.moment_locale = "<%= Rails.application.secrets.moment_locale %>";
      Fablab.summernote_locale = "<%= Rails.application.secrets.summernote_locale %>";
      Fablab.fullcalendar_locale = "<%= Rails.application.secrets.fullcalendar_locale %>";
      Fablab.intl_locale = "<%= Rails.application.secrets.intl_locale %>";
      Fablab.intl_currency = "<%= Rails.application.secrets.intl_currency %>";
      Fablab.timezone = "<%= Time.zone.tzinfo.name %>";
      Fablab.translations = {
        app: {
          shared: {
            buttons: <%= I18n.t('app.shared.buttons').to_json.html_safe %>,
            messages: <%= I18n.t('app.shared.messages').to_json.html_safe %>
          }
        }
      };
      Fablab.weekStartingDay = <%= Date.parse(Rails.application.secrets.week_starting_day).strftime('%w') %>;
      Fablab.d3DateFormat = "<%= Rails.application.secrets.d3_date_format %>";
      Fablab.uibDateFormat = "<%= Rails.application.secrets.uib_date_format %>";

      // feature tour (used when feature_tour_display = session)
      Fablab.sessionTours = [];
  </script>

  <%= stylesheet_packs_with_chunks_tag 'application', media: 'all' %>
  <%= stylesheet_packs_with_chunks_tag 'plugins', media: 'all' %>
  <%= stylesheet_packs_with_chunks_tag 'printer', media: 'print' %>
  <% unless Stylesheet.theme.nil? %>
  <link rel="stylesheet" media="all" href="<%= stylesheet_path(Stylesheet.theme.id) %>-<%= Stylesheet.theme.updated_at.to_i.to_s %>.css" />
  <%  end %>
  <% unless Stylesheet.home_page.nil? %>
    <link rel="stylesheet" media="all" href="<%= stylesheet_path(Stylesheet.home_page.id) %>-<%= Stylesheet.home_page.updated_at.to_i.to_s %>.css" />
  <%  end %>
  <base href="/"></base>

  <% if CustomAsset.get_url('favicon-file') %>
    <link rel="shortcut icon" type="image/x-icon" href="<%= CustomAsset.get_url('favicon-file') %>">
    <link rel="shortcut icon" type="image/ico" href="<%= CustomAsset.get_url('favicon-file') %>">
  <% end %>

  <!-- RSS -->
  <link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.projects_list.the_fablab_projects') %>" href="<%= rss_projects_path %>.xml">
  <link rel="alternate" type="application/rss+xml" title="RSS: <%= t('app.public.events_list.the_fablab_s_events') %>" href="<%= rss_events_path %>.xml">

  <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>

<body ng-controller="ApplicationController"
      ng-init="setCurrentUser(<%= current_user ? current_user.to_json : 'null' %>)"
      ng-cloak>
  <div growl></div>

  <%= flash_messages %>

  <section class="vbox">

    <header class="header header-md navbar navbar-fixed-top-xs">
      <div ui-view="header"></div>
    </header>

    <section ui-view="content">
      <section class="hbox stretch">
        <aside id="nav" class="aside-md bg-red hidden-print" ui-view="leftnav"></aside>

        <section id="content">
          <section class="vbox">
            <section id="cookies-modal" ui-view="cookies">
            </section>
            <section id="content-main" class="scrollable" ui-view="main">
            </section>
          </section>
        </section>

      </section> <!-- /.hbox -->
    </section>

  </section> <!-- /.vbox -->

  <div class="app-generator">
    <span class="app-version" uib-tooltip="{{'app.public.common.version' | translate}} {{version.current}}" ng-if="currentUser && currentUser.role == 'admin'" ng-click="versionModal()">
      <i class="fa fa-question-circle" aria-label="Version ?" ng-show="version.up_to_date"></i>
      <i class="fa fa-refresh text-info pointer" aria-label="Upgrade required" ng-show="!version.up_to_date && !version.security"></i>
      <i class="fa fa-warning text-danger pointer" aria-label="Security upgrade required" ng-show="!version.up_to_date && version.security"></i>
    </span>
    <span class="text-sm">Powered by <a href="http://www.fab-manager.com" target="_blank">Fab-manager</a></span>
  </div>

<%= javascript_packs_with_chunks_tag 'application' %>
</body>
</html>
