From d469e9bf18860b842e2ed2f98ac69046ba776299 Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 07 2016 07:42:44 +0000 Subject: [PATCH 1/9] Adding the Contact info widget as requested in Issue #162 --- diff --git a/hubs/defaults.py b/hubs/defaults.py index 706bb03..49beaa8 100755 --- a/hubs/defaults.py +++ b/hubs/defaults.py @@ -17,13 +17,20 @@ def add_user_widgets(session, hub, username, fullname): # Right Side Widgets widget = hubs.models.Widget( - plugin='meetings', index=-1, + plugin='meetings', index=-2, _config=json.dumps({ 'calendar': 'Fedora release', })) hub.widgets.append(widget) widget = hubs.models.Widget( + plugin='fas_info', index=-1, + _config=json.dumps({ + 'username': username, + })) + hub.widgets.append(widget) + + widget = hubs.models.Widget( plugin='fedmsgstats', index=0, _config=json.dumps({ 'username': username, diff --git a/hubs/widgets/__init__.py b/hubs/widgets/__init__.py index 6423e3e..294dec5 100755 --- a/hubs/widgets/__init__.py +++ b/hubs/widgets/__init__.py @@ -17,6 +17,7 @@ from hubs.widgets import githubissues from hubs.widgets import bugzilla from hubs.widgets import fhosted from hubs.widgets import memberships +from hubs.widgets import fas_info from hubs.widgets.workflow import pendingacls from hubs.widgets.workflow import updates2stable @@ -43,6 +44,7 @@ registry = { 'bugzilla': bugzilla, 'fedorahosted': fhosted, 'memberships': memberships, + 'fas_info': fas_info, 'workflow.pendingacls': pendingacls, 'workflow.updates2stable': updates2stable, diff --git a/hubs/widgets/fas_info.py b/hubs/widgets/fas_info.py new file mode 100644 index 0000000..2354aa6 --- /dev/null +++ b/hubs/widgets/fas_info.py @@ -0,0 +1,25 @@ +from hubs.widgets.chrome import panel +from hubs.widgets import templating + +import fedmsg.config +import fedmsg.meta + +config = fedmsg.config.load_config() + +chrome = panel() +template = templating.environment.get_template('templates/fas_info.html') +position = 'both' + + +# TODO: update this section when FAS3 is deployed +def data(session, widget, username): + email = username + '@fedoraproject.org' + fas_info = { + 'username': username, + 'location': 'United States', + 'timezone': '20.15 (UTC -4)', + 'email': email, + 'ircnick': 'nickname', + 'account_age': 'Oct 2010', + } + return fas_info diff --git a/hubs/widgets/templates/fas_info.html b/hubs/widgets/templates/fas_info.html new file mode 100644 index 0000000..9c7ec62 --- /dev/null +++ b/hubs/widgets/templates/fas_info.html @@ -0,0 +1,15 @@ +
+ +
+ Member Since {{account_age}}
+
+ From 7835d42ba81562a091d3b2637f13976adb6745a6 Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 07 2016 07:42:44 +0000 Subject: [PATCH 2/9] Adding fas info for Contact Info widget for Issue #162 --- diff --git a/hubs/defaults.py b/hubs/defaults.py index 49beaa8..2372776 100755 --- a/hubs/defaults.py +++ b/hubs/defaults.py @@ -17,16 +17,16 @@ def add_user_widgets(session, hub, username, fullname): # Right Side Widgets widget = hubs.models.Widget( - plugin='meetings', index=-2, + plugin='fas_info', index=-2, _config=json.dumps({ - 'calendar': 'Fedora release', + 'username': username, })) hub.widgets.append(widget) widget = hubs.models.Widget( - plugin='fas_info', index=-1, + plugin='meetings', index=-1, _config=json.dumps({ - 'username': username, + 'calendar': 'Fedora release', })) hub.widgets.append(widget) diff --git a/hubs/widgets/fas_info.py b/hubs/widgets/fas_info.py index 2354aa6..fa8de09 100644 --- a/hubs/widgets/fas_info.py +++ b/hubs/widgets/fas_info.py @@ -15,11 +15,10 @@ position = 'both' def data(session, widget, username): email = username + '@fedoraproject.org' fas_info = { - 'username': username, 'location': 'United States', 'timezone': '20.15 (UTC -4)', 'email': email, - 'ircnick': 'nickname', + 'ircnick': username, 'account_age': 'Oct 2010', } return fas_info From 5c820505389d09faf31d39fd21ff650d5a697322 Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 07 2016 07:42:44 +0000 Subject: [PATCH 3/9] Updated font-awesome icons and added background colour --- diff --git a/hubs/widgets/templates/fas_info.html b/hubs/widgets/templates/fas_info.html index 9c7ec62..8522f74 100644 --- a/hubs/widgets/templates/fas_info.html +++ b/hubs/widgets/templates/fas_info.html @@ -1,15 +1,22 @@ -
-
    -
  • +
    +
      +
    • {{location}}
    • -
    • +
    • Current-Time :{{timezone}}
    • -
    • +
    • {{email}}
    • -
    • +
    • {{ircnick}}
    - Member Since {{account_age}}
    + + Member Since {{account_age}}
