From ee18daa8fa38eef8ba61ca557bb90ae944ccb5e2 Mon Sep 17 00:00:00 2001
From: Devyani Kota <divs.passion.18@gmail.com>
Date: Nov 04 2015 13:10:06 +0000
Subject: [PATCH 1/5] Fixed issue #53: Added clickable links for subscribed hubs


---

diff --git a/hubs/widgets/subscriptions.py b/hubs/widgets/subscriptions.py
index 4b0df3a..36e830d 100644
--- a/hubs/widgets/subscriptions.py
+++ b/hubs/widgets/subscriptions.py
@@ -18,7 +18,11 @@ template = jinja2.Template("""
     {% endif %}
     <hr/>
     {% if subscriptions %}
-        <p><strong>Subscribes to:</strong> {{subscriptions_text}}</p>
+        <p><strong>Subscribes to:</strong>
+        {% for subscription in subscriptions %}
+        <a href="{{ url_for('hub', name=subscription)}}">
+        {{subscription}}</a>
+        {% endfor %}</p>
     {% endif %}
 {% endif %}
 """)

From 2b6acc854a6a0bfe3ae298b2476df86162fe8bb3 Mon Sep 17 00:00:00 2001
From: Devyani Kota <divs.passion.18@gmail.com>
Date: Nov 05 2015 19:23:11 +0000
Subject: [PATCH 2/5] Added manage_subscriptions() to hyperlink subscriptions and memberships


---

diff --git a/hubs/widgets/subscriptions.py b/hubs/widgets/subscriptions.py
index 36e830d..d32e47b 100644
--- a/hubs/widgets/subscriptions.py
+++ b/hubs/widgets/subscriptions.py
@@ -8,21 +8,20 @@ import hubs.models
 
 from fedmsg.meta.base import BaseConglomerator as BC
 
+import flask
 import jinja2
 
 chrome = panel('Hubs', key='associations')
 template = jinja2.Template("""
 {% if associations %}
     {% if memberships %}
-        <p><strong>Belongs to: </strong>{{memberships_text}}</p>
+        <p><strong>Belongs to: </strong>
+        {{memberships_text}}</p>
     {% endif %}
     <hr/>
     {% if subscriptions %}
         <p><strong>Subscribes to:</strong>
-        {% for subscription in subscriptions %}
-        <a href="{{ url_for('hub', name=subscription)}}">
-        {{subscription}}</a>
-        {% endfor %}</p>
+        {{subscriptions_text}}</p>
     {% endif %}
 {% endif %}
 """)
@@ -37,16 +36,29 @@ def data(session, widget, username):
     ownerships = [u.name for u in user.ownerships]
     memberships = [u.name for u in user.memberships]
     subscriptions = [u.name for u in user.subscriptions]
+    subs = subscriptions
+    mems = memberships
+    subscriptions_list = manage_subscriptions(subs)
+    memberships_list = manage_subscriptions(mems)
     return dict(
         associations=memberships + ownerships,
         ownerships=ownerships,
         memberships=memberships,
         subscriptions=subscriptions,
         ownerships_text=BC.list_to_series(ownerships),
-        memberships_text=BC.list_to_series(memberships),
-        subscriptions_text=BC.list_to_series(subscriptions),
+        memberships_text=BC.list_to_series(memberships_list),
+        subscriptions_text=BC.list_to_series(subscriptions_list),
     )
 
 
+# function hyperlinks
+def manage_subscriptions(s):
+    for j, i in enumerate(s[0:3]):
+        link = '<a href="{link}">{item}</a>'.format(link=flask.url_for(
+            'hub', name=i), item=i)
+        s[j] = link
+    return s
+
+
 def should_invalidate(message, session, widget):
     raise NotImplementedError()

From 6811d345beaea95c65b010186cc5288220ae198a Mon Sep 17 00:00:00 2001
From: Devyani Kota <divs.passion.18@gmail.com>
Date: Nov 05 2015 19:55:17 +0000
Subject: [PATCH 3/5] Edited comments


---

