aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-07-30 12:33:01 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-07-30 12:33:01 +0200
commitf3fb72eee5a6ffe94990d4d97c1e9aed35575433 (patch)
tree2750bc8b8c16bb8e67742e81b7c25ca2f67153b7
parentsquash migrations (diff)
downloadscout-subs-f3fb72eee5a6ffe94990d4d97c1e9aed35575433.tar.gz
scout-subs-f3fb72eee5a6ffe94990d4d97c1e9aed35575433.zip
block debug actions and confirm for approve doc
-rw-r--r--accounts/views.py1
-rw-r--r--server/templates/server/upload_doc.html12
-rw-r--r--server/views.py4
3 files changed, 11 insertions, 6 deletions
diff --git a/accounts/views.py b/accounts/views.py
index a31d12b..4dd69a4 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -48,7 +48,6 @@ def personal(request):
context = {}
usercode = UserCode.objects.filter(user=request.user)[0]
medic = usercode.medic
- debug = ""
branca_default = ""
branca_castorini = ""
branca_lupetti = ""
diff --git a/server/templates/server/upload_doc.html b/server/templates/server/upload_doc.html
index 334a819..3650cd8 100644
--- a/server/templates/server/upload_doc.html
+++ b/server/templates/server/upload_doc.html
@@ -25,9 +25,7 @@
<input name="code" id="code" type="text">
<label for="code">Codice documento</label>
</div>
- <a class="waves-effect waves-light btn red lighten-1" onclick="send()">Anteprima documento</a>
</div>
- <br>
<div class="row">
<div class="file-field input-field col s12">
<div class="btn red lighten-1">
@@ -41,7 +39,8 @@
</div>
</div>
<div class="card-action">
- <a class="waves-effect waves-light btn red lighten-1" href="#" onclick="document.getElementById('form').submit()">Invia</a>
+ <a id="send_button" class="waves-effect waves-light btn red lighten-1" href="#" onclick="confirm()">Approva</a>
+ <a class="right waves-effect waves-light btn red lighten-1" onclick="send()">Anteprima documento</a>
</div>
</form>
</div>
@@ -61,6 +60,13 @@
{% endblock %}
{% block script %}
+function confirm() {
+ var button = document.getElementById('send_button')
+ button.innerHTML = "Sicuro?"
+ button.setAttribute('onclick', "document.getElementById('form').submit()")
+ button.setAttribute('class', "waves-effect waves-light btn green")
+}
+
function send() {
var form = document.getElementById('preview_form')
var action = document.getElementById('code_submit')
diff --git a/server/views.py b/server/views.py
index b230d51..c23e8c8 100644
--- a/server/views.py
+++ b/server/views.py
@@ -455,9 +455,9 @@ def doclist(request):
selected.append(docc)
for i in selected:
- if request.POST["action"] == 'delete':
+ if request.POST["action"] == 'delete' and settings.DEBUG:
i.delete()
- elif request.POST["action"] == 'approve':
+ elif request.POST["action"] == 'approve' and settings.DEBUG:
i.status = 'ok'
i.save()
elif request.POST["action"] == 'archive':