Merge lp:~mhall119/loco-team-portal/bzr-apps-upgrades into lp:loco-team-portal

Proposed by Michael Hall
Status: Merged
Approved by: Chris Johnston
Approved revision: 427
Merged at revision: 426
Proposed branch: lp:~mhall119/loco-team-portal/bzr-apps-upgrades
Merge into: lp:loco-team-portal
Diff against target: 361 lines (+55/-159)
8 files modified
loco_directory/media/css/twidenash.css (+6/-6)
loco_directory/media/js/twidenash.js (+0/-140)
loco_directory/settings.py (+20/-2)
loco_directory/teams/management/commands/init-ld.py (+8/-5)
loco_directory/templates/events/global_event_detail.html (+2/-0)
loco_directory/templates/events/global_event_detail.inc.html (+1/-1)
loco_directory/templates/index.html (+9/-1)
loco_directory/templates/teams/team_detail.html (+9/-4)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/bzr-apps-upgrades
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Review via email: mp+54010@code.launchpad.net

Description of the change

Use bzr_apps to get and manage the latest light-django-theme and twidenash

To post a comment you must log in.
425. By Michael Hall

bzr-apps version bump

426. By Michael Hall

Version bump for twidenash

427. By Michael Hall

Solves the case of the missing </script>

Revision history for this message
Ronnie (ronnie.vd.c) wrote :

