Merge lp:~daker/summit/fix.summit-colors into lp:summit

Proposed by Adnane Belmadiaf
Status: Merged
Approved by: Chris Johnston
Approved revision: 477
Merged at revision: 478
Proposed branch: lp:~daker/summit/fix.summit-colors
Merge into: lp:summit
Diff against target: 253 lines (+50/-32)
5 files modified
summit/common/utils.py (+11/-2)
summit/media/css/schedule.css (+4/-5)
summit/schedule/context_processors.py (+0/-1)
summit/schedule/models/trackmodel.py (+13/-0)
summit/schedule/render.py (+22/-24)
To merge this branch: bzr merge lp:~daker/summit/fix.summit-colors
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Review via email: mp+138597@code.launchpad.net

Commit message

* Added friendly colors for the track block
* Css fixes
* Removed the empty context_processors file

Description of the change

To post a comment you must log in.
Revision history for this message
Chris Johnston (cjohnston) :
review: Approve
Revision history for this message
Tarmac WebDev (tarmac-webdev) wrote :

Attempt to merge into lp:summit failed due to conflicts:

text conflict in summit/common/utils.py

lp:~daker/summit/fix.summit-colors updated
477. By Adnane Belmadiaf

- Merged trunk
- Fixed text conflicts
- Removed unused imports

