Permalink
Browse files

Add Get Satisfaction and give up on vertical alignment of the header …

…for now.
  • Loading branch information...
1 parent e7415e8 commit 5fe34bc4a012353f6e1c04cae943bccb5d95c648 @hammer committed Aug 9, 2010
Showing with 48 additions and 13 deletions.
  1. +27 −4 dashboard.py
  2. +1 −3 static/css/dashboard.css
  3. +1 −0 templates/gs_topic.html
  4. +19 −6 templates/index.html
View
31 dashboard.py
@@ -11,6 +11,7 @@
import bitly_api
from pyslideshare import pyslideshare
import twython.core as twython
+import satisfaction
# Modules needed for hand-crafted Zendesk client
from tornado import httpclient
@@ -84,6 +85,13 @@
except:
JIRA_EXISTS = False
+GS_COMPANY = config.get('Get Satisfaction', 'company')
+try:
+ GS_CONN = satisfaction.Company('cloudera')
+ GS_EXISTS = True
+except:
+ GS_EXISTS = False
+
# TODO(hammer): Move to async HTTP client
# TODO(hammer): Add API call to HTTP client to ignore bad certs
# TODO(hammer): Make Zendesk Python client
@@ -119,6 +127,12 @@ def get_zendesk_data():
# only returning top 20, for now
return all_entries[:20]
+def get_url_from_gs_topic(topic):
+ links = topic.entry.links
+ for link in links:
+ if link['rel'] == u'topic_at_sfn':
+ return link['href']
+
class Application(tornado.web.Application):
def __init__(self):
handlers = [
@@ -179,18 +193,27 @@ def get(self):
else:
jira_data = []
+ # Get Satisfaction
+ if GS_EXISTS:
+ gs_data = [{'title': topic.title, 'url': get_url_from_gs_topic(topic)}
+ for i, topic in enumerate(GS_CONN.topics)
+ if i < 10]
+ else:
+ gs_data = []
+
self.render("index.html",
ga_data=ga_data,
bitly_data=bitly_data,
ss_data=ss_data,
twitter_data=twitter_data,
zd_data=zd_data,
- jira_data=jira_data)
+ jira_data=jira_data,
+ gs_data=gs_data)
def main():
- http_server = tornado.httpserver.HTTPServer(Application())
- http_server.listen(8888)
- tornado.ioloop.IOLoop.instance().start()
+ http_server = tornado.httpserver.HTTPServer(Application())
+ http_server.listen(8888)
+ tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()
View
4 static/css/dashboard.css
@@ -1,17 +1,15 @@
#header {
margin-top:10px;
margin-bottom:10px;
- position:relative;
}
#header-logo {
float:left;
+ margin-right:10px;
}
#header-text {
color:#999999;
- position:absolute;
- bottom:0;
}
.dashboard-widget {
View
1 templates/gs_topic.html
@@ -0,0 +1 @@
+<div class="gs_topic" id="{{ topic['title'] }}"><a href="{{ escape(topic['url']) }}">{{ escape(topic['title']) }}</a></div>
View
25 templates/index.html
@@ -16,12 +16,8 @@
<!-- Header -->
<div class="span-24 last" id="header">
- <div class="span-6">
- <img id="header-logo" src="{{ static_url("img/logo.gif") }}" />
- </div>
- <div class="span-18 last">
- <h3 id="header-text">Dogfood Dashboard</h3>
- </div>
+ <img id="header-logo" src="{{ static_url("img/logo.gif") }}" />
+ <h3 id="header-text">Dogfood Dashboard</h3>
</div>
<hr />
@@ -163,5 +159,22 @@ <h3 id="header-text">Dogfood Dashboard</h3>
{% end %}
</div>
</div>
+
+ <!-- Row 3 -->
+ <!-- Get Satisfaction -->
+ <div class="span-8">
+ <div class="dashboard-widget" id="gs">
+ <h3>Recently Updated Get Satisfaction Topics</h3>
+ {% for topic in gs_data %}
+ {% include "gs_topic.html" %}
+ {% end %}
+ </div>
+ </div>
+
+ <!-- empty -->
+ <div class="span-16 last">
+ <div class="dashboard-widget">
+ </div>
+ </div>
</div>
</body>

0 comments on commit 5fe34bc

Please sign in to comment.