Change the twidenash script to rev3 (which contains a twitter fix) then ill approve

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 'loco_directory/media/css/twidenash.css'
2--- loco_directory/media/css/twidenash.css 2010-09-28 17:21:02 +0000
3+++ loco_directory/media/css/twidenash.css 2011-03-18 22:26:31 +0000
4@@ -7,30 +7,30 @@
5 */
6
7
8-ul.twidenash li {
9+.twidenash li {
10 list-style-type: none;
11 clear: both;
12 padding: 3px;
13- font-size: 100%;
14+ font-size: 0.75em;
15 }
16
17-ul.twidenash li img {
18+.twidenash li img {
19 float: left;
20 vertical-align: top;
21 padding-right: 10px;
22 }
23
24-ul.twidenash li .comment {
25+.twidenash li .comment {
26 margin-left: 5px;
27 display: block;
28 overflow: auto;
29 }
30
31-ul.twidenash li .nick {
32+.twidenash li .nick {
33 font-weight: bold;
34 }
35
36-ul.twidenash li .time {
37+.twidenash li .time {
38 font-size: 0.75em;
39 color: #555;
40 }
41
42=== removed file 'loco_directory/media/js/twidenash.js'
43--- loco_directory/media/js/twidenash.js 2010-09-28 17:21:02 +0000
44+++ loco_directory/media/js/twidenash.js 1970-01-01 00:00:00 +0000
45@@ -1,140 +0,0 @@
46-/*
47-*
48-* Copyright (c) 2010 Stuart Langridge
49-*
50-* Permission is hereby granted, free of charge, to any person obtaining a copy
51-* of this software and associated documentation files (the "Software"), to deal
52-* in the Software without restriction, including without limitation the rights
53-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
54-* copies of the Software, and to permit persons to whom the Software is
55-* furnished to do so, subject to the following conditions:
56-*
57-* The above copyright notice and this permission notice shall be included in
58-* all copies or substantial portions of the Software.
59-*
60-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
63-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
64-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
65-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
66-* THE SOFTWARE.
67-*
68-* Website: http://code.google.com/p/twidenash/
69-*/
70-
71-/*
72-* With modification by Michael Hall for use in loco.ubuntu.com
73-*/
74-
75-twidenash = {
76- init: function() {
77- if (!twidenash.hashtag) return;
78- // request hashtag search values for both twitter and identica
79- twidenash.callbacks = 0;
80- twidenash.items = [];
81- twidenash.add_script("http://locoteams.status.net/api/search.json?" +
82- "callback=twidenash.cb&rpp=10&q=%23" + twidenash.hashtag);
83- twidenash.add_script("http://identi.ca/api/search.json?" +
84- "callback=twidenash.cb&rpp=10&q=%23" + twidenash.hashtag);
85- twidenash.add_script("http://search.twitter.com/search.json?" +
86- "callback=twidenash.cb&rpp=10&q=%23" + twidenash.hashtag);
87- twidenash.printed = 0;
88- },
89- add_script: function(url) {
90- var scr = document.createElement("script");
91- scr.src = url;
92- document.getElementsByTagName("head")[0].appendChild(scr);
93- },
94- cb: function(data) {
95- for (var i=0; i<data.results.length; i++) {
96- var dupe = false;
97- for (var j=0; j<twidenash.items.length; j++) {
98- // Strip characters that may be specific to networks
99- var comp1 = data.results[i].text.replace(/[♺\!\#\@]/g, '');
100- var comp2 = twidenash.items[j].text.replace(/[♺\!\#\@]/g, '');
101- var compdate = Date.parse(data.results[i].created_at);
102- var datediff = Math.abs(Date.parse(data.results[i].created_at) - twidenash.items[j].dt)
103- if (comp1 == comp2 && datediff < 120000) {
104- dupe = true;
105- break;
106- }
107- }
108- if (dupe) continue;
109- twidenash.items.push({ text: data.results[i].text,
110- img: data.results[i].profile_image_url,
111- dt: Date.parse(data.results[i].created_at),
112- user: data.results[i].from_user })
113- }
114- twidenash.callbacks += 1;
115- if (twidenash.callbacks == 2) {
116- twidenash.items.sort(function(a,b) { return b.dt - a.dt });
117- var ul = document.createElement("ul");
118- ul.className = "twidenash";
119- for (i=0; i<twidenash.items.length && twidenash.printed < 5; i++) {
120- var li = document.createElement("li");
121- var img = document.createElement("img");
122- img.src = twidenash.items[i].img;
123- img.width = 48;
124- var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
125- var delta = parseInt((relative_to.getTime() - twidenash.items[i].dt) / 1000);
126- var pluralize = function (singular, n) {
127- return '' + n + ' ' + singular + (n == 1 ? '' : 's');
128- };
129- if(delta < 60) {
130- date_msg = 'less than a minute ago ';
131- } else if(delta < (45*60)) {
132- date_msg = 'about ' + pluralize("minute", parseInt(delta / 60)) + ' ago ';
133- } else if(delta < (24*60*60)) {
134- date_msg = 'about ' + pluralize("hour", parseInt(delta / 3600)) + ' ago ';
135- } else {
136- date_msg = 'about ' + pluralize("day", parseInt(delta / 86400)) + ' ago ';
137- }
138- var span = document.createElement("span");
139- span.className = 'comment';
140- var nick = document.createElement("span");
141- nick.className = 'nick';
142- nick.appendChild(document.createTextNode(twidenash.items[i].user));
143- var time = document.createElement("span");
144- time.className = 'time';
145- time.appendChild(document.createTextNode(" ( "+ date_msg +" ) "));
146-
147- var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;
148- span.innerHTML = twidenash.items[i].text.replace(exp,"<a href='$1' target='_blank'>$1</a>");
149- li.appendChild(img);
150- li.appendChild(nick);
151- li.appendChild(time);
152- li.appendChild(span);
153- ul.appendChild(li);
154- twidenash.printed++;
155- }
156- twidenash.scriptelement.parentNode.insertBefore(ul, twidenash.scriptelement);
157- }
158- },
159- cache_scriptname: function() {
160- // called before page load so we can find our own name
161- var scr = document.getElementsByTagName("script");
162- var url = scr[scr.length-1].getAttribute("src");
163- if (!url) {
164- var twidenash_script = document.getElementById("twidenash_script");
165- if (twidenash_script) url = twidenash_script.getAttribute("src");
166- }
167- if (url && url.lastIndexOf('?') != -1) {
168- twidenash.hashtag = url.substr(url.lastIndexOf('?')+1);
169- if (twidenash_script) {
170- twidenash.scriptelement = twidenash_script;
171- } else {
172- twidenash.scriptelement = scr[scr.length-1];
173- }
174- }
175- }
176-};
177-(function(i) {var u =navigator.userAgent;var e=/*@cc_on!@*/false; var st =
178-setTimeout;if(/webkit/i.test(u)){st(function(){var dr=document.readyState;
179-if(dr=="loaded"||dr=="complete"){i()}else{st(arguments.callee,10);}},10);}
180-else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
181-document.addEventListener("DOMContentLoaded",i,false); } else if(e){ (
182-function(){var t=document.createElement('doc:rdy');try{t.doScroll('left');
183-i();t=null;}catch(e){st(arguments.callee,0);}})();}else{window.onload=i;}})(twidenash.init);
184-twidenash.cache_scriptname();
185-
186
187=== modified file 'loco_directory/settings.py'
188--- loco_directory/settings.py 2010-12-07 21:42:01 +0000
189+++ loco_directory/settings.py 2011-03-18 22:26:31 +0000
190@@ -113,7 +113,7 @@
191 ubuntu_website.TEMPLATE_DIR,
192 )
193
194-INSTALLED_APPS = (
195+INSTALLED_APPS = [
196 'django.contrib.auth',
197 'django.contrib.contenttypes',
198 'django.contrib.sessions',
199@@ -126,7 +126,7 @@
200 'userprofiles',
201 'django_openid_auth',
202 'south',
203-)
204+]
205
206 AUTHENTICATION_BACKENDS = (
207 'django_openid_auth.auth.OpenIDBackend',
208@@ -159,6 +159,24 @@
209
210 FLICKR_API_KEY = '8c969a1e8a49629bb89b411930ab1cc8'
211
212+# Manage apps from bzr branches
213+try:
214+ import bzr_apps
215+ INSTALLED_APPS.append('bzr_apps')
216+except:
217+ pass
218+
219+BZR_APPS = {
220+ ## ubuntu-django-foundations app management
221+ 'bzr_apps': ('bzr+ssh://bazaar.launchpad.net/%2Bbranch/ubuntu-django-foundations/bzr-apps/', '3'),
222+
223+ ## ubuntu-website supplied templates and styles
224+ 'ubuntu_website': ('bzr+ssh://bazaar.launchpad.net/~ubuntu-community-webthemes/ubuntu-community-webthemes/light-django-theme', '32'),
225+
226+ ## twidenash supplied microblog embedding javascript
227+ 'media/js/twidenash': ('bzr+ssh://bazaar.launchpad.net/~django-foundations-dev/twidenash/2.0/', '2'),
228+}
229+
230 import logging
231 try:
232 from local_settings import *
233
234=== modified file 'loco_directory/teams/management/commands/init-ld.py'
235--- loco_directory/teams/management/commands/init-ld.py 2011-03-15 13:08:01 +0000
236+++ loco_directory/teams/management/commands/init-ld.py 2011-03-18 22:26:31 +0000
237@@ -44,11 +44,14 @@
238 else:
239 print " * Creating jquery symlinks: not necessary."
240
241- print " * Adding ubuntu_website media:",
242- if os.path.isdir(os.path.join(path, "ubuntu_website")):
243+ print " * Adding Bzr Apps:",
244+ if os.path.isdir(os.path.join(path, "bzr_apps", ".bzr")):
245 print "not necessary."
246 else:
247- subprocess.call(["bzr", "branch", "-q",
248- "lp:ubuntu-community-webthemes/light-django-theme",
249- "ubuntu_website"])
250+ subprocess.call(["bzr", "branch", "-q", "--use-existing-dir",
251+ "lp:ubuntu-django-foundations/bzr-apps",
252+ "bzr_apps"])
253 print "added."
254+
255+ print " * Pulling Bzr Apps:",
256+ subprocess.call(["./manage.py", "pullapps"])
257
258=== modified file 'loco_directory/templates/events/global_event_detail.html'
259--- loco_directory/templates/events/global_event_detail.html 2011-02-17 20:05:03 +0000
260+++ loco_directory/templates/events/global_event_detail.html 2011-03-18 22:26:31 +0000
261@@ -6,9 +6,11 @@
262 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language={% trans 'en' %}&region={% trans 'US' %}"></script>
263 <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_packed.js"></script>
264 <script type="text/javascript" src="{{MEDIA_URL}}js/jquery-ubuntu-maps.js"></script>
265+ <script type="text/javascript" src="{{MEDIA_URL}}js/twidenash/jquery-twidenash.js"></script>
266 <script type="text/javascript">
267 //<![CDATA[
268 $(function(){
269+ $('.twidenash').twidenash();
270 $('#venue-map').showLocations({markers_url:'{% url global-event-locations global_event_id=global_event_object.id %}',
271 marker_icon: '{{ MEDIA_URL }}/img/marker.png'});
272 });
273
274=== modified file 'loco_directory/templates/events/global_event_detail.inc.html'
275--- loco_directory/templates/events/global_event_detail.inc.html 2011-02-17 20:05:03 +0000
276+++ loco_directory/templates/events/global_event_detail.inc.html 2011-03-18 22:26:31 +0000
277@@ -100,7 +100,7 @@
278 {% if global_event_object.microbloghashtag %}
279 <article class="minor-content alone">
280 <h2>{% trans "Microblogging" %} #{{global_event_object.microbloghashtag}}</h2>
281- <p><script src="{{MEDIA_URL}}js/twidenash.js?{{global_event_object.microbloghashtag}}"></script></p>
282+ <div class="twidenash" id="{{ global_event_object.microbloghashtag }}"></div>
283 </article>
284 {% endif %}
285
286
287=== modified file 'loco_directory/templates/index.html'
288--- loco_directory/templates/index.html 2011-02-18 03:16:32 +0000
289+++ loco_directory/templates/index.html 2011-03-18 22:26:31 +0000
290@@ -9,6 +9,14 @@
291 {% block extrahead %}{{block.super}}
292 <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/css/twidenash.css" />
293 <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/css/continents.css" />
294+ <script type="text/javascript" src="{{MEDIA_URL}}js/twidenash/jquery-twidenash.js"></script>
295+ <script type="text/javascript">
296+ //<![CDATA[
297+ $(function() {
298+ $('.twidenash').twidenash();
299+ });
300+ //]]>
301+ </script>
302 {% endblock %}
303
304 {% block content %}
305@@ -79,7 +87,7 @@
306
307 <article class="minor-content alone">
308 <h2>{% trans "Microblogging" %} #locoteams</h2>
309- <p><script src="{{MEDIA_URL}}js/twidenash.js?locoteams"></script></p>
310+ <div class="twidenash" id="locoteams"></div>
311 </article>
312
313 {% endblock %}
314
315=== modified file 'loco_directory/templates/teams/team_detail.html'
316--- loco_directory/templates/teams/team_detail.html 2011-03-02 22:34:34 +0000
317+++ loco_directory/templates/teams/team_detail.html 2011-03-18 22:26:31 +0000
318@@ -14,16 +14,21 @@
319
320
321 {% block extrahead %}{{ block.super }}
322-<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/css/twidenash.css" />
323 {% if team.flickr_id or team.picasa_id or team.pixie_id %}
324 <script type="text/javascript" src="{{MEDIA_URL}}jquery/jquery.js"></script>
325 <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.lightbox-0.5.min.js"></script>
326 <link rel="stylesheet" href="{{MEDIA_URL}}css/jquery.lightbox-0.5.css" type="text/css" media="screen" />
327 <script type="text/javascript" src="{{MEDIA_URL}}js/jquery-flickr.js"></script>
328+{% endif %}
329+
330+<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/css/twidenash.css" />
331+<script type="text/javascript" src="{{MEDIA_URL}}js/twidenash/jquery-twidenash.js"></script>
332 <script type="text/javascript">
333 $(function() {
334 var perPage = '16';
335-{% endif %}
336+ $('.twidenash').twidenash();
337+
338+
339 {% if team.flickr_id %}
340 $('#flickr').flickr({ key: "{{ flickr_api_key }}", id: "{{ team.flickr_id }}", amount: perPage });
341 {% endif %}
342@@ -65,10 +70,10 @@
343 $("a.lightbox").lightBox();
344 });
345 {% endif %}
346-{% if team.flickr_id or team.picasa_id or team.pixie_id %}
347 });
348
349 </script>
350+{% if team.flickr_id or team.picasa_id or team.pixie_id %}
351 <style type="text/css">
352 div#flickr a.lightbox img {
353 border: 5px solid #b3aaa4;
354@@ -208,7 +213,7 @@
355 {% if team.microbloghashtag %}
356 <article class="minor-content alone">
357 <h2>{% trans "Microblogging" %} #{{team.microbloghashtag}}</h2>
358- <p><script src="{{MEDIA_URL}}js/twidenash.js?{{team.microbloghashtag}}"></script></p>
359+ <div class="twidenash" id="{{ team.microbloghashtag }}"></div>
360 </article>
361 {% endif %}
362

Subscribers

People subscribed via source and target branches