/
default.html
158 lines (150 loc) · 8.25 KB
/
default.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
{% extends "base.html" %}
{% load helper_tags %} {# for source_links, recent_articles, get_user_source_pagination, get_user_created_source_pagination #}
{% block content %}
<div class="container">
<title>{{ flatpage.title }} | Cantus Manuscript Database</title>
<div class="row">
<div class="p-3 col-lg-8 bg-white rounded main-content">
<h2>{{ flatpage.title }}</h2>
{{ flatpage.content }}
</div>
<div class="col p-0 sidebar">
<div class="search-bar mb-3">
{% include "global_search_bar.html" %}
</div>
<div class="card mt-3 w-100">
<div class="card-header">
Jump to Source
</div>
<div class="card-body">
<select name="sources" id="source-select" class="w-75" onchange="jumpSource()">
<option value="none">-Browse sources-</option>
{% source_links %}
</select>
</div>
<script>
function jumpSource() {
sourceLink = document.getElementById("source-select").options[document.getElementById("source-select").selectedIndex].value;
fullLink = window.location.origin + '/' + sourceLink;
window.location.assign(fullLink);
}
</script>
</div>
{% if request.user|has_group:"contributor" or request.user|has_group:"editor" or request.user|has_group:"project manager" %}
<div class="card mt-3 w-100">
<div class="card-header">
My Sources
</div>
{% get_user_source_pagination as user_sources_page_obj %}
<div class="card-body">
<small><a href="{% url "source-create" %}"><b>+ Add new source</b></a></small>
<ul>
{% for my_source in user_sources_page_obj %}
<li>
<a href="{% url "source-detail" my_source.pk %}">
<b> {{ my_source.siglum }}</b>
</a>
<br>
<small>
<a href="{% url "source-detail" my_source.pk %}">
<b> {{ my_source.title }}</b>
</a>
<br>
<a href="{% url "chant-create" my_source.pk %}" style="display: inline-block; margin-top:5px;">
+ Add new chant
</a>
<br>
{% if my_source.chant_set.all %}
<a href="{% url "source-edit-chants" my_source.pk %}">
• Full text & volpiano editor
</a>
{% endif %}
</small>
</li>
{% endfor %}
</ul>
<div class="pagination">
<span class="step-links">
{% if user_sources_page_obj.has_previous %}
<a href="?{% url_add_get_params page=1%}">«
first</a>
<a href="?{% url_add_get_params page=user_sources_page_obj.previous_page_number %}">previous</a>
{% endif %}
<span class="current">
Page {{ user_sources_page_obj.number }} of {{ user_sources_page_obj.paginator.num_pages }}
</span>
{% if user_sources_page_obj.has_next %}
<a href="?{% url_add_get_params page=user_sources_page_obj.next_page_number %}">next</a>
<a href="?{% url_add_get_params page=user_sources_page_obj.paginator.num_pages %}">last
»</a>
{% endif %}
</span>
</div>
</div>
</div>
<div class="mt-3"></div> {# for gap between "My sources" and "Sources created by user" cards #}
<div class="card mb-3 w-100">
<div class="card-header">
Sources created by user
</div>
{% get_user_created_source_pagination as user_created_sources_page_obj %}
<div class="card-body">
<small><a href="{% url "source-create" %}"><b>+ Add new source</b></a></small>
<ul>
{% for my_source in user_created_sources_page_obj %}
<li>
<a href="{% url "source-detail" my_source.pk %}">
<b> {{ my_source.siglum }}</b>
</a>
<br>
<small>
<a href="{% url "source-detail" my_source.pk %}">
<b> {{ my_source.title }}</b>
</a>
<br>
<a href="{% url "chant-create" my_source.pk %}" style="display: inline-block; margin-top:5px;">
+ Add new chant
</a>
<br>
{% if my_source.chant_set.all %}
<a href="{% url "source-edit-chants" my_source.pk %}">
• Full text & volpiano editor
</a>
{% endif %}
</small>
</li>
{% endfor %}
</ul>
<div class="pagination">
<span class="step-links">
{% if user_created_sources_page_obj.has_previous %}
<a href="?{% url_add_get_params page2=1%}">«
first</a>
<a href="?{% url_add_get_params page2=user_created_sources_page_obj.previous_page_number %}">previous</a>
{% endif %}
<span class="current">
Page {{ user_created_sources_page_obj.number }} of {{ user_created_sources_page_obj.paginator.num_pages }}
</span>
{% if user_created_sources_page_obj.has_next %}
<a href="?{% url_add_get_params page2=user_created_sources_page_obj.next_page_number %}">next</a>
<a href="?{% url_add_get_params page2=user_created_sources_page_obj.paginator.num_pages %}">last
»</a>
{% endif %}
</span>
</div>
</div>
</div>
{% else %}
<div class="card mt-3 w-100">
<div class="card-header">
What's New
</div>
<div class="card-body">
{% recent_articles %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}