From: Jan Szejko Date: Thu, 3 Jan 2019 15:22:51 +0000 (+0100) Subject: stage 2: message on save X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/32f1e5e6ca927cfbb8b69e87ba456db2b5eb5f89 stage 2: message on save --- diff --git a/edumed/static/css/base.css b/edumed/static/css/base.css index d9d5479..07cf233 100644 --- a/edumed/static/css/base.css +++ b/edumed/static/css/base.css @@ -220,15 +220,19 @@ footer.main { ul.messages { list-style: none; } -.messages .error { +.messages li { top: 20px; left: 20px; - border: 1px solid black; - background: red; border-radius: 0.938em; padding: 5px 2px; color: white; text-align: center; font-weight: bold; } + .messages li.error { + background: red; + border: 1px solid black; } + .messages li.info { + background: #ed7831; + border: none; } /*# sourceMappingURL=base.css.map */ diff --git a/edumed/static/css/base.scss b/edumed/static/css/base.scss index c1390aa..9896a5f 100644 --- a/edumed/static/css/base.scss +++ b/edumed/static/css/base.scss @@ -279,11 +279,17 @@ ul.messages { list-style: none; } -.messages .error { +.messages li { top: 20px; left: 20px; - border: 1px solid black; - background: red; + &.error { + background: red; + border: 1px solid black; + } + &.info { + background: #ed7831; + border: none; + } border-radius: 0.938em; padding: 5px 2px; color: white; diff --git a/stage2/templates/stage2/participant.html b/stage2/templates/stage2/participant.html index 2b5e3d4..130dda6 100644 --- a/stage2/templates/stage2/participant.html +++ b/stage2/templates/stage2/participant.html @@ -7,6 +7,14 @@ {% block body %}

II etap Olimpiady Cyfrowej

+ {% if messages %} + + {% endif %} + {% chunk 'stage2_header' %} {% for assignment in assignments %} diff --git a/stage2/views.py b/stage2/views.py index 3b05eb0..d14e638 100644 --- a/stage2/views.py +++ b/stage2/views.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse from django.http import Http404 @@ -60,6 +61,7 @@ def participant_view(request, participant_id, key): # trzeba by znaleźć sensowny sposób odrózniania błędnego pliku od braku pliku. # na szczęście pliki walidujemy też javascriptem, więc jakoś ujdzie if fields_valid: + messages.info(request, u'Dane zostały poprawnie zapisane na serwerze') return HttpResponseRedirect(reverse('stage2_participant', args=(participant_id, key))) else: sent_forms = (assignment, field_forms, attachment_forms)