stage 2: message on save
authorJan Szejko <janek37@gmail.com>
Thu, 3 Jan 2019 15:22:51 +0000 (16:22 +0100)
committerJan Szejko <janek37@gmail.com>
Thu, 3 Jan 2019 15:22:51 +0000 (16:22 +0100)
edumed/static/css/base.css
edumed/static/css/base.scss
stage2/templates/stage2/participant.html
stage2/views.py

index d9d5479..07cf233 100644 (file)
@@ -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 */
index c1390aa..9896a5f 100644 (file)
@@ -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;
index 2b5e3d4..130dda6 100644 (file)
@@ -7,6 +7,14 @@
 {% block body %}
   <h1>II etap Olimpiady Cyfrowej</h1>
 
+  {% if messages %}
+    <ul class="messages">
+        {% for message in messages %}
+            <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
+        {% endfor %}
+    </ul>
+  {% endif %}
+
   {% chunk 'stage2_header' %}
 
   {% for assignment in assignments %}
index 3b05eb0..d14e638 100644 (file)
@@ -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)