Skip to content

Commit

Permalink
Passing filterOpts along to APIs and modal. #1341
Browse files Browse the repository at this point in the history
  • Loading branch information
jmathai committed Oct 24, 2013
1 parent 1e0ddad commit 0b8c8a4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/html/assets/themes/fabrizio1.0/config/settings.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[site]
mediaVersion="do"
mediaVersion="dp"

[behavior]
useDefaultMobile="0"
Expand Down
1 change: 1 addition & 0 deletions src/html/assets/themes/fabrizio1.0/javascripts/fabrizio.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@
routes: {
"p/:id": "photoModal",
"p/:id/*path": "photoModal",
"p/:id?*path": "photoModal",
"photos/list": "photosList",
"photos/*path/list": "photosList"
},
Expand Down
6 changes: 3 additions & 3 deletions src/html/assets/themes/fabrizio1.0/javascripts/op/Lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
//toggleDetails :[68] // d
},

_path: location.pathname+location.search,
_path: location.pathname,
_pathWithQuery: location.pathname+location.search,
_filter: location.pathname.replace('/p/', '/').replace('/photos/', '/').replace('/list', ''),
_query: location.search || '',
_visible: false,
Expand Down Expand Up @@ -240,7 +241,7 @@
this._visible = false;
if(this.$el)
this.$el.fadeOut('fast');
router.navigate(this._path, {silent:true});
router.navigate(this._pathWithQuery, {silent:true});
return this;
},

Expand Down Expand Up @@ -443,7 +444,6 @@
model = op.data.store.Photos.get(id);

if( !model ) return $.error('No image in store with id '+id);

return this.update(model).show();
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/controllers/ApiPhotoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function nextPrevious($id, $filterOpts = null)
{
foreach($photos as $innerKey => $photo)
{
$nextPrevious[$topKey][$innerKey] = $this->photo->addApiUrls($photo, $sizes);
$nextPrevious[$topKey][$innerKey] = $this->photo->addApiUrls($photo, $sizes, null, $filterOpts);
if(!$this->user->isAdmin() && $this->config->site->decreaseLocationPrecision === '1')
{
if(isset($nextPrevious[$topKey][$innerKey]['latitude']))
Expand Down Expand Up @@ -299,7 +299,7 @@ public function list_($filterOpts = null)
// we also can't pass in $photo since it doesn't persist over iterations and removes returnSizes
foreach($photos as $key => $photo)
{
$photos[$key] = $this->photo->addApiUrls($photos[$key], $sizes, $tokenValue);
$photos[$key] = $this->photo->addApiUrls($photos[$key], $sizes, $tokenValue, $filterOpts);
if(!$this->user->isAdmin() && $this->config->site->decreaseLocationPrecision === '1')
{
if(isset($photos[$key]['latitude']))
Expand Down Expand Up @@ -826,7 +826,7 @@ public function view($id, $options = null)
}
}

$photo = $this->photo->addApiUrls($photo, $sizes, $tokenValue);
$photo = $this->photo->addApiUrls($photo, $sizes, $tokenValue, $options);
if(!$this->user->isAdmin() && $this->config->site->decreaseLocationPrecision === '1')
{
if(isset($photo['latitude']))
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/controllers/PhotoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function list_($filterOpts = null)
$photoCount = empty($photos) ? 0 : $photos[0]['totalRows'];
$currentSortParts = (array)explode(',', $params['_GET']['sortBy']);
$currentSortBy = $params['_GET']['sortBy'];
$headingHelper = $this->theme->get($this->utility->getTemplate('partials/photos-sub-heading.php'), array('isAlbum' => $isAlbum, 'currentSortBy' => $currentSortBy, 'sortParts' => $currentSortParts, 'photoCount' => $photoCount));
$headingHelper = $this->theme->get($this->utility->getTemplate('partials/photos-sub-heading.php'), array('isAlbum' => $isAlbum, 'album' => $album, 'currentSortBy' => $currentSortBy, 'sortParts' => $currentSortParts, 'photoCount' => $photoCount));

$body = $this->theme->get($this->utility->getTemplate('photos.php'), array('album' => $album, 'tags' => $tags, 'photos' => $photos, 'pages' => $pages, 'options' => $filterOpts, 'headingHelper' => $headingHelper));
$this->theme->display($this->utility->getTemplate('template.php'), array('body' => $body, 'page' => 'photos', 'album' => $album/* pass album through for header-secondary */));
Expand Down
8 changes: 4 additions & 4 deletions src/libraries/models/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct($params = null)
* @param string $protocol http or https
* @return array
*/
public function addApiUrls($photo, $sizes, $token=null, $protocol=null)
public function addApiUrls($photo, $sizes, $token=null, $filterOpts=null, $protocol=null)
{
if($protocol === null)
$protocol = $this->utility->getProtocol(false);
Expand Down Expand Up @@ -79,7 +79,7 @@ public function addApiUrls($photo, $sizes, $token=null, $protocol=null)
unset($photo['pathOriginal']);
}

$photo['url'] = $this->getPhotoViewUrl($photo);
$photo['url'] = $this->getPhotoViewUrl($photo, $filterOpts);
return $photo;
}

Expand Down Expand Up @@ -774,9 +774,9 @@ private function generateCustomUrl($basePath, $width, $height, $options)
*
* @return array Default values for a new photo
*/
private function getPhotoViewUrl($photo)
private function getPhotoViewUrl($photo, $filterOpts=null)
{
return sprintf('%s://%s%s', $this->utility->getProtocol(false), $this->utility->getHost(false), $this->url->photoView($photo['id'], null, false));
return sprintf('%s://%s%s', $this->utility->getProtocol(false), $this->utility->getHost(false), $this->url->photoView($photo['id'], $filterOpts, false));
}

/**
Expand Down

0 comments on commit 0b8c8a4

Please sign in to comment.