+ + From 04f7ef35c1bb7b470e0caf3e46d07dc9d0956c03 Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 07 2016 07:42:44 +0000 Subject: [PATCH 4/9] Adding contact info for group hubs --- diff --git a/hubs/widgets/fas_info.py b/hubs/widgets/fas_info.py index fa8de09..84e212c 100644 --- a/hubs/widgets/fas_info.py +++ b/hubs/widgets/fas_info.py @@ -1,6 +1,7 @@ from hubs.widgets.chrome import panel from hubs.widgets import templating +import hubs.models import fedmsg.config import fedmsg.meta @@ -12,13 +13,47 @@ position = 'both' # TODO: update this section when FAS3 is deployed -def data(session, widget, username): - email = username + '@fedoraproject.org' - fas_info = { - 'location': 'United States', - 'timezone': '20.15 (UTC -4)', - 'email': email, - 'ircnick': username, - 'account_age': 'Oct 2010', - } +def data(session, widget, **kwargs): + hub = widget.hub + if hub.user_hub: + usergroup = 1 + user = hubs.models.User.by_username(session, hub.name) + email = user.username + '@fedoraproject.org' + fas_info = { + 'usergroup': usergroup, + 'location': 'United States', + 'timezone': '20.15 (UTC -4)', + 'email': email, + 'ircnick': user.username, + 'account_age': 'Oct 2010', + } + else: + usergroup = 0 + ghub = hubs.models.Hub.by_name(session, hub.name) + # TODO: update this section integrating with FAS3 + if(hub.name == 'infrastructure'): + ircchannel = 'apps' + hubname = 'infrastructure' + elif(ghub.name == 'designteam'): + ircchannel = 'design' + hubname = 'design' + elif(ghub.name == 'commops'): + ircchannel == 'commops' + hubname = 'commops' + elif(ghub.name == 'marketing'): + ircchannel = 'mktg' + hubname = 'marketing' + else: + ircchannel = hub.name + hubname = hub.name + mailinglist = 'https://lists.fedoraproject.org/archives/list/{}@lists.fedoraproject.org/'.format(hubname) + wikilink = 'https://fedoraproject.org/wiki/' + hubname + fas_info = { + 'usergroup': usergroup, + 'hubname': hubname, + 'ircchannel': 'fedora-%s'%ircchannel, + 'mailinglist': mailinglist, + 'wikilink': wikilink, + } + print ircchannel return fas_info diff --git a/hubs/widgets/templates/fas_info.html b/hubs/widgets/templates/fas_info.html index 8522f74..2825451 100644 --- a/hubs/widgets/templates/fas_info.html +++ b/hubs/widgets/templates/fas_info.html @@ -1,18 +1,29 @@
-
    -
  • - {{location}}
  • -
  • - Current-Time :{{timezone}}
  • -
  • - {{email}}
  • -
  • - {{ircnick}}
  • -
-
- - Member Since {{account_age}} -
+ {% if usergroup == 1 %} +
    +
  • + {{location}}
  • +
  • + Current-Time :{{timezone}}
  • +
  • + {{email}}
  • +
  • + {{ircnick}}
  • +
