annotate default/components/common.html @ 84:b2ef34e602cf

base, js (websocket), css (main style): dynamic pages implementation, first draft: this patch introduces the browser part of dynamic pages. Dynamic pages work by establishing a websocket between server and the current page, if requested by server (which means that needed arguments are present in template). Once the connection is established, the server can, for now, reload the page, append HTML elements, or receive arbitrary data (without reloading the page, in opposition to data post). If connection can't be established, a popup will be displayed and connection will be retried many times after variable timeouts. The browser will finally give up and display an alert to client if the number of retries is too high (20 for now).
author Goffi <goffi@goffi.org>
date Wed, 03 Jan 2018 01:12:16 +0100
parents ead4db120515
children 05b500bd6235
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 {# menu labels, map from menu names to labels #}
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
2 {% set ml = {
76
ead4db120515 components/common: profile is now always set, so we just test if it evaluate to True to know if a user is logged
Goffi <goffi@goffi.org>
parents: 66
diff changeset
3 'login': _('Session') if profile else _('Log in'),
66
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 'blog_view': _('Blog'),
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 'merge-requests_list': _('Merge requests'),
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 'merge-request_new': _('Create new merge request'),
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 'tickets_list': _('Tickets'),
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 'ticket_new': _('Create new ticket'),
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 } %}
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
10
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 {% macro menu(menus, class='') %}
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 <nav class="menu {{class}}">
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 <ul>
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 {% for name,url in menus %}
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 <li><a class="menu_item button {{name}}" {{ {'href': url}|xmlattr }}>{{ml[name]}}</a></li>
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
16 {% endfor %}
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 </ul>
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 </nav>
9834106678da base: menu implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
19 {% endmacro %}