Mercurial > farol > farol
comparison 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 |
comparison
equal
deleted
inserted
replaced
101:21a1a69b4525 | 102:65341d05a8f8 |
---|---|
20 # | 20 # |
21 # You should have received a copy of the GNU General Public License | 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 | 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. | 23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
24 -#} | 24 -#} |
25 | |
26 {% from "macros.j2" import modal, POST_button -%} | |
25 | 27 |
26 <!doctype html> | 28 <!doctype html> |
27 | 29 |
28 <html lang="en"> | 30 <html lang="en"> |
29 <head> | 31 <head> |
94 {% endif %} | 96 {% endif %} |
95 {% if caching %} | 97 {% if caching %} |
96 <li class="dropdown"> | 98 <li class="dropdown"> |
97 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Cache <span class="caret"></span></a> | 99 <a href="#" class="dropdown-toggle" data-toggle="dropdown">Cache <span class="caret"></span></a> |
98 <ul class="dropdown-menu" role="menu"> | 100 <ul class="dropdown-menu" role="menu"> |
99 <li role="presentation"{{ ' class="disabled"' if not has_current }}><a role="menuitem" tabindex="-1" href="{{ url_for('cache.save') }}">Save current</a> | 101 <li role="presentation"{{ ' class="disabled"' if not has_current }}><a role="menuitem" tabindex="-1" href="{{ url_for('cache.save') }}">Save {{ current_id }}</a> |
100 </li> | 102 </li> |
101 <li role="presentation" class="divider"></li> | 103 <li role="presentation" class="divider"></li> |
102 {% for element in cache | sort %}<li role="presentation"><a href="{{ url_for('cache.load', element=element)}}">{{ element }}</a></li>{% endfor %} | 104 {% for element in cache | sort %} |
105 <li role="presentation"> | |
106 {% if has_current %} | |
107 <a href="#{{element}}_modal" data-toggle="modal">Load {{ element }}</a> | |
108 {% else %} | |
109 {% call(selector) POST_button(url_for('cache.load', element=element), out=True) %} | |
110 <a role="menuitem" href="#" onclick="{{ selector }}.submit();return false;">Load {{ element }}</a> | |
111 {% endcall %} | |
112 {% endif %} | |
113 </li> | |
114 {% endfor %} | |
103 </ul> | 115 </ul> |
104 </li> | 116 </li> |
105 {% endif %} | 117 {% endif %} |
106 </ul> | 118 </ul> |
107 </div>{# /.navbar-collapse #} | 119 </div>{# /.navbar-collapse #} |
108 </div>{# /.container-fluid #} | 120 </div>{# /.container-fluid #} |
109 </nav> | 121 </nav> |
122 {% if has_current %} | |
123 {% for element in cache %} | |
124 {# Put the modals for the load action here #} | |
125 {% call modal(element + '_modal', 'Load %s from cache' % element) %} | |
126 <p>You asked to load <strong>{{ element }}</strong>, your changes to <strong>{{ current_id }}</strong> will be lost.</p> | |
127 <p>Do you want to save <strong>{{ current_id }}</strong> first ?</p> | |
128 </div> | |
129 <div class="modal-footer"> | |
130 <a href="{{ url_for('cache.save') }}" class="btn btn-success">Save {{ current_id }}</a> | |
131 {{ POST_button(url_for('cache.load', element=element), text="Load " + element, style="btn-danger") }} | |
132 {% endcall %} | |
133 {% endfor %} | |
134 {% endif %} | |
110 <div class="main container"> | 135 <div class="main container"> |
111 {% with messages = get_flashed_messages(with_categories=True) %} | 136 {% with messages = get_flashed_messages(with_categories=True) %} |
112 {% if messages %} | 137 {% if messages %} |
113 <div class="flashes"> | 138 <div class="flashes"> |
114 {% for category, message in messages %} | 139 {% for category, message in messages %} |