diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2015-01-27 18:32:02 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2015-10-06 09:09:22 +0100 |
commit | a78bb3fc98dd1851e371c78d9743125d02baf04e (patch) | |
tree | be8bb660db9c982ac6b0b2add70a82acc01f30b9 /templates | |
parent | ccc71f8f2d4a514f6ffaab2f3bbc76ea423f212b (diff) |
Add support for multiple photos per report.
For Zurich, see mysociety/FixMyStreet-Commercial#664.
This commit includes a new PhotoSet class (NB: called Model:: though not
really a model), should handle binary data (e.g. old style photos in
database), fileids (40-char hash), and Catalyst::Upload objects.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/web/base/report/photo.html | 25 | ||||
-rw-r--r-- | templates/web/zurich/admin/problem_row.html | 6 | ||||
-rw-r--r-- | templates/web/zurich/admin/report_edit.html | 11 | ||||
-rw-r--r-- | templates/web/zurich/report/new/fill_in_details_form.html | 6 |
4 files changed, 34 insertions, 14 deletions
diff --git a/templates/web/base/report/photo.html b/templates/web/base/report/photo.html index c463c34c4..094f677d8 100644 --- a/templates/web/base/report/photo.html +++ b/templates/web/base/report/photo.html @@ -1,8 +1,21 @@ [% IF c.cobrand.allow_photo_display(object) && object.photo %] -[% 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> + [% IF object.can('get_photoset') %] + [% FOR photo IN object.get_photoset(c).images %] + <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 %]"> + <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/zurich/admin/problem_row.html b/templates/web/zurich/admin/problem_row.html index 9b395a1ac..123ff5469 100644 --- a/templates/web/zurich/admin/problem_row.html +++ b/templates/web/zurich/admin/problem_row.html @@ -34,7 +34,11 @@ <td> [% IF problem.photo %] - <img class="img" height="60" width="90" src="[% c.cobrand.base_url %]/photo/[% problem.photo %].temp.jpeg" alt=""> + [% FOR photo IN problem.get_photoset(c).images %] + <div class="update-img"> + <img height="60" width="90" alt="" src="[% c.cobrand.base_url %]/photo/[% photo.0 %].temp.jpeg"> + </div> + [% END %] [% END %] </td> diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index f8da9f211..02c396e1f 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -63,15 +63,16 @@ [% IF problem.photo %] <li> -[% photo = problem.get_photo_params %] +[% FOR photo IN problem.get_photoset(c).images %] <div class="update-img"> - <a href="[% c.cobrand.base_url %]/photo/[% problem.photo %].fulltemp.jpeg" rel="fancy"> - <img alt="Photo of this report" src="[% c.cobrand.base_url %]/photo/[% problem.photo %].temp.jpeg"> + <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"> <span>zoom</span></a> </div> +<input type="submit" name="rotate_photo_[% loop.index %]" value="[% loc('Rotate Left') %]"> +<input type="submit" name="rotate_photo_[% loop.index %]" value="[% loc('Rotate Right') %]"> +[% END %] <br> -<input type="submit" name="rotate_photo" value="[% loc('Rotate Left') %]"> -<input type="submit" name="rotate_photo" value="[% loc('Rotate Right') %]"> <br> <input type="checkbox" id="publish_photo" name="publish_photo" value="1"[% ' checked' IF problem.extra.publish_photo %]> <label class="inline" for="publish_photo">[% loc("Publish photo") %]</label></li> diff --git a/templates/web/zurich/report/new/fill_in_details_form.html b/templates/web/zurich/report/new/fill_in_details_form.html index 56096c9bd..c8c567786 100644 --- a/templates/web/zurich/report/new/fill_in_details_form.html +++ b/templates/web/zurich/report/new/fill_in_details_form.html @@ -58,7 +58,7 @@ <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> [% END %] - <p>[% loc('You have already attached a photo to this report, attaching another one will replace it.') %]</p> + <p>[% loc('You have already attached photos to this report. Note that you can attach a maximum of 3 to this report (if you try to upload more, the oldest will be removed).') %]</p> [% IF report.photo %] <img align="right" src="/photo/[% report.id %].jpeg"> @@ -68,7 +68,9 @@ [% IF field_errors.photo %] <p class='form-error'>[% field_errors.photo %]</p> [% END %] - <input type="file" name="photo" id="form_photo"> + <input type="file" name="photo1" id="form_photo"> + <input type="file" name="photo2" id="form_photo2"> + <input type="file" name="photo3" id="form_photo3"> [% END %] <label for="form_email">[% loc('Your email') %]</label> |