Merge lp:~daker/loco-team-portal/picasa-plugin into lp:loco-team-portal

Proposed by Adnane Belmadiaf
Status: Merged
Approved by: Adnane Belmadiaf
Approved revision: 455
Merged at revision: 455
Proposed branch: lp:~daker/loco-team-portal/picasa-plugin
Merge into: lp:loco-team-portal
Diff against target: 248 lines (+119/-51)
4 files modified
loco_directory/media/css/newstyle.css (+25/-1)
loco_directory/media/js/jquery-picasa.js (+69/-0)
loco_directory/media/js/jquery-pixie.js (+1/-1)
loco_directory/templates/teams/team_detail.html (+24/-49)
To merge this branch: bzr merge lp:~daker/loco-team-portal/picasa-plugin
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Review via email: mp+66722@code.launchpad.net

Commit message

Added picasa jQuery plugin.

To post a comment you must log in.
Revision history for this message
Chris Johnston (cjohnston) wrote :

Looks good.. I still want to talk about moving it out like twidenash at some point for other developers to use.

review: Approve
Revision history for this message
Tarmac WebDev (tarmac-webdev) wrote :

Attempt to merge into lp:loco-directory failed due to conflicts:

text conflict in loco_directory/media/css/newstyle.css

455. By Adnane Belmadiaf

