forked from Public/pics
Simplify template logic for photo index.
This commit is contained in:
parent
ed6054e6b6
commit
7d3ab166c7
@ -73,9 +73,9 @@ class PhotosIndex extends SubTemplate
|
|||||||
|
|
||||||
$name = str_replace(' ', '', strtolower($header));
|
$name = str_replace(' ', '', strtolower($header));
|
||||||
echo '
|
echo '
|
||||||
<div class="tiled_header" id="', $name, '">
|
<h4 class="tiled_header" id="', $name, '">
|
||||||
<a href="#', $name, '">', $header, '</a>
|
<a href="#', $name, '">', $header, '</a>
|
||||||
</div>';
|
</h4>';
|
||||||
|
|
||||||
$this->previous_header = $header;
|
$this->previous_header = $header;
|
||||||
}
|
}
|
||||||
@ -89,8 +89,11 @@ class PhotosIndex extends SubTemplate
|
|||||||
return $color;
|
return $color;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function photo(Image $image, $width, $height, $crop = true, $fit = true)
|
protected function photo(Image $image, $className, $width, $height, $crop = true, $fit = true)
|
||||||
{
|
{
|
||||||
|
echo '
|
||||||
|
<div class="', $className, '" style="border-color: #', $this->color($image), '">';
|
||||||
|
|
||||||
if ($this->show_edit_buttons)
|
if ($this->show_edit_buttons)
|
||||||
echo '
|
echo '
|
||||||
<a class="edit" href="', BASEURL, '/editasset/?id=', $image->getId(), '">Edit</a>';
|
<a class="edit" href="', BASEURL, '/editasset/?id=', $image->getId(), '">Edit</a>';
|
||||||
@ -104,21 +107,15 @@ class PhotosIndex extends SubTemplate
|
|||||||
<h4>', $image->getTitle(), '</h4>';
|
<h4>', $image->getTitle(), '</h4>';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</a>';
|
|
||||||
|
</a>
|
||||||
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function panorama(array $photos)
|
protected function panorama(array $photos)
|
||||||
{
|
{
|
||||||
foreach ($photos as $image)
|
foreach ($photos as $image)
|
||||||
{
|
$this->photo($image, 'panorama', static::PANORAMA_WIDTH, static::PANORAMA_HEIGHT, false, false);
|
||||||
echo '
|
|
||||||
<div style="border-color: #', $this->color($image), '" class="panorama">';
|
|
||||||
|
|
||||||
$this->photo($image, static::PANORAMA_WIDTH, static::PANORAMA_HEIGHT, false, false);
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function portrait(array $photos)
|
protected function portrait(array $photos)
|
||||||
@ -127,26 +124,16 @@ class PhotosIndex extends SubTemplate
|
|||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="tiled_row">
|
<div class="tiled_row">
|
||||||
<div class="column_portrait">
|
<div class="column_portrait">';
|
||||||
<div style="border-color: #', $this->color($image), '" class="portrait">';
|
|
||||||
|
|
||||||
$this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, 'centre');
|
$this->photo($image, 'portrait', static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, 'centre');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="column_tiles_four">';
|
<div class="column_tiles_four">';
|
||||||
|
|
||||||
foreach ($photos as $image)
|
foreach ($photos as $image)
|
||||||
{
|
$this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, 'centre');
|
||||||
echo '
|
|
||||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
|
||||||
|
|
||||||
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, 'centre');
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>
|
</div>
|
||||||
@ -159,26 +146,16 @@ class PhotosIndex extends SubTemplate
|
|||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="tiled_row">
|
<div class="tiled_row">
|
||||||
<div class="column_landscape">
|
<div class="column_landscape">';
|
||||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
|
||||||
|
|
||||||
$this->photo($image, static::LANDSCAPE_WIDTH, static::LANDSCAPE_HEIGHT, 'top');
|
$this->photo($image, 'landscape', static::LANDSCAPE_WIDTH, static::LANDSCAPE_HEIGHT, 'top');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="column_tiles_two">';
|
<div class="column_tiles_two">';
|
||||||
|
|
||||||
foreach ($photos as $image)
|
foreach ($photos as $image)
|
||||||
{
|
$this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, 'top');
|
||||||
echo '
|
|
||||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
|
||||||
|
|
||||||
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, 'top');
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>
|
</div>
|
||||||
@ -191,15 +168,7 @@ class PhotosIndex extends SubTemplate
|
|||||||
<div class="tiled_row">';
|
<div class="tiled_row">';
|
||||||
|
|
||||||
foreach ($photos as $image)
|
foreach ($photos as $image)
|
||||||
{
|
$this->photo($image, 'duo', static::DUO_WIDTH, static::DUO_HEIGHT, true);
|
||||||
echo '
|
|
||||||
<div style="border-color: #', $this->color($image), '" class="duo">';
|
|
||||||
|
|
||||||
$this->photo($image, static::DUO_WIDTH, static::DUO_HEIGHT, true);
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
@ -207,16 +176,13 @@ class PhotosIndex extends SubTemplate
|
|||||||
|
|
||||||
protected function single(array $photos)
|
protected function single(array $photos)
|
||||||
{
|
{
|
||||||
|
echo '
|
||||||
|
<div class="tiled_row">';
|
||||||
|
|
||||||
$image = array_shift($photos);
|
$image = array_shift($photos);
|
||||||
|
$this->photo($image, 'single', static::SINGLE_WIDTH, static::SINGLE_HEIGHT, 'top');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="tiled_row">
|
|
||||||
<div style="border-color: #', $this->color($image), '" class="single">';
|
|
||||||
|
|
||||||
$this->photo($image, static::SINGLE_WIDTH, static::SINGLE_HEIGHT, 'top');
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,15 +192,7 @@ class PhotosIndex extends SubTemplate
|
|||||||
<div class="tiled_row">';
|
<div class="tiled_row">';
|
||||||
|
|
||||||
foreach ($photos as $image)
|
foreach ($photos as $image)
|
||||||
{
|
$this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, true);
|
||||||
echo '
|
|
||||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
|
||||||
|
|
||||||
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, true);
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
@ -246,15 +204,7 @@ class PhotosIndex extends SubTemplate
|
|||||||
<div class="tiled_row">';
|
<div class="tiled_row">';
|
||||||
|
|
||||||
foreach ($photos as $image)
|
foreach ($photos as $image)
|
||||||
{
|
$this->photo($image, 'portrait', static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true);
|
||||||
echo '
|
|
||||||
<div style="border-color: #', $this->color($image), '" class="portrait">';
|
|
||||||
|
|
||||||
$this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true);
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>';
|
</div>';
|
||||||
|
Loading…
Reference in New Issue
Block a user