aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Photo.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/App/Model/PhotoSet.pm4
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm10
-rw-r--r--templates/web/base/admin/report_edit.html2
-rw-r--r--templates/web/base/report/photo.html2
-rw-r--r--templates/web/zurich/admin/problem_row.html2
-rw-r--r--templates/web/zurich/admin/report_edit-sdm.html2
-rw-r--r--templates/web/zurich/admin/report_edit.html2
10 files changed, 15 insertions, 19 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index f2d6040ae..c42916acb 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -1498,7 +1498,7 @@ sub rotate_photo : Private {
return unless $direction eq _('Rotate Left') or $direction eq _('Rotate Right');
my $problem = $c->stash->{problem};
- my $fileid = $problem->get_photoset($c)->rotate_image(
+ my $fileid = $problem->get_photoset->rotate_image(
$index,
$direction eq _('Rotate Left') ? -90 : 90
) or return;
@@ -1529,7 +1529,7 @@ sub remove_photo : Private {
if ($keys eq 'ALL') {
$object->photo(undef);
} else {
- my $fileids = $object->get_photoset($c)->remove_images($keys);
+ my $fileids = $object->get_photoset->remove_images($keys);
$object->photo($fileids);
}
return 1;
diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm
index f4866cc26..5a5771488 100644
--- a/perllib/FixMyStreet/App/Controller/Photo.pm
+++ b/perllib/FixMyStreet/App/Controller/Photo.pm
@@ -74,8 +74,8 @@ sub index :LocalRegex('^(c/)?(\d+)(?:\.(\d+))?(?:\.(full|tn|fp))?\.jpeg$') {
my $photo;
if ($item->can('get_photoset')) {
- $photo = $item->get_photoset( $c )
- ->get_image_data( num => $photo_number, size => $size )
+ $photo = $item->get_photoset
+ ->get_image_data( num => $photo_number, size => $size, default => $c->cobrand->default_photo_resize )
or $c->detach( 'no_photo' );
} else {
$photo = $item->photo;
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 4632f450d..db524ada4 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -449,7 +449,7 @@ sub initialize_report : Private {
$c->stash->{partial_token} = $token if $report;
# Stash the photo IDs for "already got" display
- $c->stash->{upload_fileid} = $report->get_photoset($c)->data;
+ $c->stash->{upload_fileid} = $report->get_photoset->data;
} else {
# no point keeping it if it is done.
diff --git a/perllib/FixMyStreet/App/Model/PhotoSet.pm b/perllib/FixMyStreet/App/Model/PhotoSet.pm
index 7b95e93d4..9abe1dce7 100644
--- a/perllib/FixMyStreet/App/Model/PhotoSet.pm
+++ b/perllib/FixMyStreet/App/Model/PhotoSet.pm
@@ -222,7 +222,7 @@ sub get_image_data {
} elsif ( $size eq 'full' ) {
# do nothing
} else {
- $photo = _shrink( $photo, $self->c->cobrand->default_photo_resize || '250x250' );
+ $photo = _shrink( $photo, $args{default} || '250x250' );
}
return $photo;
@@ -252,7 +252,6 @@ sub remove_images {
my $new_set = (ref $self)->new({
data_items => \@items,
- c => $self->c,
object => $self->object,
});
@@ -272,7 +271,6 @@ sub rotate_image {
my $new_set = (ref $self)->new({
data_items => \@items,
- c => $self->c,
object => $self->object,
});
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 237785820..745d88629 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -487,9 +487,8 @@ sub admin_url {
Returns a hashref of details of the attached photo, if any, for use in templates.
-NB: this method doesn't currently support multiple photos gracefully.
-
-Use get_photoset($c) instead to do the right thing with reports with 0, 1, or more photos.
+NB: this method only returns the first if there are multiple photos. Use
+get_photoset if you wish to access multiple photos.
=cut
@@ -858,18 +857,17 @@ sub latest_moderation_log_entry {
Return a PhotoSet object for all photos attached to this field
- my $photoset = $obj->get_photoset( $c );
+ my $photoset = $obj->get_photoset;
print $photoset->num_images;
return $photoset->get_image_data(num => 0, size => 'full');
=cut
sub get_photoset {
- my ($self, $c) = @_;
+ my ($self) = @_;
my $class = 'FixMyStreet::App::Model::PhotoSet';
eval "use $class";
return $class->new({
- c => $c,
db_data => $self->photo,
object => $self,
});
diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html
index 8cb513be8..72e2c56db 100644
--- a/templates/web/base/admin/report_edit.html
+++ b/templates/web/base/admin/report_edit.html
@@ -79,7 +79,7 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
[% IF problem.photo %]
<li>
<ul>
- [% FOR photo IN problem.get_photoset(c).images %]
+ [% FOR photo IN problem.get_photoset.images %]
<li>
<div class="update-img">
<a href="[% c.cobrand.base_url %]/photo/[% photo.0 %].fulltemp.jpeg" rel="fancy">
diff --git a/templates/web/base/report/photo.html b/templates/web/base/report/photo.html
index 094f677d8..4114fad72 100644
--- a/templates/web/base/report/photo.html
+++ b/templates/web/base/report/photo.html
@@ -1,6 +1,6 @@
[% IF c.cobrand.allow_photo_display(object) && object.photo %]
[% IF object.can('get_photoset') %]
- [% FOR photo IN object.get_photoset(c).images %]
+ [% FOR photo IN object.get_photoset.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 %]">
diff --git a/templates/web/zurich/admin/problem_row.html b/templates/web/zurich/admin/problem_row.html
index baa8d3ac7..8a26f28ae 100644
--- a/templates/web/zurich/admin/problem_row.html
+++ b/templates/web/zurich/admin/problem_row.html
@@ -36,7 +36,7 @@
<td>
[% IF problem.photo %]
- [% FOR photo IN problem.get_photoset(c).images %]
+ [% FOR photo IN problem.get_photoset.images %]
<div class="update-img">
<img height="60" width="90" alt="" src="[% c.cobrand.base_url %]/photo/[% photo.0 %].temp.jpeg">
</div>
diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html
index 8e576a718..1d1b60e56 100644
--- a/templates/web/zurich/admin/report_edit-sdm.html
+++ b/templates/web/zurich/admin/report_edit-sdm.html
@@ -82,7 +82,7 @@
[% IF problem.photo %]
<dd>
- [% FOR photo IN problem.get_photoset(c).images %]
+ [% FOR photo IN problem.get_photoset.images %]
<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">
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
index 64d0950ee..239646f6c 100644
--- a/templates/web/zurich/admin/report_edit.html
+++ b/templates/web/zurich/admin/report_edit.html
@@ -106,7 +106,7 @@
[% IF problem.photo %]
<dd>
- [% FOR photo IN problem.get_photoset(c).images %]
+ [% FOR photo IN problem.get_photoset.images %]
<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">