forked from Public/pics
PhotosIndex: replace edit button with edit menu
This commit is contained in:
@@ -81,6 +81,28 @@ class PhotosIndex extends Template
|
||||
$this->previous_header = $header;
|
||||
}
|
||||
|
||||
protected function editMenu(Image $image)
|
||||
{
|
||||
echo '
|
||||
<div class="edit dropdown">
|
||||
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="', $image->getEditUrl(), '">Edit image</a></li>
|
||||
<li><a class="dropdown-item" href="', $image->getDeleteUrl(), '&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'" onclick="return confirm(\'Are you sure you want to delete this image?\');',
|
||||
'">Delete image</a></li>
|
||||
<li><a class="dropdown-item" href="', $image->getEditUrl(), '&inc_prio&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'">Increase priority</a></li>
|
||||
<li><a class="dropdown-item" href="', $image->getEditUrl(), '&dec_prio&',
|
||||
Session::getSessionTokenKey(), '=', Session::getSessionToken(),
|
||||
'">Decrease priority</a></li>
|
||||
</ul>
|
||||
</div>';
|
||||
}
|
||||
|
||||
protected function photo(Image $image, $className, $width, $height, $crop = true, $fit = true)
|
||||
{
|
||||
// Prefer thumbnail aspect ratio if available, otherwise use image aspect ratio.
|
||||
@@ -90,8 +112,7 @@ class PhotosIndex extends Template
|
||||
<div class="polaroid ', $className, '" style="aspect-ratio: ', $aspectRatio, '">';
|
||||
|
||||
if ($this->show_edit_buttons)
|
||||
echo '
|
||||
<a class="edit" href="', BASEURL, '/editasset/?id=', $image->getId(), '">Edit</a>';
|
||||
$this->editMenu($image);
|
||||
|
||||
echo '
|
||||
<a href="', $image->getPageUrl(), $this->url_suffix, '#photo_frame">';
|
||||
|
||||
Reference in New Issue
Block a user