+
+ + Member Since {{account_age}} +
+ {% else %} + + {% endif %}
From cb8c25da67c5e3ccf272ef5d2bbccc31243ca6e8 Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 07 2016 07:42:44 +0000 Subject: [PATCH 6/9] Updating timezone in realtime. --- diff --git a/hubs/widgets/fas_info.py b/hubs/widgets/fas_info.py index ffd4d1a..388e0b7 100644 --- a/hubs/widgets/fas_info.py +++ b/hubs/widgets/fas_info.py @@ -4,6 +4,7 @@ from hubs.widgets import templating import hubs.models import fedmsg.config import fedmsg.meta +import datetime config = fedmsg.config.load_config() @@ -22,7 +23,7 @@ def data(session, widget, **kwargs): fas_info = { 'usergroup': usergroup, 'location': 'United States', - 'timezone': '20:15 (UTC-4)', + 'timezone': datetime.datetime.utcnow().isoformat(), 'email': email, 'ircnick': user.username, 'account_age': 'Oct 2010', diff --git a/hubs/widgets/templates/fas_info.html b/hubs/widgets/templates/fas_info.html index 8bb48e3..375ce0b 100644 --- a/hubs/widgets/templates/fas_info.html +++ b/hubs/widgets/templates/fas_info.html @@ -1,10 +1,21 @@ -
+
+ {% if usergroup == 1 %}
  • {{location}}
  • - Current-Time :{{timezone}}
  • + Current-Time : + +
  • {{email}}
  • From a2554f1c08a1ff55cbc2688963bb958299253bab Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 08 2016 19:27:19 +0000 Subject: [PATCH 7/9] Removing fas_info files --- diff --git a/hubs/widgets/fas_info.py b/hubs/widgets/fas_info.py deleted file mode 100644 index 388e0b7..0000000 --- a/hubs/widgets/fas_info.py +++ /dev/null @@ -1,59 +0,0 @@ -from hubs.widgets.chrome import panel -from hubs.widgets import templating - -import hubs.models -import fedmsg.config -import fedmsg.meta -import datetime - -config = fedmsg.config.load_config() - -chrome = panel() -template = templating.environment.get_template('templates/fas_info.html') -position = 'both' - - -# TODO: update this section when FAS3 is deployed -def data(session, widget, **kwargs): - hub = widget.hub - if hub.user_hub: - usergroup = 1 - user = hubs.models.User.by_username(session, hub.name) - email = user.username + '@fedoraproject.org' - fas_info = { - 'usergroup': usergroup, - 'location': 'United States', - 'timezone': datetime.datetime.utcnow().isoformat(), - 'email': email, - 'ircnick': user.username, - 'account_age': 'Oct 2010', - } - else: - usergroup = 0 - ghub = hubs.models.Hub.by_name(session, hub.name) - # TODO: update this section integrating with FAS3 - if(hub.name == 'infrastructure'): - ircchannel = 'apps' - hubname = 'infrastructure' - elif(ghub.name == 'designteam'): - ircchannel = 'design' - hubname = 'design' - elif(ghub.name == 'commops'): - ircchannel == 'commops' - hubname = 'commops' - elif(ghub.name == 'marketing'): - ircchannel = 'mktg' - hubname = 'marketing' - else: - ircchannel = hub.name - hubname = hub.name - mailinglist = 'https://lists.fedoraproject.org/archives/list/{}@lists.fedoraproject.org/'.format(hubname) - wikilink = 'https://fedoraproject.org/wiki/' + hubname - fas_info = { - 'usergroup': usergroup, - 'hubname': hubname, - 'ircchannel': 'fedora-%s'%ircchannel, - 'mailinglist': mailinglist, - 'wikilink': wikilink, - } - return fas_info diff --git a/hubs/widgets/templates/fas_info.html b/hubs/widgets/templates/fas_info.html deleted file mode 100644 index 375ce0b..0000000 --- a/hubs/widgets/templates/fas_info.html +++ /dev/null @@ -1,38 +0,0 @@ -
    - - {% if usergroup == 1 %} -
      -
    • - {{location}}
    • -
    • - Current-Time : - -
    • -
    • - {{email}}
    • -
    • - {{ircnick}}
    • -
    -
    - - Member Since {{account_age}} -
    - {% else %} - - {% endif %} -
    From 19e44b62bf2ae03d7d1f387cf4df612a503600e4 Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 08 2016 19:29:19 +0000 Subject: [PATCH 8/9] Adding Contact widget after renaming --- diff --git a/hubs/defaults.py b/hubs/defaults.py index 2372776..6216b54 100755 --- a/hubs/defaults.py +++ b/hubs/defaults.py @@ -17,7 +17,7 @@ def add_user_widgets(session, hub, username, fullname): # Right Side Widgets widget = hubs.models.Widget( - plugin='fas_info', index=-2, + plugin='contact', index=-2, _config=json.dumps({ 'username': username, })) diff --git a/hubs/widgets/__init__.py b/hubs/widgets/__init__.py index 294dec5..5f416ed 100755 --- a/hubs/widgets/__init__.py +++ b/hubs/widgets/__init__.py @@ -17,7 +17,7 @@ from hubs.widgets import githubissues from hubs.widgets import bugzilla from hubs.widgets import fhosted from hubs.widgets import memberships -from hubs.widgets import fas_info +from hubs.widgets import contact from hubs.widgets.workflow import pendingacls from hubs.widgets.workflow import updates2stable @@ -44,7 +44,7 @@ registry = { 'bugzilla': bugzilla, 'fedorahosted': fhosted, 'memberships': memberships, - 'fas_info': fas_info, + 'contact': contact, 'workflow.pendingacls': pendingacls, 'workflow.updates2stable': updates2stable, diff --git a/hubs/widgets/contact.py b/hubs/widgets/contact.py new file mode 100644 index 0000000..b1f4df8 --- /dev/null +++ b/hubs/widgets/contact.py @@ -0,0 +1,58 @@ +from hubs.widgets.chrome import panel +from hubs.widgets import templating + +import hubs.models +import fedmsg.config +import fedmsg.meta +import datetime + +config = fedmsg.config.load_config() + +chrome = panel() +template = templating.environment.get_template('templates/contact.html') +position = 'both' + + +# TODO: update this section when FAS3 is deployed +def data(session, widget, **kwargs): + hub = widget.hub + if hub.user_hub: + usergroup = True + user = hubs.models.User.by_username(session, hub.name) + email = user.username + '@fedoraproject.org' + fas_info = { + 'usergroup': usergroup, + 'location': 'United States', + 'timezone': 'UTC', + 'email': email, + 'ircnick': user.username, + 'account_age': 'Oct 2010', + } + else: + usergroup = False + # TODO: update this section integrating with FAS3 + if hub.name == 'infrastructure': + ircchannel = 'apps' + hubname = 'infrastructure' + elif hub.name == 'designteam': + ircchannel = 'design' + hubname = 'design' + elif hub.name == 'commops': + ircchannel == 'commops' + hubname = 'commops' + elif hub.name == 'marketing': + ircchannel = 'mktg' + hubname = 'marketing' + else: + ircchannel = hub.name + hubname = hub.name + mailinglist = 'https://lists.fedoraproject.org/archives/list/{}@lists.fedoraproject.org/'.format(hubname) + wikilink = 'https://fedoraproject.org/wiki/' + hubname + fas_info = { + 'usergroup': usergroup, + 'hubname': hubname, + 'ircchannel': 'fedora-%s'%ircchannel, + 'mailinglist': mailinglist, + 'wikilink': wikilink, + } + return fas_info diff --git a/hubs/widgets/templates/contact.html b/hubs/widgets/templates/contact.html new file mode 100644 index 0000000..eec28c2 --- /dev/null +++ b/hubs/widgets/templates/contact.html @@ -0,0 +1,51 @@ +
    + {% if usergroup %} +
      +
    • + {{location}}
    • +
    • + Current-Time : + +
    • +
    • + {{email}}
    • +
    • + {{ircnick}}
    • +
    +
    + + Member Since {{account_age}} +
    + {% else %} + + {% endif %} +
    From 1b75c8aabb61843ebf06327de9622a16838b6f1c Mon Sep 17 00:00:00 2001 From: Devyani Kota Date: Aug 08 2016 20:16:53 +0000 Subject: [PATCH 9/9] Adding contact widget for group pages --- diff --git a/populate.py b/populate.py index 4db1eb1..5c34700 100755 --- a/populate.py +++ b/populate.py @@ -26,7 +26,7 @@ hub = hubs.models.Hub( name='i18n', summary='The Internationalization Team', archived=True) session.add(hub) -widget = hubs.models.Widget(plugin='fas_info', index=-1) +widget = hubs.models.Widget(plugin='contact', index=-1) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='stats', index=0) hub.widgets.append(widget) @@ -71,7 +71,7 @@ session.commit() hub = hubs.models.Hub(name='commops', summary='The Fedora Community Operations Team') session.add(hub) -widget = hubs.models.Widget(plugin='fas_info', index=-1) +widget = hubs.models.Widget(plugin='contact', index=-1) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='stats', index=0) hub.widgets.append(widget) @@ -118,7 +118,7 @@ session.commit() hub = hubs.models.Hub(name='marketing', summary='The Fedora Marketing Team') session.add(hub) -widget = hubs.models.Widget(plugin='fas_info', index=-1) +widget = hubs.models.Widget(plugin='contact', index=-1) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='stats', index=0) hub.widgets.append(widget) @@ -166,7 +166,7 @@ session.commit() hub = hubs.models.Hub(name='designteam', summary='The Fedora Design Team') session.add(hub) -widget = hubs.models.Widget(plugin='fas_info', index=-1) +widget = hubs.models.Widget(plugin='contact', index=-1) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='stats', index=0) hub.widgets.append(widget) @@ -215,7 +215,7 @@ session.commit() hub = hubs.models.Hub(name='infrastructure', summary='The Fedora Infra Team') session.add(hub) -widget = hubs.models.Widget(plugin='fas_info', index=-1) +widget = hubs.models.Widget(plugin='contact', index=-1) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='stats', index=0) hub.widgets.append(widget)