maintopics-table.html
6.94 KB
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
{% autoescape %}
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="Miguel Barão">
<link rel="icon" href="/static/favicon.ico">
<!-- Styles -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" href="{{static_url('css/maintopics.css')}}">
<!-- Scripts -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script defer src="{{static_url('js/maintopics.js')}}"></script>
<title>{{appname}}</title>
</head>
<!-- ===================================================================== -->
<body>
<nav class="navbar navbar-expand-sm navbar-dark bg-secondary fixed-top shadow">
<div class="container-fluid">
<img src="{{static_url('logo_horizontal.png')}}" height="48" width="120" class="navbar-brand" alt="UEvora">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="/courses">Cursos</a></li>
<li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Tópicos</a></li>
<li class="nav-item"><a class="nav-link" href="/rankings?course={{course_id}}">Classificação</a></li>
</ul>
<ul class="navbar-nav ms-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fas fa-user-graduate" aria-hidden="true"></i>
<span id="name">{{ escape(name) }}</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" data-bs-toggle="modal" data-bs-target="#password_modal">Mudar Password</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="/logout">Sair</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- === Change Password Modal =========================================== -->
<div id="password_modal" class="modal fade" tabindex="-1" aria-labelledby="password_modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- header -->
<div class="modal-header">
<h5 class="modal-title">Alterar Password</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- body -->
<div class="modal-body">
<div class="control-group">
<label for="new_password" class="control-label">Introduza a nova password:</label>
<div class="controls">
<input type="password" id="new_password" name="new_password" autocomplete="new-password">
</div>
</div>
</div>
<!-- footer -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button id="change_password" type="button" class="btn btn-primary" data-bs-dismiss="modal">Alterar</button>
</div>
<!-- end -->
</div>
</div>
</div>
<!-- ===================================================================== -->
<div class="container">
<div id="notifications"></div>
<h1 class="display-6">{{ course['title'] }}</h1>
<table class="table table-hover">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Tópico</th>
<th scope="col" class="text-center">Estado</th>
</tr>
</thead>
<tbody>
{% for t in state %}
<!-- ------------------------------------------------------------- -->
{% if t['level'] is None %}
<tr>
<th scope="row" class="text-muted text-center">
{% if t['type']=='chapter' %}
<i class="fas fa-flag"></i>
{% elif t['type']=='learn' %}
<i class="fas fa-book"></i>
{% else %}
<i class="fas fa-pencil-alt"></i>
{% end %}
</th>
<td>
<div class="text-muted">
{% if t['ref'] not in course['goals'] %}
<i class="fas fa-puzzle-piece"></i>
{% end %}
{{ t['name'] }}
</div>
</td>
<td class="text-center">
<i class="fas fa-lock text-muted"></i>
</td>
</tr>
{% else %}
<tr class="clickable-row " data-href="/topic/{{t['ref']}}">
<th scope="row" class="text-primary text-center">
{% if t['type']=='chapter' %}
<i class="fas fa-flag-checkered"></i>
{% elif t['type']=='learn' %}
<i class="fas fa-book"></i>
{% else %}
<i class="fas fa-pencil-alt"></i>
{% end %}
</th>
<td class="text-primary">
{% if t['ref'] not in course['goals'] %}
<i class="fas fa-puzzle-piece"></i>
{% end %}
{{ t['name'] }}
</td>
<td class="text-center">
{% if t['level'] < 0.01 %}
<i class="fas fa-lock-open text-success"></i>
{% elif t['type']=='chapter' %}
<h5><i class="fas fa-award text-warning"></i></h5>
{% else %}
<span class="text-nowrap text-warning" data-toggle="tooltip" data-placement="bottom" title="{{round(t['level']*5, 2)}}">
{{int(t['level']*5+0.25)*'<i class="fas fa-star"></i>'}}{% if int(t['level']*5+0.25) < 5 %}{{'<i class="fas fa-star-half-alt"></i>' if 0.25 <= t['level']*5-int(t['level']*5) < 0.75 else '<i class="far fa-star"></i>'}}{% end %}{{(4-int(t['level']*5+0.25))*'<i class="far fa-star"></i>' }}
</span>
{% end %} <!-- if -->
</td>
</tr>
{% end %} <!-- if level is none -->
<!-- ------------------------------------------------------------- -->
{% end %} <!-- for -->
</tbody>
</table>
</div>
</body>
</html>