From 446821cfafdf5bc7194d1cb055df244c7f52418e Mon Sep 17 00:00:00 2001
From: Allie Bopp <aebopp@umich.edu>
Date: Tue, 14 Jul 2020 17:36:38 -0400
Subject: [PATCH] manage org button under settings for org leaders

---
 servicePoints/templates/index.html            |   5 +++++
 servicePoints/templates/manageOrg.html        |  13 +++++++++++++
 .../views/__pycache__/accounts.cpython-36.pyc | Bin 13968 -> 14425 bytes
 servicePoints/views/accounts.py               |  14 ++++++++++++++
 4 files changed, 32 insertions(+)
 create mode 100644 servicePoints/templates/manageOrg.html

diff --git a/servicePoints/templates/index.html b/servicePoints/templates/index.html
index f0c4ffc..f6311cd 100644
--- a/servicePoints/templates/index.html
+++ b/servicePoints/templates/index.html
@@ -50,9 +50,14 @@
     Username: {{username}}
     <div class="dropdown">
         <button onclick="myFunction()" class="dropbtn">Settings</button>
+
         <div id="myDropdown" class="dropdown-content">
             <a href="/accounts/profile/">Profile</a>
+            {% if leader == 1 %}
+            <a href="/accounts/manageOrg/">Manage Org</a>
+            {% endif %}
             <a href="/accounts/logout/">Logout</a>
+
         </div>
     </div>
 
diff --git a/servicePoints/templates/manageOrg.html b/servicePoints/templates/manageOrg.html
new file mode 100644
index 0000000..ecbcf5d
--- /dev/null
+++ b/servicePoints/templates/manageOrg.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+  <head>
+      <link rel="stylesheet" type="text/css" href="/css/style.css">
+      <title>ServicePoints</title>
+  </head>
+
+  <body>
+    <p>
+      {{org}}
+    </p>
+  </body>
+</html>
diff --git a/servicePoints/views/__pycache__/accounts.cpython-36.pyc b/servicePoints/views/__pycache__/accounts.cpython-36.pyc
index 9f728b0a7d16dbe1209a926485c7d9974f50d743..cb131b8bf79f711104bf893a45155d5bdf30fd1c 100644
GIT binary patch
delta 402
zcmbP`d$T~<n3tF9r3zpCk#Giv#|%h-1;};);^G$@l@Bv%rLt#nXYr=^rLd;3r8A|l
z_cEpUrv$VxG&4r2r39t~wJ=1fr!WRHXa;Zo!c<`xUnQcSn4FwnnpaY+pPQJMn4aoi
zl&+r)vw#)I0NLOSvY`S<q%f8+WHDy56=i_v6h=vgS_UACDT_IUDVwRt0LW$mV%8Mq
zX2xd5;K^?dl}%IFYM4{lB^fdqYgtOTQ#fl_`hYG#Q^}yo<yXW8w4n%OUy;^iMqzWU
zA~z6Q7fAf#gS$>Iqa-&+ld)(rP*{_vh##axV6vc+#N-3&l9L}8vof+yc9zi8=7j5b
z#t3x17*HJp6Bi>FBM+khkYoe0Ie=^~#-b^cGfggweFLcixqyL*4<y<JWNB(l4l+H@
UIAyY|nKq-_WKT0UW+@o~002B$OaK4?

delta 107
zcmcavFd<jjn3tEUNQp0ADU^ZXF#{4{0kR!{xcJOQ<-<&TDSj#bEeug=DU87kngN>y
vm@5n?>zQ2;d%*})!UodE#K*|RSkwh%X{t{aF+V@~g}FMT%VYryH%1u%vh)`J

diff --git a/servicePoints/views/accounts.py b/servicePoints/views/accounts.py
index 15a067e..3e0dba8 100644
--- a/servicePoints/views/accounts.py
+++ b/servicePoints/views/accounts.py
@@ -483,6 +483,20 @@ def confirmSubmission():
         context = {"leader": results["fullname"]}
     return render_template('confirmSubmission.html', **context)
 
+@servicePoints.app.route('/accounts/manageOrg/', methods=['GET', 'POST'])
+def manageOrg():
+    if 'username' in flask.session:
+        username = flask.session["username"]
+        if flask.request.method == 'POST':
+            return flask.redirect(flask.url_for('login'))
+        cursor = servicePoints.model.get_db()
+        leaderCur = cursor.execute('SELECT orgName FROM orgs WHERE '
+                    'username =:who',
+                    {"who": username})
+        results = leaderCur.fetchone()
+        context = {'org': results["orgName"]}
+        return render_template('manageOrg.html', **context)
+    return flask.redirect(flask.url_for('login'))
 
 
 def sha256sum(filename):
-- 
GitLab