From b694dc74293b54a341982ed5bd0973e3fc0e197a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tobias=20J=C3=BClg?= <tobias.juelg@tum.de>
Date: Sat, 7 May 2022 15:28:27 +0200
Subject: [PATCH] Unify submit buttons

* Unify submit buttons to have submit and cancel button
* Cancel is always like a back button and actually just a link
* Change Button color to blue and grey instead of green and red
---
 management/templates/management/add_election.html     | 4 +++-
 management/templates/management/add_session.html      | 6 +++++-
 management/templates/management/add_tokens.html       | 4 +++-
 management/templates/management/add_voters.html       | 4 +++-
 management/templates/management/import_csv.html       | 4 +++-
 management/templates/management/session.html          | 2 +-
 management/templates/management/session_settings.html | 7 ++++++-
 vote/templates/vote/application.html                  | 2 ++
 8 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/management/templates/management/add_election.html b/management/templates/management/add_election.html
index 9c4fd6c..82a98cd 100644
--- a/management/templates/management/add_election.html
+++ b/management/templates/management/add_election.html
@@ -86,9 +86,11 @@
             </div>
             <br>
 
-            <button type="submit" id="id_btn_send_test" class="btn btn-success" name="submit_type" value="commit">
+            <button type="submit" id="id_btn_send_test" class="btn btn-primary btn-block" name="submit_type" value="commit">
               Submit
             </button>
+              <a class="btn btn-secondary btn-block"
+              href="{% url 'management:session' session.pk %}">Cancel</a>
             <div id="dtBox"></div>
           </form>
         </div>
diff --git a/management/templates/management/add_session.html b/management/templates/management/add_session.html
index b87df27..39aaf6f 100644
--- a/management/templates/management/add_session.html
+++ b/management/templates/management/add_session.html
@@ -78,7 +78,11 @@
             </div>
 
             <br>
-            <button type="submit" id="id_btn_start" class="btn btn-success">Create Session</button>
+              <button type="submit" id="id_btn_start" class="btn btn-primary btn-block">Create Session</button>
+
+              <a class="btn btn-secondary btn-block"
+              href="{% url 'management:index' %}">Cancel</a>
+
             <div id="dtBox"></div>
           </form>
         </div>
diff --git a/management/templates/management/add_tokens.html b/management/templates/management/add_tokens.html
index 21e0ba4..f7b6bac 100644
--- a/management/templates/management/add_tokens.html
+++ b/management/templates/management/add_tokens.html
@@ -17,7 +17,9 @@
           <form class="user" action="{% url 'management:add_tokens' session.pk %}" method="post">
             {% csrf_token %}
             {{ form|crispy }}
-            <button type="submit" id="id_btn_start" class="btn btn-success">Submit</button>
+            <button type="submit" id="id_btn_start" class="btn btn-primary btn-block">Submit</button>
+              <a class="btn btn-secondary btn-block"
+              href="{% url 'management:session' session.pk %}">Cancel</a>
           </form>
         </div>
       </div>
diff --git a/management/templates/management/add_voters.html b/management/templates/management/add_voters.html
index 2edf547..5201d11 100644
--- a/management/templates/management/add_voters.html
+++ b/management/templates/management/add_voters.html
@@ -15,7 +15,9 @@
           <form class="user" action="{% url 'management:add_voters' session.pk %}" method="post">
             {% csrf_token %}
             {{ form|crispy }}
-            <button type="submit" id="id_btn_start" class="btn btn-success">Submit</button>
+            <button type="submit" id="id_btn_start" class="btn btn-primary btn-block">Submit</button>
+              <a class="btn btn-secondary btn-block"
+              href="{% url 'management:session' session.pk %}">Cancel</a>
           </form>
         </div>
       </div>
diff --git a/management/templates/management/import_csv.html b/management/templates/management/import_csv.html
index 8110806..feeeb36 100644
--- a/management/templates/management/import_csv.html
+++ b/management/templates/management/import_csv.html
@@ -18,7 +18,9 @@
                 enctype="multipart/form-data">
             {% csrf_token %}
             {{ form|crispy }}
-            <button type="submit" id="id_btn_start" class="btn btn-success">Submit</button>
+            <button type="submit" id="id_btn_start" class="btn btn-primary btn-block">Submit</button>
+              <a class="btn btn-secondary btn-block"
+              href="{% url 'management:session' session.pk %}">Cancel</a>
           </form>
         </div>
       </div>
diff --git a/management/templates/management/session.html b/management/templates/management/session.html
index 0a23baf..d9b2c88 100644
--- a/management/templates/management/session.html
+++ b/management/templates/management/session.html
@@ -151,7 +151,7 @@
           <a class="btn btn-warning d-inline float-left ml-2" id="downloadlink"
              href="{% url 'management:print_token' session.pk %}">Download Tokens</a>
 
-          <button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
+          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
         </div>
       </div>
     </div>
diff --git a/management/templates/management/session_settings.html b/management/templates/management/session_settings.html
index a445afd..30001f6 100644
--- a/management/templates/management/session_settings.html
+++ b/management/templates/management/session_settings.html
@@ -91,7 +91,12 @@
             </div>
 
             <br>
-            <button type="submit" id="id_btn_start" class="btn btn-success">Update</button>
+            <button type="submit" id="id_btn_start" class="btn btn-primary btn-block">Update</button>
+
+
+              <a class="btn btn-secondary btn-block"
+              href="{% url 'management:session' session.pk %}">Cancel</a>
+
             <div id="dtBox"></div>
           </form>
         </div>
diff --git a/vote/templates/vote/application.html b/vote/templates/vote/application.html
index 72e42dc..1538f42 100644
--- a/vote/templates/vote/application.html
+++ b/vote/templates/vote/application.html
@@ -69,6 +69,8 @@
               </div>
             {% endif %}
             <button type="submit" class="btn btn-primary btn-block">Submit</button>
+              <a class="btn btn-secondary btn-block"
+              href="{% url 'vote:index' %}">Cancel</a>
           </form>
         </div>
       </div>
-- 
GitLab