/
dashboard_base.html
194 lines (183 loc) · 9.26 KB
/
dashboard_base.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{% extends "layouts/base.html" %}
{# ~~Dashboard:Template~~ #}
{# we're potentially going need this in a few places in inherited files, so lets just put it here #}
{# ~~-> EditorGroup:Model ~~ #}
{% set managed_groups, maned_assignments = maned_of() %}
{% set editor_of_groups, editor_of_assignments = editor_of() %}
{% set associate_of_groups, associate_of_assignments = associate_of() %}
{# ~~Dashboard:Template~~ #}
{% block base_content %}
<body class="dashboard {% block body_class %}{% endblock %}" id="{% block body_id %}{% endblock %}" data-spy="scroll" data-offset="70">
{# global site note #}
{% if config.get("SITE_NOTE_ACTIVE", False) and not request.cookies.get(config.get("SITE_NOTE_KEY")) %}
{% include config.get("SITE_NOTE_TEMPLATE") %}
{% endif %}
<header>
<h2 class="sr-only">DOAJ Dashboard</h2>
<nav class="primary-nav flex-space-between" id="primary-nav">
<a href="{% if current_user.has_role('admin') %}/dashboard/{% elif current_user.has_role('editor') or current_user.has_role('associate_editor') %}/editor/{% endif %}" class="logo">
{% include "includes/svg/doaj-icon.svg" %}
</a>
<ul class="unstyled-list flex-center">
{% include "includes/_tourist_nav.html" %}
{# ~~->Notifications:Feature~~ #}
<li class="dropdown dropdown--notifications flex-center" id="notifications_nav">
<a href="/dashboard/notifications" class="dropdown__trigger label" id="dropdown__trigger--notifications" role="button" aria-haspopup="true" aria-expanded="false">
<span><span data-feather="bell" aria-hidden="true"></span> Notifications <span class="js-notifications-count"></span></span>
</a>
<ul class="dropdown__menu notifications" id="top_notifications"></ul>
</li>
{% if (current_user.has_role("editor") or current_user.has_role("associate_editor")) and not current_user.has_role("admin") %}
<li class="flex-center">
<a href="{{ url_for('editor.index') }}" class="label">
<span><span data-feather="list" aria-hidden="true"></span> Editor dashboard</span>
</a>
</li>
{% endif %}
{% if current_user.has_role("admin") %}
<li class="flex-center">
<a href="{{ url_for('dashboard.top_todo') }}" class="label">
<span><span data-feather="list" aria-hidden="true"></span> Admin dashboard</span>
</a>
</li>
{% endif %}
<li class="flex-center" id="doaj_home">
<a href="/" class="label">
<span><span data-feather="home" aria-hidden="true"></span> DOAJ home</span>
</a>
</li>
</ul>
</nav>
{% block nav %}
{% include 'dashboard/nav.html' %}
{% endblock %}
{% block extra_header %}{% endblock %}
</header>
{% block main_panel %}
<main>
<header class="main-header">
<div class="row">
<header class="col-md-6 col-lg-4">
<p class="label tag">
<small>
<a href="{{ url_for('account.username', username=current_user.id) }}" title="Manage my profile & settings">
<span data-feather="user" aria-hidden="true"></span>
{{ current_user.id }}
{% if current_user.has_role("admin") %}
(Managing Editor)
{% elif current_user.has_role("editor") %}
(Editor)
{% elif current_user.has_role("associate_editor") %}
(Associate Editor)
{% endif %}
</a>
</small>
</p>
<h1>
{% block page_title %}
Hi, {% if current_user.name %}{{ current_user.name }}{% else %}
{{ current_user.id }}{% endif %}!
{% endblock %}
</h1>
</header>
<nav class="col-md-6 col-lg-8 align-right">
<dl>
{% if current_user.has_role("admin") %}
{% if managed_groups and managed_groups|length > 0 %}
<dt class="sr-only">
Managing Editor of
</dt>
<dd>
<ul class="inlined-list tags">
{% for eg in managed_groups|sort(attribute="name") %}
<li>
{% set app_source = search_query_source(term=[
{"admin.editor_group.exact" : eg.name},
{"index.application_type.exact" : "new application"}
], sort=[{"admin.date_applied": {"order": "asc"}}]
) %}
<a href="{{ url_for('admin.suggestions') }}?source={{ app_source }}" title="See all {{ eg.name }} applications" class="tag tag--tertiary label"><span data-feather="users" aria-hidden="true"></span> <strong>{{ eg.name }}</strong></a>
</li>
{% endfor %}
</ul>
</dd>
{% endif %}
{% elif current_user.has_role("editor") %}
{% if editor_of_groups and editor_of_groups|length > 0 %}
<dt class="sr-only">
Editor groups:
</dt>
<dd>
<ul class="inlined-list tags">
{% for eg in editor_of_groups|sort(attribute="name") %}
<li>
{% set app_source = search_query_source(term=[
{"admin.editor_group.exact" : eg.name},
{"index.application_type.exact" : "new application"}
], sort=[{"admin.date_applied": {"order": "asc"}}]
) %}
<a href="{{ url_for('editor.group_suggestions') }}?source={{ app_source }}" title="See all {{ eg.name }} applications" class="tag tag--tertiary label"><span data-feather="users" aria-hidden="true"></span> <strong>{{ eg.name }}</strong></a>
{% set maned = eg.get_maned_account() %}
<a href="mailto:{{ maned.email }}" class="tag label"><span data-feather="mail" aria-hidden="true"></span> {{ maned.id }} (Managing Editor)</a>
{{ " / " if not loop.last else "" }}
</li>
{% endfor %}
</ul>
</dd>
{% endif %}
{% elif current_user.has_role("associate_editor") %}
{% if associate_of_groups and associate_of_groups|length > 0 %}
<dt class="sr-only">
Editor groups:
</dt>
<dd>
<ul class="tags">
{% for group in associate_of_groups|sort(attribute="name") %}
<li>
<small class="tag tag--tertiary label"><strong>{{ group.name }}</strong></small>
{% set ed = group.get_editor_account() %}
<a href="mailto:{{ ed.email }}" class="tag label"><span data-feather="mail" aria-hidden="true"></span> {{ ed.id }} (Editor)</a>
{% set maned = group.get_maned_account() %}
<a href="mailto:{{ maned.email }}" class="tag label"><span data-feather="mail" aria-hidden="true"></span> {{ maned.id }} (Managing Editor)</a>
{{ " / " if not loop.last else "" }}
</li>
{% endfor %}
</ul>
</dd>
{% endif %}
{% endif %}
</dl>
</nav>
</div>
</header>
{% include "includes/_flash_notification.html" %}
{% block content %}{% endblock %}
<p>
<small>
<a href="{{ url_for('account.logout') }}" class="tag" id="logout">
<span data-feather="log-out" aria-hidden="true"></span>
Log out
</a>
<a href="{{ url_for('account.username', username=current_user.id) }}" class="tag">
<span data-feather="settings" aria-hidden="true"></span>
Settings
</a>
</small>
</p>
</main>
{% include "includes/_back-to-top.html" %}
{% endblock %}
{% include '_js_includes.html' %}
<script type="text/javascript" src="/static/js/notifications.js?v={{config.get('DOAJ_VERSION')}}"></script>
{% block extra_js_bottom %}{% endblock extra_js_bottom %}
{% if not request.cookies.get("doaj-consent") %}
<script type="text/javascript">
jQuery(document).ready(function() {
$(".cookie-consent #cookie-consent-hide").on("click", setCookieConsent);
$(".site-note-dismiss").on("click", dissmissSiteNote);
});
</script>
{% endif %}
{% include "includes/_tourist.html" %}
</body>
{% endblock %}