aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-01-12 16:33:17 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-01-12 17:31:38 +0000
commitdf98fe4dfff0a707c9800050f658100c57783654 (patch)
treefd39aa3cf82584fbf784334da41265b5f7dbc43c /templates
parentde6df5e30d4801afc560e93c833a692a117b9547 (diff)
Factor multiple photo details into nicer function.
Remove get_photo_params, which only looked at the first photo, make explicit when we're doing that using `.first`.
Diffstat (limited to 'templates')
-rw-r--r--templates/web/base/admin/report_edit.html6
-rw-r--r--templates/web/base/admin/update_edit.html9
-rw-r--r--templates/web/base/alert/index.html6
-rw-r--r--templates/web/base/alert/list.html6
-rw-r--r--templates/web/base/report/_item.html6
-rw-r--r--templates/web/base/report/photo.html18
-rw-r--r--templates/web/bromley/report/_item.html6
-rw-r--r--templates/web/emptyhomes/index.html6
-rw-r--r--templates/web/fixmybarangay/alert/index.html6
-rw-r--r--templates/web/zurich/admin/problem_row.html4
-rw-r--r--templates/web/zurich/admin/report_edit-sdm.html6
-rw-r--r--templates/web/zurich/admin/report_edit.html6
-rw-r--r--templates/web/zurich/admin/update_edit.html4
-rw-r--r--templates/web/zurich/report/_item.html6
14 files changed, 32 insertions, 63 deletions
diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html
index 72e2c56db..c0cdead84 100644
--- a/templates/web/base/admin/report_edit.html
+++ b/templates/web/base/admin/report_edit.html
@@ -79,11 +79,11 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
[% IF problem.photo %]
<li>
<ul>
- [% FOR photo IN problem.get_photoset.images %]
+ [% FOR photo IN problem.photos %]
<li>
<div class="update-img">
- <a href="[% c.cobrand.base_url %]/photo/[% photo.0 %].fulltemp.jpeg" rel="fancy">
- <img alt="Photo of this report" src="[% c.cobrand.base_url %]/photo/[% photo.0 %].temp.jpeg">
+ <a href="[% c.cobrand.base_url %][% photo.url_temp_full %]" rel="fancy">
+ <img alt="Photo of this report" src="[% c.cobrand.base_url %][% photo.url_temp %]">
<span>zoom</span>
</a>
</div>
diff --git a/templates/web/base/admin/update_edit.html b/templates/web/base/admin/update_edit.html
index 5ffce8bc4..54e6d52d2 100644
--- a/templates/web/base/admin/update_edit.html
+++ b/templates/web/base/admin/update_edit.html
@@ -51,13 +51,8 @@
<li>[% loc('Created:') %] [% PROCESS format_time time=update.created %]</li>
[% IF update.photo %]
-[% photo = update.get_photo_params %]
-<li><img alt="Photo of this update" height="[% photo.height %]" width="[% photo.width %]" src="[% c.cobrand.base_url %]
- [%~ IF update.photo.length == 40 ~%]
- /photo/[% update.photo %].temp.jpeg
- [%~ ELSE ~%]
- [% photo.url %]
- [%~ END ~%]">
+[% photo = update.photos.first %]
+<li><img alt="Photo of this update" src="[% c.cobrand.base_url %][% photo.url_temp %]">
<input type="checkbox" id="remove_photo" name="remove_photo" value="1">
<label for="remove_photo" class="inline">[% loc("Remove photo (can't be undone!)") %]</label></li>
[% END %]
diff --git a/templates/web/base/alert/index.html b/templates/web/base/alert/index.html
index 7057c83a3..4965a1103 100644
--- a/templates/web/base/alert/index.html
+++ b/templates/web/base/alert/index.html
@@ -39,11 +39,9 @@ within a certain distance of a particular location.', "%s is the site name"), si
[% IF photos.size %]
<h2>[% loc('Some photos of recent reports') %]</h2>
<div class="alerts__nearby-activity__photos">
- [% FOREACH p IN photos;
- photo = p.get_photo_params;
- %]
+ [% FOREACH p IN photos %]
<a href="/report/[% p.id %]">
- <img border="0" height="100" src="[% photo.url_tn %]"
+ <img border="0" height="100" src="[% p.photos.first.url_tn %]"
alt="[% p.title | html %]" title="[% p.title | html %]">
</a>
[% END %]
diff --git a/templates/web/base/alert/list.html b/templates/web/base/alert/list.html
index 289eb40af..385cd7d32 100644
--- a/templates/web/base/alert/list.html
+++ b/templates/web/base/alert/list.html
@@ -22,11 +22,9 @@
<div class="alerts__nearby-activity">
<h2>[% loc('Photos of recent nearby reports') %]</h2>
<div class="alerts__nearby-activity__photos">
- [% FOREACH p IN photos;
- photo = p.get_photo_params;
- %]
+ [% FOREACH p IN photos %]
<a href="/report/[% p.id %]">
- <img border="0" height="100" src="[% photo.url_tn %]"
+ <img border="0" height="100" src="[% p.photos.first.url_tn %]"
alt="[% p.title | html %]" title="[% p.title | html %]">
</a>
[% END %]
diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html
index d79a4e9f3..6ae43f798 100644
--- a/templates/web/base/report/_item.html
+++ b/templates/web/base/report/_item.html
@@ -1,9 +1,7 @@
<li class="item-list__item item-list--reports__item [% item_extra_class %]">
<a href="[% c.uri_for('/report', problem.id ) %]">
- [% IF problem.photo;
- photo = problem.get_photo_params
- %]
- <img class="img" height="60" width="90" src="[% photo.url_fp %]" alt="">
+ [% IF problem.photo %]
+ <img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt="">
[% END %]
<h4>[% problem.title | html %]</h4>
<small>
diff --git a/templates/web/base/report/photo.html b/templates/web/base/report/photo.html
index 4114fad72..9be5b6538 100644
--- a/templates/web/base/report/photo.html
+++ b/templates/web/base/report/photo.html
@@ -1,21 +1,9 @@
[% IF c.cobrand.allow_photo_display(object) && object.photo %]
- [% IF object.can('get_photoset') %]
- [% FOR photo IN object.get_photoset.images %]
+ [% FOR photo IN object.photos %]
<div class="update-img">
- <a href="[% c.cobrand.base_url %]/photo/[% object.id %].[% loop.index %].full.jpeg?[% photo.0 %]" rel="fancy">
- <img alt="Photo of this report" src="[% c.cobrand.base_url %]/photo/[% object.id %].[% loop.index %].jpeg?[% photo.0 %]">
+ <a href="[% c.cobrand.base_url %][% photo.url_full %]" rel="fancy">
+ <img alt="Photo of this report" src="[% c.cobrand.base_url %][% photo.url %]">
<span>zoom</span></a>
</div>
[% END %]
- [% ELSE %]
- [%# e.g. comments %]
- [% photo = object.get_photo_params %]
- <div class="update-img">
- [% IF photo.url_full %]<a href="[% photo.url_full %]" rel="fancy">[% END %]
- <img alt="Photo of this report"
- [%- IF photo.height %]height="[% photo.height %]" width="[% photo.width %]"[% END -%]
- src="[% photo.url %]">
- [%- IF photo.url_full %]<span>zoom</span></a>[% END %]
- </div>
- [% END %]
[% END %]
diff --git a/templates/web/bromley/report/_item.html b/templates/web/bromley/report/_item.html
index 3bd8a8686..2540aec98 100644
--- a/templates/web/bromley/report/_item.html
+++ b/templates/web/bromley/report/_item.html
@@ -1,9 +1,7 @@
<li class="item-list__item item-list--reports__item item-list__item--with-pin [% c.cobrand.pin_colour(problem) %]">
<a class="[% problem.category %]" href="[% c.uri_for('/report', problem.id ) %]">
- [% IF problem.photo;
- photo = problem.get_photo_params
- %]
- <img class="img" height="60" width="90" src="[% photo.url_fp %]" alt="">
+ [% IF problem.photo %]
+ <img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt="">
[% END %]
<span>[% problem.title | html %]</span><br />
<small>[% prettify_dt( problem.confirmed, 1 ) %]
diff --git a/templates/web/emptyhomes/index.html b/templates/web/emptyhomes/index.html
index ca70d1d9c..1d17c3423 100644
--- a/templates/web/emptyhomes/index.html
+++ b/templates/web/emptyhomes/index.html
@@ -45,11 +45,9 @@
[% IF recent_photos.size %]
<p id="front_photos">
- [% FOREACH p IN recent_photos;
- photo = p.get_photo_params;
- %]
+ [% FOREACH p IN recent_photos %]
<a href="/report/[% p.id %]"><img border="0" height="100"
- src="[% photo.url_tn %]" alt="[% p.title | html %]" title="[% p.title | html %]"></a>
+ src="[% p.photos.first.url_tn %]" alt="[% p.title | html %]" title="[% p.title | html %]"></a>
[% END %]
</p>
[% END %]
diff --git a/templates/web/fixmybarangay/alert/index.html b/templates/web/fixmybarangay/alert/index.html
index c168fa41b..c842a7683 100644
--- a/templates/web/fixmybarangay/alert/index.html
+++ b/templates/web/fixmybarangay/alert/index.html
@@ -30,11 +30,9 @@ FixMyBarangay has a RSS feeds and email alerts for local problems.
<div id="alert_recent">
<aside>
<h2>[% loc('Some photos of recent reports') %]</h2>
- [% FOREACH p IN photos;
- photo = p.get_photo_params
- %]
+ [% FOREACH p IN photos %]
<a href="/report/[% p.id %]"><img border="0" height="100"
- src="[% photo.url_tn %]" alt="[% p.title | html %]" title="[% p.title | html %]"></a>
+ src="[% p.photos.first.url_tn %]" alt="[% p.title | html %]" title="[% p.title | html %]"></a>
[% END %]
</aside>
</div>
diff --git a/templates/web/zurich/admin/problem_row.html b/templates/web/zurich/admin/problem_row.html
index 8a26f28ae..acbf17017 100644
--- a/templates/web/zurich/admin/problem_row.html
+++ b/templates/web/zurich/admin/problem_row.html
@@ -36,9 +36,9 @@
<td>
[% IF problem.photo %]
- [% FOR photo IN problem.get_photoset.images %]
+ [% FOR photo IN problem.photos %]
<div class="update-img">
- <img height="60" width="90" alt="" src="[% c.cobrand.base_url %]/photo/[% photo.0 %].temp.jpeg">
+ <img height="60" width="90" alt="" src="[% c.cobrand.base_url %][% photo.url_temp %]">
</div>
[% END %]
[% END %]
diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html
index 1d1b60e56..a0ff1038d 100644
--- a/templates/web/zurich/admin/report_edit-sdm.html
+++ b/templates/web/zurich/admin/report_edit-sdm.html
@@ -82,10 +82,10 @@
[% IF problem.photo %]
<dd>
- [% FOR photo IN problem.get_photoset.images %]
+ [% FOR photo IN problem.photos %]
<div class="update-img">
- <a href="[% c.cobrand.base_url %]/photo/[% photo.0 %].fulltemp.jpeg" rel="fancy">
- <img alt="Photo of this report" src="[% c.cobrand.base_url %]/photo/[% photo.0 %].temp.jpeg">
+ <a href="[% c.cobrand.base_url %][% photo.url_temp_full %]" rel="fancy">
+ <img alt="Photo of this report" src="[% c.cobrand.base_url %][% photo.url_temp %]">
<span>zoom</span>
</a>
</div>
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
index 239646f6c..dd876935c 100644
--- a/templates/web/zurich/admin/report_edit.html
+++ b/templates/web/zurich/admin/report_edit.html
@@ -106,10 +106,10 @@
[% IF problem.photo %]
<dd>
- [% FOR photo IN problem.get_photoset.images %]
+ [% FOR photo IN problem.photos %]
<div class="update-img">
- <a href="[% c.cobrand.base_url %]/photo/[% photo.0 %].fulltemp.jpeg" rel="fancy">
- <img alt="Photo of this report" src="[% c.cobrand.base_url %]/photo/[% photo.0 %].temp.jpeg">
+ <a href="[% c.cobrand.base_url %][% photo.url_temp_full %]" rel="fancy">
+ <img alt="Photo of this report" src="[% c.cobrand.base_url %][% photo.url_temp %]">
<span>zoom</span>
</a>
</div>
diff --git a/templates/web/zurich/admin/update_edit.html b/templates/web/zurich/admin/update_edit.html
index ab40981a5..fbd96f3a5 100644
--- a/templates/web/zurich/admin/update_edit.html
+++ b/templates/web/zurich/admin/update_edit.html
@@ -29,8 +29,8 @@
<li>[% loc('Created:') %] [% PROCESS format_date this_date=update.created %] [% update.created.hms %]</li>
[% IF update.photo %]
-[% photo = update.get_photo_params %]
-<li><img alt="" height="[% photo.height %]" width="[% photo.width %]" src="[% photo.url %]">
+[% photo = update.photos.first %]
+<li><img alt="" src="[% photo.url %]">
<input type="checkbox" id="remove_photo" name="remove_photo" value="1">
<label for="remove_photo" class="inline">[% loc("Remove photo (can't be undone!)") %]</label></li>
[% END %]
diff --git a/templates/web/zurich/report/_item.html b/templates/web/zurich/report/_item.html
index 9ba5e6fcb..a4d274a8e 100644
--- a/templates/web/zurich/report/_item.html
+++ b/templates/web/zurich/report/_item.html
@@ -1,9 +1,7 @@
<li class="item-list__item item-list--reports__item">
<a href="[% c.uri_for('/report', problem.id ) %]">
- [% IF problem.state != 'unconfirmed' AND problem.photo AND c.cobrand.allow_photo_display(problem);
- photo = problem.get_photo_params
- %]
- <img class="img" height="60" width="90" src="[% photo.url_fp %]" alt="">
+ [% IF problem.state != 'unconfirmed' AND problem.photo AND c.cobrand.allow_photo_display(problem) %]
+ <img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt="">
[% END %]
[% IF problem.state != 'unconfirmed' %]
<h4>[% problem.title | html %]</h4>