aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-01-30 03:01:57 +0300
committerFrederick Muriuki Muriithi2023-01-30 03:01:57 +0300
commit429d07662258bb4a139fd22249e258caacddf78c (patch)
treef3a0245a26d20a582f8c9f6c14eb3f64e2d9fee0 /wqflask
parentd22d1f8f0b34a1952a8836e9f894b20027a607e8 (diff)
downloadgenenetwork2-429d07662258bb4a139fd22249e258caacddf78c.tar.gz
oauth2: Display user's group information.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/oauth2/groups.py10
-rw-r--r--wqflask/wqflask/oauth2/users.py8
-rw-r--r--wqflask/wqflask/templates/oauth2/group.html27
-rw-r--r--wqflask/wqflask/templates/oauth2/profile_nav.html2
4 files changed, 37 insertions, 10 deletions
diff --git a/wqflask/wqflask/oauth2/groups.py b/wqflask/wqflask/oauth2/groups.py
index 3dc6f00f..0bd40044 100644
--- a/wqflask/wqflask/oauth2/groups.py
+++ b/wqflask/wqflask/oauth2/groups.py
@@ -2,10 +2,18 @@ from flask import Blueprint, render_template
from .checks import require_oauth2
from .client import oauth2_get, oauth2_post
-from .request_utils import __user_details__
+from .request_utils import __user_details__, __request_error__
groups = Blueprint("group", __name__)
+@groups.route("/", methods=["GET"])
+def user_group():
+ def __success__(group):
+ return render_template("oauth2/group.html", group=group)
+
+ return oauth2_get("oauth2/user-group").either(
+ __request_error__, __success__)
+
@groups.route("/create", methods=["POST"])
@require_oauth2
def create_group():
diff --git a/wqflask/wqflask/oauth2/users.py b/wqflask/wqflask/oauth2/users.py
index 4db60434..bd958049 100644
--- a/wqflask/wqflask/oauth2/users.py
+++ b/wqflask/wqflask/oauth2/users.py
@@ -21,11 +21,3 @@ def user_profile():
@require_oauth2
def request_add_to_group():
return "WOULD SEND MESSAGE TO HAVE YOU ADDED TO GROUP..."
-
-@users.route("/group", methods=["GET"])
-def user_group():
- def __success__(group):
- return render_template("oauth2/group.html", group=group)
-
- return oauth2_get("oauth2/user-group").either(
- __request_error__, __success__)
diff --git a/wqflask/wqflask/templates/oauth2/group.html b/wqflask/wqflask/templates/oauth2/group.html
new file mode 100644
index 00000000..df69a573
--- /dev/null
+++ b/wqflask/wqflask/templates/oauth2/group.html
@@ -0,0 +1,27 @@
+{%extends "base.html"%}
+{%from "oauth2/profile_nav.html" import profile_nav%}
+{%block title%}View User{%endblock%}
+{%block content%}
+<div class="container" style="min-width: 1250px;">
+ {{profile_nav("dashboard")}}
+ <h3>User's Group</h3>
+
+ {{flash_me()}}
+
+ <div class="container-fluid">
+ <div class="row">
+ <dl>
+
+ <dt>Name</dt> <dd>{{group.group_name}}</dd>
+
+ {%for key,value in group.group_metadata.items()%}
+ <dt>{{key.split("_") | map('capitalize') | join(" ")}}</dt>
+ <dd>{{value}}</dd>
+ {%endfor%}
+ </dl>
+ </div>
+
+ </div>
+
+</div>
+{%endblock%}
diff --git a/wqflask/wqflask/templates/oauth2/profile_nav.html b/wqflask/wqflask/templates/oauth2/profile_nav.html
index 1baf4924..5c69a17d 100644
--- a/wqflask/wqflask/templates/oauth2/profile_nav.html
+++ b/wqflask/wqflask/templates/oauth2/profile_nav.html
@@ -13,7 +13,7 @@
{%if calling_page == "group"%}
class="active"
{%endif%}>
- <a href="{{url_for('oauth2.user.user_group')}}">Group</a>
+ <a href="{{url_for('oauth2.group.user_group')}}">Group</a>
</li>
<li role="presentation"