* Fixed merge conflicts in newstyle.css

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/media/css/newstyle.css'
2--- loco_directory/media/css/newstyle.css 2011-07-15 23:16:10 +0000
3+++ loco_directory/media/css/newstyle.css 2011-07-17 11:46:43 +0000
4@@ -591,7 +591,7 @@
5 margin: 0.5em 0;
6 }
7
8-.teams-legend{
9+.teams-legend {
10 width:50%;
11 padding:5px 0;
12 margin:5px 25% 0;
13@@ -601,3 +601,27 @@
14 box-shadow:0 1px 1px #DFDFDF;
15 border-radius:8px;
16 }
17+
18+/* Team photos feed */
19+div#flickr, div#picasa, div#pixie {
20+ width:100%;
21+}
22+
23+div#flickr a.lightbox img {
24+ border: 5px solid #b3aaa4;
25+ margin-left: 5px;
26+ margin-right: 5px;
27+}
28+
29+div#picasa a.lightbox img {
30+ border: 5px solid #b3aaa4;
31+ margin-left: 5px;
32+ margin-right: 5px;
33+}
34+
35+div#pixie a.lightbox img {
36+ border: 5px solid #b3aaa4;
37+ margin-left: 5px;
38+ margin-right: 5px;
39+
40+}
41
42=== added file 'loco_directory/media/js/jquery-picasa.js'
43--- loco_directory/media/js/jquery-picasa.js 1970-01-01 00:00:00 +0000
44+++ loco_directory/media/js/jquery-picasa.js 2011-07-17 11:46:43 +0000
45@@ -0,0 +1,69 @@
46+/*
47+ * jQuery Picasa plugin 0.1.0 (Based on jQuery Flickr plugin)
48+ * Requires jQuery 1.4.2
49+ *
50+ * Copyright 2011, Adnane Belmadiaf <daker@ubuntu.com>
51+ * Dual licensed under the MIT or GPL Version 2 licenses.
52+ * http://jquery.org/license
53+ */
54+
55+(function ($) {
56+ $.fn.extend({
57+ //This is where you write your plugin's name
58+ picasa: function (options) {
59+ var defaults = {
60+ id: null,
61+ amount: 16,
62+ lightbox_class: 'lightbox'
63+ },
64+ html_elements = this,
65+ data = {
66+ kind: 'photo',
67+ alt: 'json',
68+ access: 'public',
69+ thumbsize: '72',
70+ hl: 'en_US'
71+ };
72+ options = $.extend(defaults, options);
73+
74+ function parseResponse(data) {
75+ var title = "Untitled";
76+ var link = "#";
77+ var images = [], image, link;
78+ $.each(data.feed.entry, function (i, rPhoto) {
79+ if(rPhoto.media$group.media$content[0].url) {
80+ link = rPhoto.media$group.media$content[0].url;
81+ }
82+ if(rPhoto.media$group.media$content[0].url) {
83+ link = rPhoto.media$group.media$content[0].url;
84+ }
85+ image = $('<img>').attr({
86+ src: rPhoto.media$group.media$content[0].url + '?imgmax=75&crop=1',
87+ alt: rPhoto.media$group.media$title.$t
88+ });
89+ link = $('<a>').addClass(options.lightbox_class).attr({
90+ title: rPhoto.media$group.media$title.$t,
91+ href: rPhoto.media$group.media$content[0].url
92+ }).append(image);
93+ images.push(link);
94+ });
95+
96+ $(html_elements).each(function (i, html_element) {
97+ var index;
98+ for (index in images) {
99+ if (images.hasOwnProperty(index)) {
100+ $(html_element).append(images[index]);
101+ }
102+ }
103+ });
104+ // Reinitiale the lightbox with the new photo's
105+ $('a.' + options.lightbox_class).lightBox();
106+ }
107+
108+ $.getJSON('http://picasaweb.google.com/data/feed/base/user/' + options.id + '?' + $.param(data) + '&max-results=' + options.amount, parseResponse);
109+
110+ // Return the html objects untouched (the photo's are added when loaded)
111+ return this;
112+ } // End of picasa command
113+ });
114+}(jQuery));
115
116=== modified file 'loco_directory/media/js/jquery-pixie.js'
117--- loco_directory/media/js/jquery-pixie.js 2011-04-01 17:30:56 +0000
118+++ loco_directory/media/js/jquery-pixie.js 2011-07-17 11:46:43 +0000
119@@ -2,7 +2,7 @@
120 * jQuery Pixie plugin 0.1.0 (Based on jQuery Flickr plugin)
121 * Requires jQuery 1.4.2
122 *
123- * Copyright 2011, Adnane Belmadiaf
124+ * Copyright 2011, Adnane Belmadiaf <daker@ubuntu.com>
125 * Dual licensed under the MIT or GPL Version 2 licenses.
126 * http://jquery.org/license
127 */
128
129=== modified file 'loco_directory/templates/teams/team_detail.html'
130--- loco_directory/templates/teams/team_detail.html 2011-06-13 11:17:32 +0000
131+++ loco_directory/templates/teams/team_detail.html 2011-07-17 11:46:43 +0000
132@@ -4,10 +4,10 @@
133 {% block title %}{% trans team.name %} | {% trans "Ubuntu LoCo Team Directory" %} {% endblock %}
134
135 {% block sub_nav_links %}
136- <a class="sub-nav-item" href="{% url team-list %}" title="{% trans "Back to Teams List" %}">{% trans "Back to Teams List" %}</a>
137- {% if is_member %}{% else %} <a class="sub-nav-item" href="https://launchpad.net/~{{ team.lp_name }}/+join">{% trans "Join This Team!" %}</a>{% endif %}
138- {% if is_admin %}<a class="sub-nav-item" href="{% url team-edit team.lp_name %}" title="{% trans "Edit Details" %}">{% trans "Edit Details" %}</a>{% endif %}
139- {% if is_admin and not team.active %}<a class="sub-nav-item" href="{% url select-other-team team.lp_name %}" title="{% trans "Merge with another team" %}">{% trans "Merge team" %}</a>{% endif %}
140+ <a class="sub-nav-item" href="{% url team-list %}" title="{% trans "Back to Teams List" %}">{% trans "Back to Teams List" %}</a>
141+ {% if is_member %}{% else %} <a class="sub-nav-item" href="https://launchpad.net/~{{ team.lp_name }}/+join">{% trans "Join This Team!" %}</a>{% endif %}
142+ {% if is_admin %}<a class="sub-nav-item" href="{% url team-edit team.lp_name %}" title="{% trans "Edit Details" %}">{% trans "Edit Details" %}</a>{% endif %}
143+ {% if is_admin and not team.active %}<a class="sub-nav-item" href="{% url select-other-team team.lp_name %}" title="{% trans "Merge with another team" %}">{% trans "Merge team" %}</a>{% endif %}
144 {% if is_member %}<a class="sub-nav-item" href="{% url team-event-new team.lp_name %}" title="{% trans "Add New Event" %}">{% trans "Add New Event" %}</a>{% endif %}
145 {% if is_member %}<a class="sub-nav-item" href="{% url team-meeting-new team.lp_name %}" title="{% trans "Add New Meeting" %}">{% trans "Add New Meeting" %}</a>{% endif %}
146 {% endblock %}
147@@ -17,9 +17,19 @@
148 <script type="text/javascript" src="{{MEDIA_URL}}jquery/jquery.js"></script>
149 {% if team.flickr_id or team.picasa_id or team.pixie_id %}
150 <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.lightbox-0.5.min.js"></script>
151+<link rel="stylesheet" href="{{MEDIA_URL}}css/jquery.lightbox-0.5.css" type="text/css" media="screen" />
152+{% endif %}
153+
154+{% if team.flickr_id %}
155 <script type="text/javascript" src="{{MEDIA_URL}}js/jquery-flickr.js"></script>
156+{% endif %}
157+
158+{% if team.picasa_id %}
159+<script type="text/javascript" src="{{MEDIA_URL}}js/jquery-picasa.js"></script>
160+{% endif %}
161+
162+{% if team.pixie_id %}
163 <script type="text/javascript" src="{{MEDIA_URL}}js/jquery-pixie.js"></script>
164-<link rel="stylesheet" href="{{MEDIA_URL}}css/jquery.lightbox-0.5.css" type="text/css" media="screen" />
165 {% endif %}
166
167 <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/css/twidenash.css" />
168@@ -29,36 +39,19 @@
169 $(function() {
170 var perPage = '16';
171 $('.twidenash').twidenash();
172-
173+
174 {% if team.flickr_id %}
175 $('#flickr').flickr({ key: "{{ flickr_api_key }}", id: "{{ team.flickr_id }}", amount: 6 });
176 {% endif %}
177+
178 {% if team.picasa_id %}
179- var picasa_userId = '{{ team.picasa_id }}';
180- $.getJSON('http://picasaweb.google.com/data/feed/base/user/'+ picasa_userId +'?alt=json&kind=photo'+
181- '&access=public&thumbsize=72&max-results=' + perPage + '&hl=en_US&callback=?',
182- function(data) {
183- $.each(data.feed.entry, function(i,item) {
184- var altLink = "#";
185- if(item.media$group.media$content[0].url) {
186- altLink = item.media$group.media$content[0].url;
187- }
188- var title = "Untitled";
189- if(item.media$group.media$description.$t) {
190- title = item.media$group.media$description.$t;
191- }
192- $("<img/>").attr("src",item.media$group.media$thumbnail[0].url).attr("width",75).attr("height",75).attr("title", title)
193- .appendTo("#picasa")
194- .wrap("<a class='lightbox' href='"+item.media$group.media$content[0].url+"'</a>");
195- });
196- $("a.lightbox").lightBox();
197- });
198+ $('#picasa').picasa({ id: "{{ team.picasa_id }}", amount: perPage });
199 {% endif %}
200-
201+
202 {% if team.pixie_id %}
203 $('#pixie').pixie({ key: "{{ pixie_api_key }}", id: "{{ team.pixie_id }}", amount: perPage });
204 {% endif %}
205-
206+
207 if ($(location).attr('hash') == "#chat") {
208 $('#webchat').show('fast', function() {
209 $(window).scrollTop($('#webchat').position().top);
210@@ -67,25 +60,7 @@
211 });
212 </script>
213 {% if team.flickr_id or team.picasa_id or team.pixie_id %}
214-<style type="text/css">
215-div#flickr a.lightbox img {
216- border: 5px solid #b3aaa4;
217- margin-left: 5px;
218- margin-right: 5px;
219-}
220-
221-div#picasa a.lightbox img {
222- border: 5px solid #b3aaa4;
223- margin-left: 5px;
224- margin-right: 5px;
225-}
226-
227-div#pixie a.lightbox img {
228- border: 5px solid #b3aaa4;
229- margin-left: 5px;
230- margin-right: 5px;
231-}
232-</style>
233+
234 {% endif %}
235 <link type="application/rss+xml" rel="alternate" title="{% trans "Team Events (RSS)" %}" href="{% url team-events-rss team.lp_name %}" />
236 {% endblock %}
237@@ -227,9 +202,9 @@
238 {% with team.name as team_name %}
239 <h2>{% blocktrans %}Photos from {{ team_name }}{% endblocktrans %}</h2>
240 {% endwith %}
241- <div style="width:100%;" id="flickr"> </div>
242- <div style="width:100%;" id="picasa"> </div>
243- <div style="width:100%;" id="pixie"> </div>
244+ <div id="flickr"> </div>
245+ <div id="picasa"> </div>
246+ <div id="pixie"> </div>
247 </article>
248 {% endif %}
249

Subscribers

People subscribed via source and target branches