]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/base.html
Add dropdown menu for user stuff
[cheatdb.git] / app / templates / base.html
1 <!DOCTYPE html>
2 <html>
3
4 <head>
5         <meta charset="utf-8">
6         <meta http-equiv="X-UA-Compatible" content="IE=edge">
7         <meta name="viewport" content="width=device-width, initial-scale=1">
8         <title>{% block title %}title{% endblock %} - {{ config.USER_APP_NAME }}</title>
9         <link rel="stylesheet" type="text/css" href="/static/main.css">
10         {% block headextra %}{% endblock %}
11 </head>
12
13 <body>
14         <nav>
15                 <ul class="nav navbar-nav">
16                         <li><a href="/"><img src="/static/logo_dark.svg" /></a></li>
17                         {% for item in current_menu.children recursive %}
18                                 {% if item.visible %}
19                                         <li{% if item.children %} class="dropdown"{% endif %}>
20                                                 <a href="{{ item.url }}"
21                                                                 {% if item.children %}
22                                                                         class="dropdown-toggle"
23                                                                         data-toggle="dropdown"
24                                                                         role="button"
25                                                                         aria-expanded="false"
26                                                                 {% endif %}>
27                                                         {{ item.text }}
28                                                         {% if item.children %}
29                                                                 <span class="caret"></span>
30                                                         {% endif %}
31                                                 </a>
32                                                 {% if item.children %}
33                                                 <ul class="dropdown-menu" role="menu">
34                                                         {{ loop(item.children) }}
35                                                 </ul>
36                                                 {% endif %}
37                                         </li>
38                                 {% endif %}
39                         {% endfor %}
40                 </ul>
41                 <ul class="nav navbar-nav navbar-right">
42                         {% if current_user.is_authenticated %}
43                                 <li><a href="{{ url_for('notifications_page') }}">({{ current_user.notifications | length }})</a></li>
44                                 <li class="dropdown">
45                                         <a href="{{ url_for('user_profile_page', username=current_user.username) }}"
46                                                 class="dropdown-toggle"
47                                                 data-toggle="dropdown"
48                                                 role="button"
49                                                 aria-expanded="false">{{ current_user.display_name }}
50                                                         <span class="caret"></span></a>
51
52                                         <ul class="dropdown-menu" role="menu">
53                                                 <li>
54                                                         <a href="{{ url_for('user_profile_page', username=current_user.username) }}">Profile</a>
55                                                 </li>
56                                                 {% if current_user.rank == current_user.rank.ADMIN %}
57                                                         <li><a href="{{ url_for('admin_page') }}">Admin</a></li>
58                                                 {% endif %}
59                                                 <li><a href="{{ url_for('user.logout') }}">Sign out</a></li>
60                                         </ul>
61                                 </li>
62                         {% else %}
63                                 <li><a href="{{ url_for('user.login') }}">Sign in</a></li>
64                         {% endif %}
65                 </ul>
66                 <div style="clear:both;"></div>
67         </nav>
68
69
70         {% block flash_messages %}
71                 {%- with messages = get_flashed_messages(with_categories=true) -%}
72                         {% if messages %}
73                                 <ul id="alerts">
74                                         {% for category, message in messages %}
75                                                 <li class="box box_grey alert alert-{{category}}">
76                                                         <span class="icon_message"></span>
77
78                                                         {{ message|safe }}
79
80                                                         <div style="clear: both;"></div>
81                                                 </li>
82                                         {% endfor %}
83                                 </ul>
84                         {% endif %}
85                 {%- endwith %}
86         {% endblock %}
87
88         {% block container %}
89         <main>
90                 {% block content %}
91                 {% endblock %}
92         </main>
93         {% endblock %}
94 </html>