Allow users to filter albums by contributors #48

Merged
Roflin merged 18 commits from refactor/viewalbum into master 2024-01-20 20:11:18 +01:00
2 changed files with 24 additions and 15 deletions
Showing only changes of commit 9c00248a7f - Show all commits

View File

@ -47,7 +47,10 @@ class ViewPhotoAlbum extends HTMLController
$contributors = $tag->getContributorList(); $contributors = $tag->getContributorList();
// Enumerate possible filters // Enumerate possible filters
$filters = ['' => ['id_user' => null, 'caption' => 'Show all photos', 'link' => $tag->getUrl()]]; $filters = [];
if (!empty($contributors))
{
$filters[''] = ['id_user' => null, 'caption' => 'Show all photos', 'link' => $tag->getUrl()];
foreach ($contributors as $contributor) foreach ($contributors as $contributor)
{ {
$filters[$contributor['slug']] = [ $filters[$contributor['slug']] = [
@ -57,6 +60,7 @@ class ViewPhotoAlbum extends HTMLController
'link' => $tag->getUrl() . '/?by=' . $contributor['slug'], 'link' => $tag->getUrl() . '/?by=' . $contributor['slug'],
]; ];
} }
}
// Limit to a particular uploader? // Limit to a particular uploader?
$active_filter = ''; $active_filter = '';

View File

@ -28,6 +28,8 @@ class AlbumButtonBox extends Template
echo ' echo '
<a class="btn btn-light" href="', $button['url'], '">', $button['caption'], '</a>'; <a class="btn btn-light" href="', $button['url'], '">', $button['caption'], '</a>';
if (!empty($this->filters))
{
echo ' echo '
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
@ -47,7 +49,10 @@ class AlbumButtonBox extends Template
echo ' echo '
</ul> </ul>
</div> </div>';
}
echo '
</div>'; </div>';
} }
} }