aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-07-28 20:40:06 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-07-28 20:40:06 +0200
commit8c8981891e1fccc4a4491ffe02c26a9d4279f0e6 (patch)
tree7f73b6ae37bfa9edf43aae177e6b4fb0b66feb4c
parentabout page and licence (diff)
downloadscout-subs-8c8981891e1fccc4a4491ffe02c26a9d4279f0e6.tar.gz
scout-subs-8c8981891e1fccc4a4491ffe02c26a9d4279f0e6.zip
local font feching, list for non interactive items
Diffstat (limited to '')
-rw-r--r--accounts/templates/accounts/index.html14
-rw-r--r--accounts/views.py6
-rw-r--r--client/templates/client/index.html16
-rw-r--r--server/templates/server/doc_list.html20
-rw-r--r--server/templates/server/doc_type.html20
-rw-r--r--server/templates/server/index.html14
-rw-r--r--server/templates/server/user_list.html8
-rw-r--r--server/views.py21
-rw-r--r--static/fonts/MaterialIcons-Regular.eotbin0 -> 143258 bytes
-rw-r--r--static/fonts/MaterialIcons-Regular.ttfbin0 -> 128180 bytes
-rw-r--r--static/fonts/MaterialIcons-Regular.woffbin0 -> 57620 bytes
-rw-r--r--static/fonts/MaterialIcons-Regular.woff2bin0 -> 44300 bytes
-rw-r--r--static/material_icons.css36
-rw-r--r--templates/registration/base.html2
-rw-r--r--templates/registration/base_client.html4
-rw-r--r--templates/registration/base_custom.html2
-rw-r--r--templates/registration/base_simple.html2
17 files changed, 87 insertions, 78 deletions
diff --git a/accounts/templates/accounts/index.html b/accounts/templates/accounts/index.html
index 69d0717..e0674a7 100644
--- a/accounts/templates/accounts/index.html
+++ b/accounts/templates/accounts/index.html
@@ -11,17 +11,9 @@
{% if user.is_staff %}
<li><a href="{% url 'server' %}">Pannello Admin</a></li>
{% endif %}
- {% if user.is_authenticated %}
- <li><a href="{% url 'personal' %}">{{ user.username }}</a></li>
- {% endif %}
- {% if user.username != "" %}
- <li>
- <a href="{% url 'logout' %}"><i class="material-icons">exit_to_app</i></a>
- </li>
- {% else %}
- <li><a href="{% url 'signup' %}">Registrazione</a></li>
- <li><a href="{% url 'login' %}">Login</a></li>
- {% endif %}
+ <li><a href="{% url 'personal' %}">{{ user.username }}</a></li>
+ <li><a class="tooltipped" data-position="bottom" data-tooltip="Informazioni" href="{% url 'about' %}"><i class="material-icons">info_outline</i></a></li>
+ <li><a href="{% url 'logout' %}"><i class="material-icons">exit_to_app</i></a></li>
</ul>
</div>
<div class="nav-content teal">
diff --git a/accounts/views.py b/accounts/views.py
index cc402d2..23f4212 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -40,12 +40,18 @@ def personal(request):
if medic.vac_certificate != None:
filename = os.path.basename(medic.vac_certificate.name)
filename = filename[filename.find("_")+1:]
+ if filename.rfind('.') != -1:
+ filename = filename[:filename.rfind('.')]
+ filename = filename + ".jpg"
return FileResponse(medic.vac_certificate.file, as_attachment=True, filename=filename)
if request.POST['action'] == "download_health":
if medic.health_care_certificate != None:
filename = os.path.basename(medic.health_care_certificate.name)
filename = filename[filename.find("_")+1:]
+ if filename.rfind('.') != -1:
+ filename = filename[:filename.rfind('.')]
+ filename = filename + ".jpg"
return FileResponse(medic.health_care_certificate.file, as_attachment=True, filename=filename)
request.user.first_name = request.POST["first_name"]
diff --git a/client/templates/client/index.html b/client/templates/client/index.html
index b368630..45a7e90 100644
--- a/client/templates/client/index.html
+++ b/client/templates/client/index.html
@@ -43,14 +43,14 @@
<a class="waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i> Elimina documento</a>
<a class="waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i> Modifica documento</a>
</div>
- <div class="hide-on-large-only">
- <a class="s12 waves-effect waves-light btn teal" onclick="send('f{{doc.0.id}}')"><i class="material-icons left">file_download</i> Scarica documento per approvazione</a>
+ <div style="margin-bottom: 0px;" class="hide-on-large-only row">
+ <a class="col s12 waves-effect waves-light btn teal" onclick="send('f{{doc.0.id}}')"><i class="material-icons left">file_download</i> Scarica documento per approvazione</a>
<br>
<br>
- <a class="s12 waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i> Elimina documento</a>
+ <a class="col s12 waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i> Elimina documento</a>
<br>
<br>
- <a class="s12 waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i> Modifica documento</a>
+ <a class="col s12 waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i> Modifica documento</a>
</div>
<br>
<br>
@@ -72,14 +72,14 @@
<a class="waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i>Elimina documento</a>
<a class="waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i>Modifica documento</a>
</div>
- <div class="hide-on-large-only">
- <a class="s12 waves-effect waves-light btn teal modal-trigger" href="#modal{{doc.0.id}}"><i class="material-icons left">check</i>Approva documento</a>
+ <div style="margin-bottom: 0px;" class="hide-on-large-only row">
+ <a class="col s12 waves-effect waves-light btn teal modal-trigger" href="#modal{{doc.0.id}}"><i class="material-icons left">check</i>Approva documento</a>
<br>
<br>
- <a class="s12 waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i>Elimina documento</a>
+ <a class="col s12 waves-effect waves-light btn teal" onclick="send('d{{doc.0.id}}')"><i class="material-icons left">delete</i>Elimina documento</a>
<br>
<br>
- <a class="s12 waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i>Modifica documento</a>
+ <a class="col s12 waves-effect waves-light btn teal" onclick="send('e{{doc.0.id}}')"><i class="material-icons left">edit</i>Modifica documento</a>
</div>
<br>
<br>
diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html
index fb201d5..3953905 100644
--- a/server/templates/server/doc_list.html
+++ b/server/templates/server/doc_list.html
@@ -145,25 +145,19 @@
<br>
<br>
{% endif %}
- <ul class="collapsible">
+ <ul class="collection">
{% if doc.0.status == 'ok' or doc.0.status == 'archive' %}
- <li>
- <div class="collapsible-header">
- <i class="material-icons">confirmation_number</i>{{doc.0.code}}
- </div>
+ <li class="collection-item">
+ <i class="material-icons left">confirmation_number</i>{{doc.0.code}}
</li>
{% endif %}
{% if doc.0.document_type.custom_group %}
- <li>
- <div class="collapsible-header">
- <i class="material-icons">group_work</i>{{doc.0.group.name}}
- </div>
+ <li class="collection-item">
+ <i class="material-icons left">group_work</i>{{doc.0.group.name}}
</li>
{% endif %}
- <li>
- <div class="collapsible-header">
- <i class="material-icons">send</i>{{doc.0.compilation_date}}
- </div>
+ <li class="collection-item">
+ <i class="material-icons left">send</i>{{doc.0.compilation_date}}
</li>
</ul>
<ul class="collapsible">
diff --git a/server/templates/server/doc_type.html b/server/templates/server/doc_type.html
index 82adf83..d102664 100644
--- a/server/templates/server/doc_type.html
+++ b/server/templates/server/doc_type.html
@@ -160,26 +160,20 @@
<span class="new badge red lighten-1" data-badge-caption="">{{doctype.2}}</span>
</div>
<div class="collapsible-body"><span>
- <ul class="collapsible">
+ <ul class="collection">
{% if not doctype.0.group_private %}
- <li>
- <div class="collapsible-header">
- <i class="material-icons">group_work</i>{{doctype.0.group.name}}
- </div>
+ <li class="collection-item">
+ <i class="material-icons left">group_work</i>{{doctype.0.group.name}}
</li>
{% endif %}
{% if doctype.0.personal_data %}
- <li>
- <div class="collapsible-header">
- <i class="material-icons">person</i>Dati personali
- </div>
+ <li class="collection-item">
+ <i class="material-icons left">person</i>Dati personali
</li>
{% endif %}
{% if doctype.0.medical_data %}
- <li>
- <div class="collapsible-header">
- <i class="material-icons">healing</i>Dati medici
- </div>
+ <li class="collection-item">
+ <i class="material-icons left">healing</i>Dati medici
</li>
{% endif %}
</ul>
diff --git a/server/templates/server/index.html b/server/templates/server/index.html
index a049f4f..57cfc83 100644
--- a/server/templates/server/index.html
+++ b/server/templates/server/index.html
@@ -18,8 +18,6 @@
<th>Username</th>
<th>Nome</th>
<th>Cognome</th>
- <th>Codice</th>
- <th>Stato</th>
</tr>
{% for user in users %}
<tr>
@@ -40,22 +38,20 @@
<div class="col l6 s12">
<div class="card large">
<div class="card-content">
- <ul class="collapsible">
+ <ul class="collection">
{% for doctype in docs %}
- <li>
- <div class="collapsible-header">
+ <li class="collection-item">
{% if not doctype.0.enabled %}
- <i class="material-icons">visibility_off</i>
+ <i class="material-icons left">visibility_off</i>
{% endif %}
{% if not doctype.0.group_private %}
- <i class="material-icons">public</i>
+ <i class="material-icons left">public</i>
{% endif %}
{% if doctype.0.auto_sign %}
- <i class="material-icons">assignment_turned_in</i>
+ <i class="material-icons left">assignment_turned_in</i>
{% endif %}
{{doctype.0.name}}
<span class="new badge red lighten-1" data-badge-caption="">{{doctype.1}}</span>
- </div>
{% endfor %}
</ul>
</div>
diff --git a/server/templates/server/user_list.html b/server/templates/server/user_list.html
index 1010bd4..26e4b11 100644
--- a/server/templates/server/user_list.html
+++ b/server/templates/server/user_list.html
@@ -67,11 +67,9 @@
<a class="waves-effect waves-light btn red lighten-1 modal-trigger" href="#modal{{user.0.id}}"><i class="material-icons left">remove_circle_outline</i>Deapprova utente</a>
<br><br>
{% endif %}
- <ul class="collapsible">
- <li>
- <div class="collapsible-header">
- <i class="material-icons">confirmation_number</i>U{{user.1.code}}
- </div>
+ <ul class="collection">
+ <li class="collection-item">
+ <i class="material-icons left">confirmation_number</i>U{{user.1.code}}
</li>
</ul>
<ul class="collapsible">
diff --git a/server/views.py b/server/views.py
index e4b70ff..c634e6b 100644
--- a/server/views.py
+++ b/server/views.py
@@ -17,29 +17,21 @@ import pdfkit
from io import BytesIO
import os, base64
-# Create your views here.
-
@staff_member_required
def index(request):
context = {}
parent_group = request.user.groups.values_list('name', flat=True)[
0]
- users = User.objects.filter(groups__name=parent_group)
+ users = User.objects.filter(groups__name=parent_group).order_by("id")
users_out = []
+
for user in users:
- code = ""
- if len(UserCode.objects.filter(user=user)) > 0:
- code = 'U' + str(UserCode.objects.filter(user=user)[0].code)
- status = ""
- if user.is_staff:
- status = "Staff"
- elif user.has_perm("client.approved"):
- status = "Attivo"
- else:
- status = "In attesa"
+ if not user.has_perm("client.approved") and not user.is_staff:
+ continue
+
users_out.append([user.username, user.first_name,
- user.last_name, code, status])
+ user.last_name])
parent_group = request.user.groups.values_list('name', flat=True)[
0]
@@ -168,6 +160,7 @@ def ulist(request):
content_type = ContentType.objects.get_for_model(Document)
permission = Permission.objects.get(content_type=content_type, codename="approved")
user.user_permissions.remove(permission)
+ return HttpResponseRedirect("ulist")
users = User.objects.filter(groups__name=parent_group).order_by("first_name")
out = []
diff --git a/static/fonts/MaterialIcons-Regular.eot b/static/fonts/MaterialIcons-Regular.eot
new file mode 100644
index 0000000..70508eb
--- /dev/null
+++ b/static/fonts/MaterialIcons-Regular.eot
Binary files differ
diff --git a/static/fonts/MaterialIcons-Regular.ttf b/static/fonts/MaterialIcons-Regular.ttf
new file mode 100644
index 0000000..7015564
--- /dev/null
+++ b/static/fonts/MaterialIcons-Regular.ttf
Binary files differ
diff --git a/static/fonts/MaterialIcons-Regular.woff b/static/fonts/MaterialIcons-Regular.woff
new file mode 100644
index 0000000..b648a3e
--- /dev/null
+++ b/static/fonts/MaterialIcons-Regular.woff
Binary files differ
diff --git a/static/fonts/MaterialIcons-Regular.woff2 b/static/fonts/MaterialIcons-Regular.woff2
new file mode 100644
index 0000000..9fa2112
--- /dev/null
+++ b/static/fonts/MaterialIcons-Regular.woff2
Binary files differ
diff --git a/static/material_icons.css b/static/material_icons.css
new file mode 100644
index 0000000..86d60d7
--- /dev/null
+++ b/static/material_icons.css
@@ -0,0 +1,36 @@
+@font-face {
+ font-family: 'Material Icons';
+ font-style: normal;
+ font-weight: 400;
+ src: url(/static/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */
+ src: local('Material Icons'),
+ local('MaterialIcons-Regular'),
+ url(/static/fonts/MaterialIcons-Regular.woff2) format('woff2'),
+ url(/static/fonts/MaterialIcons-Regular.woff) format('woff'),
+ url(/static/fonts/MaterialIcons-Regular.ttf) format('truetype');
+}
+
+.material-icons {
+ font-family: 'Material Icons';
+ font-weight: normal;
+ font-style: normal;
+ font-size: 24px; /* Preferred icon size */
+ display: inline-block;
+ line-height: 1;
+ text-transform: none;
+ letter-spacing: normal;
+ word-wrap: normal;
+ white-space: nowrap;
+ direction: ltr;
+
+ /* Support for all WebKit browsers. */
+ -webkit-font-smoothing: antialiased;
+ /* Support for Safari and Chrome. */
+ text-rendering: optimizeLegibility;
+
+ /* Support for Firefox. */
+ -moz-osx-font-smoothing: grayscale;
+
+ /* Support for IE. */
+ font-feature-settings: 'liga';
+} \ No newline at end of file
diff --git a/templates/registration/base.html b/templates/registration/base.html
index 7af2fb7..ae0b536 100644
--- a/templates/registration/base.html
+++ b/templates/registration/base.html
@@ -2,7 +2,7 @@
<html>
<head>
{% load static %}
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ <link rel="stylesheet" type="text/css" href="{% static 'material_icons.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'materialize.min.css' %}">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8">
diff --git a/templates/registration/base_client.html b/templates/registration/base_client.html
index fb106d0..b6c3251 100644
--- a/templates/registration/base_client.html
+++ b/templates/registration/base_client.html
@@ -2,7 +2,7 @@
<html>
<head>
{% load static %}
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ <link rel="stylesheet" type="text/css" href="{% static 'material_icons.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'materialize.min.css' %}">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8">
@@ -21,7 +21,7 @@
<li><a class="tooltipped" data-position="bottom" data-tooltip="Preferenze" href="{% url 'personal' %}">{{ user.username }}</a></li>
{% endif %}
{% if user.username != "" %}
- <li><a href="{% url 'about' %}"><i class="material-icons">info_outline</i></a></li>
+ <li><a class="tooltipped" data-position="bottom" data-tooltip="Informazioni" href="{% url 'about' %}"><i class="material-icons">info_outline</i></a></li>
<li>
<a class="tooltipped" data-position="bottom" data-tooltip="Logout" href="{% url 'logout' %}"><i class="material-icons">exit_to_app</i></a>
</li>
diff --git a/templates/registration/base_custom.html b/templates/registration/base_custom.html
index 7a5bfee..89c665a 100644
--- a/templates/registration/base_custom.html
+++ b/templates/registration/base_custom.html
@@ -2,7 +2,7 @@
<html>
<head>
{% load static %}
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ <link rel="stylesheet" type="text/css" href="{% static 'material_icons.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'materialize.min.css' %}">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8">
diff --git a/templates/registration/base_simple.html b/templates/registration/base_simple.html
index 980aeca..ecafd0c 100644
--- a/templates/registration/base_simple.html
+++ b/templates/registration/base_simple.html
@@ -2,7 +2,7 @@
<html>
<head>
{% load static %}
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ <link rel="stylesheet" type="text/css" href="{% static 'material_icons.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'materialize.min.css' %}">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8">