Revision history for this message
Chris Johnston (cjohnston) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/common/utils.py'
2--- summit/common/utils.py 2012-12-15 02:06:56 +0000
3+++ summit/common/utils.py 2013-01-19 22:31:20 +0000
4@@ -1,5 +1,14 @@
5-import email
6-import os
7+# -*- coding: utf-8 -*-
8+
9+
10+def hex_to_rgba(value):
11+ """
12+ return the rgba version of a hex color
13+ """
14+ value = value.lstrip('#')
15+ lv = len(value)
16+ return tuple(int(value[i:i + lv / 3], 16) for i in range(0, lv, lv / 3)) + (0.5,)
17+
18
19 def redirect(to, *args, **kwargs):
20 from distutils.version import LooseVersion as V
21
22=== modified file 'summit/media/css/schedule.css'
23--- summit/media/css/schedule.css 2012-10-24 19:40:50 +0000
24+++ summit/media/css/schedule.css 2013-01-19 22:31:20 +0000
25@@ -112,7 +112,7 @@
26 border-top: 1px solid #e0e0e0;
27 font-size: 11px;
28 color: #606060;
29-
30+
31 line-height: 1em;
32 }
33
34@@ -171,11 +171,10 @@
35
36 /* Meeting block formatting */
37 div.meeting {
38- border: 1px solid black;
39- -moz-border-radius: 6px;
40-
41+ -moz-border-radius: 3px;
42+ -webkit-border-radius: 3px;
43+ border-radius: 3px;
44 font-size: 15px;
45-
46 z-index: 5;
47 }
48
49
50=== removed file 'summit/schedule/context_processors.py'
51--- summit/schedule/context_processors.py 2011-11-26 21:34:36 +0000
52+++ summit/schedule/context_processors.py 1970-01-01 00:00:00 +0000
53@@ -1,1 +0,0 @@
54-
55
56=== modified file 'summit/schedule/models/trackmodel.py'
57--- summit/schedule/models/trackmodel.py 2012-01-23 01:18:55 +0000
58+++ summit/schedule/models/trackmodel.py 2013-01-19 22:31:20 +0000
59@@ -17,6 +17,7 @@
60 from django.db import models
61
62 from summit.schedule.models.summitmodel import Summit
63+from summit.common.utils import hex_to_rgba
64
65 __all__ = (
66 'Track',
67@@ -37,3 +38,15 @@
68
69 def __unicode__(self):
70 return "%s (%s)" % (self.title, self.summit.name)
71+
72+ def get_color(self):
73+ if self.color:
74+ return "#%s" % self.color
75+ else:
76+ return "#ffffff"
77+
78+ def get_bordercolor(self):
79+ return "1px solid %s" % self.get_color()
80+
81+ def get_bgcolor(self):
82+ return "rgba%s" % str(hex_to_rgba(self.get_color()))
83
84=== modified file 'summit/schedule/render.py'
85--- summit/schedule/render.py 2012-10-24 19:40:50 +0000
86+++ summit/schedule/render.py 2013-01-19 22:31:20 +0000
87@@ -18,7 +18,6 @@
88 import datetime
89 import pytz
90 import simplejson as json
91-import urllib
92
93 from django.conf import settings
94 from django.core.cache import cache
95@@ -56,7 +55,10 @@
96 'min-height': '%dpx' % height,
97 }
98 if meeting.tracks.count() > 0:
99- style['background-color'] = '#'+meeting.tracks.all()[0].color
100+ _track = meeting.tracks.all()[0]
101+ style['background-color'] = _track.get_bgcolor()
102+ style['border'] = _track.get_bordercolor()
103+
104 return '; '.join(': '.join(x) for x in style.items())
105
106
107@@ -209,10 +211,10 @@
108
109 agenda_cache = {}
110 for a in Agenda.objects.select_related().filter(slot__summit=self.summit):
111- if not agenda_cache.has_key(a.slot.id):
112+ if not a.slot.id in agenda_cache:
113 agenda_cache[a.slot.id] = {}
114 agenda_cache[a.slot.id][a.room.id] = a
115-
116+
117 # Work out what item goes into each slot, and the position in
118 # the rendered schedule for it
119 for date in self.dates:
120@@ -237,7 +239,6 @@
121 if r.available(slot)]
122 if len(rooms) > 0:
123 self.meetings[slot].append((rooms[0], None))
124- meeting_room = rooms[0]
125 except KeyError:
126 if not self.track:
127 self.meetings[slot].append((None, None))
128@@ -304,7 +305,7 @@
129 room_tracks = self.room.tracks.all()
130 if room_tracks.count() > 0:
131 query_parts.append(
132- Q(tracks__isnull=True)|Q(tracks__in=room_tracks))
133+ Q(tracks__isnull=True) | Q(tracks__in=room_tracks))
134 only_plenary_meetings = Q(type__in=('plenary', 'talk', 'special'))
135 # Don't show unscheduled plenary tracks in room view unless
136 # it's the plenary room
137@@ -318,7 +319,7 @@
138 # If we are just a track lead, limit schedulable session to your tracks only
139 if self.summit.is_tracklead(self.attendee) and not self.summit.is_scheduler(self.attendee):
140 query_parts.append(Q(tracks__lead__lead=self.attendee))
141-
142+
143 self.unscheduled = list(
144 self.summit.meeting_set.filter(*query_parts))
145
146@@ -347,7 +348,7 @@
147 for slot_num, slot in enumerate(self.slots[date]):
148 for room_num, info in enumerate(self.meetings[slot]):
149 (room, meeting) = info
150- if room is None:
151+ if room is None:
152 continue
153 if meeting is None:
154 meeting_title = ''
155@@ -388,7 +389,7 @@
156 # with 12px added for each column for borders and margin
157 if slot.type == 'plenary':
158 meeting_width = (
159- 112*self.day_width/len(self.meetings[slot]))
160+ 112 * self.day_width / len(self.meetings[slot]))
161 pos['left'] = (date_num * meeting_width) + (room_num * 112)
162 else:
163 pos['left'] = (date_num * self.day_width + room_num) * 112
164@@ -481,7 +482,6 @@
165 html = (u'<span class="last-updated" style="float: right;">Updated '
166 '<span id="refresh-time">0</span> seconds ago</span>'
167 '<div style="clear: both;"></div>')
168-
169
170 if self.endofday:
171 html += '<p><strong>No more sessions for today.</strong></p>'
172@@ -587,7 +587,7 @@
173 had_lunch = True
174
175 # Avoid duplicating markers
176- if slot.start.strftime("%H:%M") not in markers:
177+ if slot.start.strftime("%H:%M") not in markers:
178 markers.append(slot.start.strftime("%H:%M"))
179
180 style = {
181@@ -605,8 +605,8 @@
182 height = 12
183
184 # Avoid duplicating markers
185- if slot.end.strftime("%H:%M") not in markers:
186- markers.append(slot.end.strftime("%H:%M") )
187+ if slot.end.strftime("%H:%M") not in markers:
188+ markers.append(slot.end.strftime("%H:%M"))
189
190 style = {
191 'top': '%dpx' % top,
192@@ -659,7 +659,7 @@
193 }
194 else:
195 style = {}
196-
197+
198 if room.type == 'private':
199 classes.append('private')
200
201@@ -735,10 +735,10 @@
202
203 if meeting.icon:
204 html += '<img src="/media/img/%s" class="meeting_emblem" title="%s" />\n' % (meeting.icon, meeting.get_type_display())
205-
206+
207 if self.edit and meeting.agenda_set.filter(auto=False).exists():
208 html += '<img src="/media/img/lock_mono_dark.png" class="meeting_lock" title="Manually Scheduled" />\n'
209-
210+
211 if slot and room:
212 html += ' <span class="time">%s, %s</span>\n' % (slot.start.strftime("%A %H:%M"),
213 escape_strings(room.title))
214@@ -860,7 +860,6 @@
215
216 meeting_slots[meeting_ref] = meeting.slots
217
218-
219 js = u'\n'
220 js += 'var Data = {\n'
221 js += ' slot: %s,\n' % json.dumps(slot_table, indent=4)
222@@ -984,10 +983,8 @@
223
224 return csv
225
226- def as_ical(self, only_username=None,
227- only_room=None,
228- only_track=None,
229- show_private=False):
230+ def as_ical(self, only_username=None, only_room=None,
231+ only_track=None, show_private=False):
232 """
233 return a schedule as ical
234 """
235@@ -1028,14 +1025,15 @@
236 X-TYPE:%(type)s
237 X-ROOMNAME:%(roomname)s
238 END:VEVENT
239-''' % {'id':meeting.id, 'dtstart':dtstart, 'dtend':dtend, 'category':categories,
240- 'eventname':meeting.title, 'eventplace': room.title, 'type': meeting.type,
241- 'roomname':room.name, 'description': meeting.get_decription().replace('\r', '').replace('\n', '\N'),
242+''' % {'id': meeting.id, 'dtstart': dtstart, 'dtend': dtend, 'category': categories,
243+ 'eventname': meeting.title, 'eventplace': room.title, 'type': meeting.type,
244+ 'roomname': room.name, 'description': meeting.get_decription().replace('\r', '').replace('\n', '\N'),
245 'meeting_url':meeting.meeting_page_url,
246 'base_url':getattr(settings, 'SITE_ROOT', 'http://summit.ubuntu.com')}
247 ical += 'END:VCALENDAR'
248 return ical
249
250+
251 def schedule_factory(
252 request, summit, attendee=None, date=None, room=None, track=None):
253 """Create and return a Schedule instance with the given arguments.

Subscribers

People subscribed via source and target branches