view farol/templates/base.j2 @ 125:67c4b299736e

Update look-and-feel
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 23 Oct 2014 16:18:30 +0200
parents ce64f90e58c4
children 3a56d5501ffa
line wrap: on
line source
{#
# Description:
# Web Template used in Farol Design
#
# Authors:
# BenoƮt Allard <benoit.allard@greenbone.net>
#
# Copyright:
# Copyright (C) 2014 Greenbone Networks GmbH
#
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA.
-#}

{% from "macros.j2" import modal, POST_button -%}

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Farol - {% block title %}{% endblock %}</title>
  <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap.css') }}">
  <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
  <script src="{{ url_for('static', filename='jquery-2.1.1.min.js') }}"></script>
  <script src="{{ url_for('static', filename='bootstrap.js') }}"></script>
  <nav class="navbar navbar-inverse" role="navigation">
    <div class="container">
      {# Brand and toggle get grouped for better mobile display #}
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="{{ url_for('welcome') }}" title="A Security Advisory Management Platform">Farol</a>
      </div>

      {# Collect the nav links, forms, and other content for toggling #}
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav">
          <li{% if active == 'new' %} class="active"{% endif %}><a href="{{ url_for('new') }}">New</a></li>
          {% if has_current %}
          <li{% if active == 'document' %} class="active"{% endif %}><a href="{{ url_for('document.view') }}">Document</a></li>
          {% endif %}
          {% if products %}
          <li class="dropdown{{ ' active' if active == 'product' }}">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Products <span class="caret"></span></a>
            <ul class="dropdown-menu" role="menu">
              <li role="presentation">
                <a role="menuitem" tabindex="-1" href="{{ url_for('producttree.view') }}">View Product Tree</a>
              </li>
              <li role="presentation" class="divider"></li>
              {% for name, productid in products | sort %}
                <li><a href="{{ url_for('producttree.view_product', productid=productid) }}">{{ name }}</a></li>
              {% endfor %}
            </ul>
          </li>
          {% endif %}
          {% if vulnerabilities %}
          <li class="dropdown{{ ' active' if active == 'vulnerability' }}">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Vulnerabilities <span class="caret"></span></a>
            <ul class="dropdown-menu" role="menu">
              {% for name, ord in vulnerabilities %}
                <li><a href="{{ url_for('vulnerability.view', ordinal=ord) }}">{{ name }}</a></li>
              {% endfor %}
            </ul>
          </li>
          {% endif %}
        </ul>
        {% if has_current %}
          {% if error %}
            <p class="navbar-text">Document is <a id="error-popover" href="#" tabindex="0" class="navbar-link" data-toggle="popover" data-trigger="focus" data-placement="bottom" title="First Error:" data-content="{{ error }}"><strong>invalid</strong></a> <span class="badge progress-bar-danger"><strong>&#x2717;</strong></span></p>
          {% else %}
            <p class="navbar-text">Document looks valid <span class="badge progress-bar-success"><strong>&#x2713;</strong></span></p>
          {% endif %}
        {% endif %}
        <ul class="nav navbar-nav navbar-right">
          {% if has_current %}
          <li class="dropdown{{ ' active' if active == 'render' }}">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Export <span class="caret"></span></a>
            <ul class="dropdown-menu" role="menu">
              {% for format in ('cvrf', 'nasl', 'oval') %}<li><a href="{{ url_for('render', format_=format)}}">as {{ format | upper }}</a></li>{% endfor %}
            </ul>
          </li>
          {% endif %}
          {% if caching %}
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Cache <span class="caret"></span></a>
            <ul class="dropdown-menu" role="menu">
              <li role="presentation"{{ ' class="disabled"' if not has_current }}>
                <a role="menuitem" tabindex="-1" href="{{ url_for('cache.save') }}">Save {{ current_id }}</a>
              </li>
              <li role="presentation" class="divider"></li>
              {% for element in cache | sort %}
                <li role="presentation">
                  {% if has_current %}
                    <a href="#{{element}}_modal" data-toggle="modal">Load {{ element }}</a>
                  {% else %}
                    {% call(selector) POST_button(url_for('cache.load', element=element), out=True) %}
                      <a role="menuitem" href="#" onclick="{{ selector }}.submit();return false;">Load {{ element }}</a>
                    {% endcall %}
                  {% endif %}
                </li>
              {% endfor %}
            </ul>
          </li>
          {% endif %}
        </ul>
      </div>{# /.navbar-collapse #}
    </div>{# /.container-fluid #}
  </nav>
  {% if has_current %}
    {% for element in cache %}
      {# Put the modals for the load action here #}
      {% call modal(element + '_modal', 'Load %s from cache' % element) %}
        <p>You asked to load <strong>{{ element }}</strong>, your changes to <strong>{{ current_id }}</strong> will be lost.</p>
        <p>Do you want to save <strong>{{ current_id }}</strong> first ?</p>
      </div>
      <div class="modal-footer">
        <a href="{{ url_for('cache.save') }}" class="btn btn-success">Save {{ current_id }}</a>
        {{ POST_button(url_for('cache.load', element=element), text="Load " + element, style="btn-danger") }}
      {% endcall %}
    {% endfor %}
  {% endif %}
  <div class="main container">
    {% with messages = get_flashed_messages(with_categories=True) %}
      {% if messages %}
      <div class="flashes">
      {% for category, message in messages %}
        {% if category == 'message' %}{% set category = "info" %}{% endif %}
        <div class="alert alert-{{ category }}">{{ message }}</div>
      {% endfor %}
      </div>
      {% endif %}
    {% endwith %}
    <div>
      <script>$("#error-popover").popover();</script>
      {% block content %}{% endblock %}
    </div>
    {% if config.DEBUG and not config.DEBUG_SURE %}
    <div class="alert alert-danger"><strong>DEBUG:</strong> This application is running in debug mode. See the <a href="{{ url_for('about') }}#debug">about page</a> for more Details</div>
    {% endif %}
  </div>
  <footer class="footer container-fluid navbar-inverse">
    <div class="text-center">
      <span class="text-muted">Copyright &copy; 2014 Greenbone Networks GmbH</span>
      |
      <span><a href="{{ url_for('about') }}">About Farol</a></span>
    </div>
    <a href="http://greenbone.net/" id="greenbone" class="logo_img text-hide center-block">Greenbone Networks GmbH</a>
  </footer>
</body>
</html>

http://farol.wald.intevation.org