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));
|
||||
echo '
|
||||
<div class="tiled_header" id="', $name, '">
|
||||
<h4 class="tiled_header" id="', $name, '">
|
||||
<a href="#', $name, '">', $header, '</a>
|
||||
</div>';
|
||||
</h4>';
|
||||
|
||||
$this->previous_header = $header;
|
||||
}
|
||||
@ -89,8 +89,11 @@ class PhotosIndex extends SubTemplate
|
||||
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)
|
||||
echo '
|
||||
<a class="edit" href="', BASEURL, '/editasset/?id=', $image->getId(), '">Edit</a>';
|
||||
@ -104,21 +107,15 @@ class PhotosIndex extends SubTemplate
|
||||
<h4>', $image->getTitle(), '</h4>';
|
||||
|
||||
echo '
|
||||
</a>';
|
||||
|
||||
</a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
protected function panorama(array $photos)
|
||||
{
|
||||
foreach ($photos as $image)
|
||||
{
|
||||
echo '
|
||||
<div style="border-color: #', $this->color($image), '" class="panorama">';
|
||||
|
||||
$this->photo($image, static::PANORAMA_WIDTH, static::PANORAMA_HEIGHT, false, false);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
$this->photo($image, 'panorama', static::PANORAMA_WIDTH, static::PANORAMA_HEIGHT, false, false);
|
||||
}
|
||||
|
||||
protected function portrait(array $photos)
|
||||
@ -127,26 +124,16 @@ class PhotosIndex extends SubTemplate
|
||||
|
||||
echo '
|
||||
<div class="tiled_row">
|
||||
<div class="column_portrait">
|
||||
<div style="border-color: #', $this->color($image), '" class="portrait">';
|
||||
<div class="column_portrait">';
|
||||
|
||||
$this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, 'centre');
|
||||
$this->photo($image, 'portrait', static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, 'centre');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<div class="column_tiles_four">';
|
||||
|
||||
foreach ($photos as $image)
|
||||
{
|
||||
echo '
|
||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
||||
|
||||
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, 'centre');
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
$this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, 'centre');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
@ -159,26 +146,16 @@ class PhotosIndex extends SubTemplate
|
||||
|
||||
echo '
|
||||
<div class="tiled_row">
|
||||
<div class="column_landscape">
|
||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
||||
<div class="column_landscape">';
|
||||
|
||||
$this->photo($image, static::LANDSCAPE_WIDTH, static::LANDSCAPE_HEIGHT, 'top');
|
||||
$this->photo($image, 'landscape', static::LANDSCAPE_WIDTH, static::LANDSCAPE_HEIGHT, 'top');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<div class="column_tiles_two">';
|
||||
|
||||
foreach ($photos as $image)
|
||||
{
|
||||
echo '
|
||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
||||
|
||||
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, 'top');
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
$this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, 'top');
|
||||
|
||||
echo '
|
||||
</div>
|
||||
@ -191,15 +168,7 @@ class PhotosIndex extends SubTemplate
|
||||
<div class="tiled_row">';
|
||||
|
||||
foreach ($photos as $image)
|
||||
{
|
||||
echo '
|
||||
<div style="border-color: #', $this->color($image), '" class="duo">';
|
||||
|
||||
$this->photo($image, static::DUO_WIDTH, static::DUO_HEIGHT, true);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
$this->photo($image, 'duo', static::DUO_WIDTH, static::DUO_HEIGHT, true);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
@ -207,16 +176,13 @@ class PhotosIndex extends SubTemplate
|
||||
|
||||
protected function single(array $photos)
|
||||
{
|
||||
echo '
|
||||
<div class="tiled_row">';
|
||||
|
||||
$image = array_shift($photos);
|
||||
$this->photo($image, 'single', static::SINGLE_WIDTH, static::SINGLE_HEIGHT, 'top');
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
@ -226,15 +192,7 @@ class PhotosIndex extends SubTemplate
|
||||
<div class="tiled_row">';
|
||||
|
||||
foreach ($photos as $image)
|
||||
{
|
||||
echo '
|
||||
<div style="border-color: #', $this->color($image), '" class="landscape">';
|
||||
|
||||
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, true);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
$this->photo($image, 'landscape', static::TILE_WIDTH, static::TILE_HEIGHT, true);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
@ -246,15 +204,7 @@ class PhotosIndex extends SubTemplate
|
||||
<div class="tiled_row">';
|
||||
|
||||
foreach ($photos as $image)
|
||||
{
|
||||
echo '
|
||||
<div style="border-color: #', $this->color($image), '" class="portrait">';
|
||||
|
||||
$this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
}
|
||||
$this->photo($image, 'portrait', static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true);
|
||||
|
||||
echo '
|
||||
</div>';
|
||||
|
Loading…
Reference in New Issue
Block a user