{% from "_helpers.html" import alert, render_search_bar %}

<!doctype html>
<html>
<head>
  <title>{% block title %}Coprs Build System{% endblock %}</title>
  <link rel="stylesheet" href="{{ url_for('system_static', component='jquery-ui', filename='jquery-ui.min.css') }}" />
  <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/vnd.microsoft.icon">
  <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
  <link href="{{ url_for('system_static', component='patternfly', filename='css/patternfly.min.css') }}" rel="stylesheet" media="screen, print">
  <link rel="stylesheet" href="{{ url_for('system_static', component='patternfly', filename='css/patternfly-additions.min.css') }}">
  <link href="{{ url_for('static', filename='css/custom-styles.css') }}" rel="stylesheet" media="screen, print">
  <script src="{{ url_for('system_static', component='jquery', filename='3/jquery.min.js') }}"></script>
  <script src="{{ url_for('system_static', component='jquery-ui', filename='jquery-ui.min.js') }}"></script>
  <script src="{{ url_for('system_static', component='bootstrap_scss', filename='js/bootstrap.min.js') }}"></script>
  <script src="{{ url_for('system_static', component='datatables', filename='js/jquery.dataTables.min.js') }}"></script>
  <script src="{{ url_for('system_static', component='patternfly', filename='js/patternfly.min.js') }}"></script>

  <script src="{{ url_for('static', filename='copr.js') }}"></script>
  <link rel=stylesheet type=text/css href="{{ url_for('static', filename='copr.css') }}">
  <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/style-overwrite.css') }}">
  <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/copr-flavor.css') }}">
</head>

<body>
  <!-- BANNER -->
  {% if copr_banner %}
      {{ copr_banner | safe }}
  {% endif  %}

  <!-- MAIN MENU -->
  <nav class="" id="main-bar">
    <div class="container">
      <div class="row">
        <div class="col-md-8 col-sm-7 col-xs-6">
          <a href="{{ url_for('coprs_ns.coprs_show') }}">
            <img id="logo" src="{{ url_for('static', filename='copr_logo.png') }}" alt="Copr Build System">
          </a>
        </div>
        <div class="col-md-4 col-sm-5 col-xs-6">
          <div id="login-menu" class="text-right">

          {% for item in login_menu %}
          <a href="{{ item.link }}">{{ item.desc }}</a>
          {% if not loop.last %}|{% endif %}
          {% endfor %}

          </div>
          {{ render_search_bar() }}
        </div>
      </div>
    </div>
  </nav>
  <div class="breadcrumb-panel">
    <div class="container">
        {% block breadcrumbs %}
        {% endblock %}
    </div>
  </div>

  <!-- CONTENT -->
  <div id=content>
    <div class="container">

      <!-- Flash messages -->
      {% if flashes %}
        {% for type, message in flashes %}
          {{ alert(message, type) }}
        {% endfor %}
      {% else %}
        {% with messages = get_flashed_messages(with_categories=true) %}
          {% for type, message in messages %}
            {{ alert(message, type) }}
          {% endfor %}
        {% endwith %}
      {% endif %}



      <!-- the actual content -->
      {% block body %}{% endblock %}

    </div>
    <footer class="footer">
      <div>
        <div class="container text-muted">
          <div class="">
            <div class="row">
             <div class="col-sm-2">
                <dl>
                  {% include 'contact_us.html' %}
                </dl>
              </div>
              <div class="col-sm-2">
                <dl>
                  {% include 'project_info.html' %}
                </dl>
              </div>
              <div class="col-sm-2">
                <dl>
                  <dt><h3>Site Navigation</h3></dt>
                  <dd>
                    <ul>
                      <li> <a href="{{ url_for('coprs_ns.coprs_show') }}">Home</a> </li>
                      <li> <a href="{{url_for('status_ns.importing')}}">Task Queue</a> </li>
                      <li> <a href="{{ url_for('api_ns.api_home') }}">API</a> </li>
                      <li> <a href="{{ url_for('user_ns.user_info') }}">GDPR</a> </li>
                      <li> <a href="{{ url_for('rss_ns.rss') }}">RSS</a> </li>
                      <li> <a href="/db_dumps/">Database Dump</a> </li>
{% if config.BACKEND_STATS_URI %}
                      <li><a href="{{ config.BACKEND_BASE_URL }}{{ config.BACKEND_STATS_URI }}">Storage statistics</a> </li>
{% endif %}
                    </ul>
                  </dd>
                </dl>
              </div>
              <div class="col-sm-2">
                <dl>
                  <dt><h3>Powered by</h3></dt>
                  <dd>
                    <ul>
                      <li><a href="https://www.python.org">Python</a></li>
                      <li><a href="https://www.patternfly.org">PatternFly</a></li>
                      <li><a href="https://github.com/release-engineering/dist-git">Dist Git</a></li>
                      <li><a href="https://github.com/praiskup/resalloc">Resalloc</a></li>
                    </ul>
                  </dd>
                </dl>
              </div>
              <div class="col-sm-2">
                <dl>
                  {% include 'sponsors.html' %}
                </dl>
              </div>
            </div>
            <!-- <small class="text-muted">
              Build __RPM_BUILD_VERSION
              Build 1.125-1.git.16.4767b3b.fc25
            </small> -->
          </div>
        </div>
      </div>
    </footer>
  </div>

  <!-- FEDORA MENU -->
  {% if fedmenu_url is defined %}
  <script src="{{fedmenu_url}}/js/fedora-libravatar.js"></script>
  <script src="{{fedmenu_url}}/js/fedmenu.js"></script>
  <script>
    fedmenu({
        'url': '{{fedmenu_data_url}}',
        'mimeType': 'application/javascript',
        'position': 'bottom-right',
        {% if copr is defined %}
          {% if copr.is_a_group_project %}
            'user': '{{copr.group.fas_name}}',
          {% else %}
            'user': '{{copr.user.name}}',
          {% endif %}
        {% endif %}
    });
  </script>
  {% endif %}
  <!-- Last post from our blog -->
  {% if config.NEWS_URL and config.NEWS_FEED_URL %}
  <script src="{{ url_for('static', filename='js/blog.js') }}"></script>
  <script>
    $(document).ready(function(){
      show_last_articles("{{ config.NEWS_FEED_URL }}", 2)
      $(".show-me-javascript").removeClass("hidden");
    });
  </script>
  {% endif %}

  {% block footer %}{% endblock %}
</body>
</html>