diff --git a/hubs/widgets/subscriptions.py b/hubs/widgets/subscriptions.py
index d32e47b..25c670b 100644
--- a/hubs/widgets/subscriptions.py
+++ b/hubs/widgets/subscriptions.py
@@ -1,4 +1,4 @@
-#from hubs.hinting import hint, prefixed as _
+# from hubs.hinting import hint, prefixed as _
 from hubs.widgets.base import argument
 from hubs.widgets.chrome import panel
 
@@ -51,7 +51,7 @@ def data(session, widget, username):
     )
 
 
-# function hyperlinks
+# function hyperlinks the hubs in the subscription widget
 def manage_subscriptions(s):
     for j, i in enumerate(s[0:3]):
         link = '<a href="{link}">{item}</a>'.format(link=flask.url_for(

From f36cd76b3c8c8b019df373ed432285c027dfa674 Mon Sep 17 00:00:00 2001
From: Devyani Kota <divs.passion.18@gmail.com>
Date: Nov 06 2015 20:46:30 +0000
Subject: [PATCH 4/5] Added generator to avoid changes in json data


---

diff --git a/hubs/widgets/subscriptions.py b/hubs/widgets/subscriptions.py
index 25c670b..aa9d394 100644
--- a/hubs/widgets/subscriptions.py
+++ b/hubs/widgets/subscriptions.py
@@ -15,13 +15,11 @@ chrome = panel('Hubs', key='associations')
 template = jinja2.Template("""
 {% if associations %}
     {% if memberships %}
-        <p><strong>Belongs to: </strong>
-        {{memberships_text}}</p>
+        <p><strong>Belongs to: </strong>{{memberships_text}}</p>
     {% endif %}
     <hr/>
     {% if subscriptions %}
-        <p><strong>Subscribes to:</strong>
-        {{subscriptions_text}}</p>
+        <p><strong>Subscribes to:</strong>{{subscriptions_text}}</p>
     {% endif %}
 {% endif %}
 """)
@@ -36,10 +34,8 @@ def data(session, widget, username):
     ownerships = [u.name for u in user.ownerships]
     memberships = [u.name for u in user.memberships]
     subscriptions = [u.name for u in user.subscriptions]
-    subs = subscriptions
-    mems = memberships
-    subscriptions_list = manage_subscriptions(subs)
-    memberships_list = manage_subscriptions(mems)
+    subscriptions_list = manage_subscriptions(subscriptions)
+    memberships_list = manage_subscriptions(memberships)
     return dict(
         associations=memberships + ownerships,
         ownerships=ownerships,
@@ -52,12 +48,11 @@ def data(session, widget, username):
 
 
 # function hyperlinks the hubs in the subscription widget
-def manage_subscriptions(s):
-    for j, i in enumerate(s[0:3]):
+def manage_subscriptions(items):
+    for index, item in enumerate(items[0:3]):
         link = '<a href="{link}">{item}</a>'.format(link=flask.url_for(
-            'hub', name=i), item=i)
-        s[j] = link
-    return s
+            'hub', name=item), item=item)
+        yield link
 
 
 def should_invalidate(message, session, widget):

From 46e0cbf917a3f9641dcd00fbce613a4902acba1f Mon Sep 17 00:00:00 2001
From: Devyani Kota <divs.passion.18@gmail.com>
Date: Nov 06 2015 21:02:44 +0000
Subject: [PATCH 5/5] Edited typo


---

diff --git a/hubs/widgets/subscriptions.py b/hubs/widgets/subscriptions.py
index aa9d394..f5e51f1 100644
--- a/hubs/widgets/subscriptions.py
+++ b/hubs/widgets/subscriptions.py
@@ -15,11 +15,11 @@ chrome = panel('Hubs', key='associations')
 template = jinja2.Template("""
 {% if associations %}
     {% if memberships %}
-        <p><strong>Belongs to: </strong>{{memberships_text}}</p>
+        <p><strong>Belongs to: </strong> {{memberships_text}}</p>
     {% endif %}
     <hr/>
     {% if subscriptions %}
-        <p><strong>Subscribes to:</strong>{{subscriptions_text}}</p>
+        <p><strong>Subscribes to:</strong> {{subscriptions_text}}</p>
     {% endif %}
 {% endif %}
 """)

