Mercurial > farol > farol
annotate farol/templates/base.j2 @ 102:65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 14 Oct 2014 10:25:43 +0200 |
parents | 641a2b589613 |
children | ce64f90e58c4 |
rev | line source |
---|---|
0 | 1 {# |
2 # Description: | |
3 # Web Template used in Farol Design | |
4 # | |
5 # Authors: | |
6 # BenoƮt Allard <benoit.allard@greenbone.net> | |
7 # | |
8 # Copyright: | |
9 # Copyright (C) 2014 Greenbone Networks GmbH | |
10 # | |
11 # This program is free software; you can redistribute it and/or | |
12 # modify it under the terms of the GNU General Public License | |
13 # as published by the Free Software Foundation; either version 2 | |
14 # of the License, or (at your option) any later version. | |
15 # | |
16 # This program is distributed in the hope that it will be useful, | |
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 # GNU General Public License for more details. | |
20 # | |
21 # You should have received a copy of the GNU General Public License | |
22 # along with this program; if not, write to the Free Software | |
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
24 -#} | |
25 | |
102
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
26 {% from "macros.j2" import modal, POST_button -%} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
27 |
0 | 28 <!doctype html> |
29 | |
30 <html lang="en"> | |
31 <head> | |
28
6c65b16f2680
Rework the 'new' page
Benoît Allard <benoit.allard@greenbone.net>
parents:
26
diff
changeset
|
32 <meta charset="utf-8"> |
0 | 33 <title>Farol - {% block title %}{% endblock %}</title> |
34 <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap.css') }}"> | |
35 <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"> | |
36 </head> | |
37 <body> | |
38 <script src="{{ url_for('static', filename='jquery-2.1.1.min.js') }}"></script> | |
39 <script src="{{ url_for('static', filename='bootstrap.js') }}"></script> | |
26
33a3a36b5bf6
Use the navbar-inverse theme to come closer to greenbone, and apply it to footer also
Benoît Allard <benoit.allard@greenbone.net>
parents:
25
diff
changeset
|
40 <nav class="navbar navbar-inverse" role="navigation"> |
0 | 41 <div class="container"> |
42 {# Brand and toggle get grouped for better mobile display #} | |
43 <div class="navbar-header"> | |
44 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
45 <span class="sr-only">Toggle navigation</span> | |
46 <span class="icon-bar"></span> | |
47 <span class="icon-bar"></span> | |
48 <span class="icon-bar"></span> | |
49 </button> | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
6
diff
changeset
|
50 <a class="navbar-brand" href="{{ url_for('welcome') }}">Farol</a> |
0 | 51 </div> |
52 | |
53 {# Collect the nav links, forms, and other content for toggling #} | |
54 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | |
55 <ul class="nav navbar-nav"> | |
56 <li{% if active == 'new' %} class="active"{% endif %}><a href="{{ url_for('new') }}">New</a></li> | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
6
diff
changeset
|
57 {% if has_current %} |
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
6
diff
changeset
|
58 <li{% if active == 'document' %} class="active"{% endif %}><a href="{{ url_for('document.view') }}">Document</a></li> |
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
6
diff
changeset
|
59 {% endif %} |
0 | 60 {% if products %} |
61 <li class="dropdown{{ ' active' if active == 'product' }}"> | |
62 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Products <span class="caret"></span></a> | |
63 <ul class="dropdown-menu" role="menu"> | |
64 {% for name, productid in products %} | |
65 <li><a href="{{ url_for('producttree.view_product', productid=productid) }}">{{ name }}</a></li> | |
66 {% endfor %} | |
67 </ul> | |
68 </li> | |
69 {% endif %} | |
70 {% if vulnerabilities %} | |
71 <li class="dropdown{{ ' active' if active == 'vulnerability' }}"> | |
72 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Vulnerabilities <span class="caret"></span></a> | |
73 <ul class="dropdown-menu" role="menu"> | |
74 {% for name, ord in vulnerabilities %} | |
75 <li><a href="{{ url_for('vulnerability.view', ordinal=ord) }}">{{ name }}</a></li> | |
76 {% endfor %} | |
77 </ul> | |
78 </li> | |
79 {% endif %} | |
77
641a2b589613
Product better HTML
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
80 </ul> |
641a2b589613
Product better HTML
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
81 {% if has_current %} |
641a2b589613
Product better HTML
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
82 {% if error %} |
641a2b589613
Product better HTML
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
83 <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></p> |
641a2b589613
Product better HTML
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
84 {% else %} |
641a2b589613
Product better HTML
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
85 <p class="navbar-text">Document looks valid</p> |
0 | 86 {% endif %} |
77
641a2b589613
Product better HTML
Benoît Allard <benoit.allard@greenbone.net>
parents:
28
diff
changeset
|
87 {% endif %} |
0 | 88 <ul class="nav navbar-nav navbar-right"> |
25
4a3fdd3f2723
Move the 'Save' to the cache menu, only show render when a document is loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
14
diff
changeset
|
89 {% if has_current %} |
4a3fdd3f2723
Move the 'Save' to the cache menu, only show render when a document is loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
14
diff
changeset
|
90 <li class="dropdown{{ ' active' if active == 'render' }}"> |
4a3fdd3f2723
Move the 'Save' to the cache menu, only show render when a document is loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
14
diff
changeset
|
91 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Render <span class="caret"></span></a> |
0 | 92 <ul class="dropdown-menu" role="menu"> |
93 {% for format in ('cvrf', 'nasl', 'oval') %}<li><a href="{{ url_for('render', format_=format)}}">as {{ format | upper }}</a></li>{% endfor %} | |
94 </ul> | |
95 </li> | |
25
4a3fdd3f2723
Move the 'Save' to the cache menu, only show render when a document is loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
14
diff
changeset
|
96 {% endif %} |
12
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
97 {% if caching %} |
0 | 98 <li class="dropdown"> |
99 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Cache <span class="caret"></span></a> | |
100 <ul class="dropdown-menu" role="menu"> | |
102
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
101 <li role="presentation"{{ ' class="disabled"' if not has_current }}><a role="menuitem" tabindex="-1" href="{{ url_for('cache.save') }}">Save {{ current_id }}</a> |
25
4a3fdd3f2723
Move the 'Save' to the cache menu, only show render when a document is loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
14
diff
changeset
|
102 </li> |
4a3fdd3f2723
Move the 'Save' to the cache menu, only show render when a document is loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
14
diff
changeset
|
103 <li role="presentation" class="divider"></li> |
102
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
104 {% for element in cache | sort %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
105 <li role="presentation"> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
106 {% if has_current %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
107 <a href="#{{element}}_modal" data-toggle="modal">Load {{ element }}</a> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
108 {% else %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
109 {% call(selector) POST_button(url_for('cache.load', element=element), out=True) %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
110 <a role="menuitem" href="#" onclick="{{ selector }}.submit();return false;">Load {{ element }}</a> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
111 {% endcall %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
112 {% endif %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
113 </li> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
114 {% endfor %} |
0 | 115 </ul> |
116 </li> | |
12
4219d6fb4c38
Implement three kind of caches
Benoît Allard <benoit.allard@greenbone.net>
parents:
8
diff
changeset
|
117 {% endif %} |
0 | 118 </ul> |
119 </div>{# /.navbar-collapse #} | |
120 </div>{# /.container-fluid #} | |
121 </nav> | |
102
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
122 {% if has_current %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
123 {% for element in cache %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
124 {# Put the modals for the load action here #} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
125 {% call modal(element + '_modal', 'Load %s from cache' % element) %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
126 <p>You asked to load <strong>{{ element }}</strong>, your changes to <strong>{{ current_id }}</strong> will be lost.</p> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
127 <p>Do you want to save <strong>{{ current_id }}</strong> first ?</p> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
128 </div> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
129 <div class="modal-footer"> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
130 <a href="{{ url_for('cache.save') }}" class="btn btn-success">Save {{ current_id }}</a> |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
131 {{ POST_button(url_for('cache.load', element=element), text="Load " + element, style="btn-danger") }} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
132 {% endcall %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
133 {% endfor %} |
65341d05a8f8
Spawn a Modal when loading a doc, and another one is already loaded
Benoît Allard <benoit.allard@greenbone.net>
parents:
77
diff
changeset
|
134 {% endif %} |
0 | 135 <div class="main container"> |
136 {% with messages = get_flashed_messages(with_categories=True) %} | |
137 {% if messages %} | |
138 <div class="flashes"> | |
139 {% for category, message in messages %} | |
140 {% if category == 'message' %}{% set category = "info" %}{% endif %} | |
141 <div class="alert alert-{{ category }}">{{ message }}</div> | |
142 {% endfor %} | |
143 </div> | |
144 {% endif %} | |
145 {% endwith %} | |
146 <div> | |
147 <script>$("#error-popover").popover();</script> | |
148 {% block content %}{% endblock %} | |
149 </div> | |
1
63b00c10ada8
Add Configuration support, warning when in DEBUG mode, and Deployment instruction
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
150 {% if config.DEBUG and not config.DEBUG_SURE %} |
14
a52995b50ecc
Add a warning when saving to a private cache
Benoît Allard <benoit.allard@greenbone.net>
parents:
12
diff
changeset
|
151 <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> |
1
63b00c10ada8
Add Configuration support, warning when in DEBUG mode, and Deployment instruction
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
152 {% endif %} |
0 | 153 </div> |
26
33a3a36b5bf6
Use the navbar-inverse theme to come closer to greenbone, and apply it to footer also
Benoît Allard <benoit.allard@greenbone.net>
parents:
25
diff
changeset
|
154 <footer class="footer container-fluid navbar-inverse"> |
6
bb7334ff114a
Add the Greenbone Logo to the footer.
Benoît Allard <benoit.allard@greenbone.net>
parents:
1
diff
changeset
|
155 <div class="text-center"> |
bb7334ff114a
Add the Greenbone Logo to the footer.
Benoît Allard <benoit.allard@greenbone.net>
parents:
1
diff
changeset
|
156 <span class="text-muted">Copyright © 2014 Greenbone Networks GmbH</span> |
bb7334ff114a
Add the Greenbone Logo to the footer.
Benoît Allard <benoit.allard@greenbone.net>
parents:
1
diff
changeset
|
157 | |
8
2ce3676c9b2e
Ease the import of new documents
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
158 <span><a href="{{ url_for('about') }}">About Farol</a></span> |
6
bb7334ff114a
Add the Greenbone Logo to the footer.
Benoît Allard <benoit.allard@greenbone.net>
parents:
1
diff
changeset
|
159 </div> |
bb7334ff114a
Add the Greenbone Logo to the footer.
Benoît Allard <benoit.allard@greenbone.net>
parents:
1
diff
changeset
|
160 <a href="http://greenbone.net/" id="greenbone" class="logo_img text-hide center-block">Greenbone Networks GmbH</a> |
0 | 161 </footer> |
162 </body> | |
163 </html> |