Add bookmark item search (#15)

- Implement form styling throughout
- Modify header links for narrower views
- Clean up CSS
This commit is contained in:
2024-05-26 16:56:30 -04:00
parent 9d59bfb1c6
commit 58dd7a4ffb
6 changed files with 116 additions and 58 deletions

View File

@@ -138,13 +138,16 @@ class ItemList {
* Create an item list with items matching given search terms
*
* @param string $search The item search terms / query
* @param bool $isBookmarked Whether to restrict the search to bookmarked items
* @param SQLite3 $db The database connection to use to obtain items
* @return static An item list match the given search terms
*/
public static function matchingSearch(string $search, SQLite3 $db): static {
$list = new static($db,
self::makeQuery($db, ['item.id IN (SELECT ROWID FROM item_search WHERE content MATCH :search)'],
[[':search', $search]]), 'Matching', "/search?search=$search");
public static function matchingSearch(string $search, bool $isBookmarked, SQLite3 $db): static {
$where = $isBookmarked ? ['item.is_bookmarked = 1'] : [];
$where[] = 'item.id IN (SELECT ROWID FROM item_search WHERE content MATCH :search)';
$list = new static($db, self::makeQuery($db, $where, [[':search', $search]]),
'Matching' . ($isBookmarked ? ' Bookmarked' : ''),
"/search?search=$search&items=" . ($isBookmarked ? 'bookmarked' : 'all'));
$list->showIndicators = true;
$list->displayFeed = true;
return $list;