Merge lp:~nigelbabu/summit/javascript-last-update into lp:summit

Proposed by Nigel Babu
Status: Merged
Approved by: Michael Hall
Approved revision: 213
Merged at revision: 213
Proposed branch: lp:~nigelbabu/summit/javascript-last-update
Merge into: lp:summit
Diff against target: 48 lines (+15/-2)
3 files modified
summit/media/css/schedule.css (+1/-1)
summit/schedule/render.py (+4/-1)
summit/schedule/templates/schedule/schedule.html (+10/-0)
To merge this branch: bzr merge lp:~nigelbabu/summit/javascript-last-update
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+80929@code.launchpad.net

Commit message

Add javascript-y "Updated x seconds ago" counter

Description of the change

This branch creates a javascript counter that counts from dislays "Updated x seconds ago", where x is updated every second. I've put this in render.py so that is renders correctly in the right-most of the schedule right above the last room name.

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote :

Looks good, IS needs to make sure ?reload is in the URL

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/media/css/schedule.css'
2--- summit/media/css/schedule.css 2011-09-03 02:16:40 +0000
3+++ summit/media/css/schedule.css 2011-11-01 17:07:25 +0000
4@@ -89,7 +89,7 @@
5 margin-left: 5px;
6 }
7
8-div.schedule-head .schedule-crew {
9+div.schedule-head .schedule-crew, .last-updated {
10 font-size: 0.7pc;
11 }
12
13
14=== modified file 'summit/schedule/render.py'
15--- summit/schedule/render.py 2011-10-30 00:16:31 +0000
16+++ summit/schedule/render.py 2011-11-01 17:07:25 +0000
17@@ -395,7 +395,10 @@
18 return mark_safe("<pre>%s</pre>" % escape(traceback.format_exc()))
19
20 def as_html(self):
21- html = u''
22+ html = (u'<span class="last-updated" style="float: right;">Updated '
23+ '<span id="refresh-time">0</span> seconds ago</span>'
24+ '<div style="clear: both;"></div>')
25+
26
27 if self.endofday:
28 html += '<p><strong>No more sessions for today.</strong></p>'
29
30=== modified file 'summit/schedule/templates/schedule/schedule.html'
31--- summit/schedule/templates/schedule/schedule.html 2011-09-15 23:23:51 +0000
32+++ summit/schedule/templates/schedule/schedule.html 2011-11-01 17:07:25 +0000
33@@ -91,6 +91,16 @@
34 window.onload = timedRefresh;
35 </script>
36 {% endif %}
37+<script type="text/javascript">
38+function updateTimer() {
39+ var secAgo = document.getElementById('refresh-time');
40+ secAgo.innerHTML = Number(secAgo.innerHTML) + 1;
41+}
42+function starttimer() {
43+ setInterval(updateTimer, 1000);
44+}
45+window.addEventListener('load', starttimer());
46+</script>
47 {% endblock %}
48 {% block 960css %}{% endblock %}
49

Subscribers

People subscribed via source and target branches