diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2012-12-14 09:46:53 -0800 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2012-12-14 09:46:53 -0800 |
| commit | 5905dc554ae79c6249768d323d73e5acf74916ef (patch) | |
| tree | ec89c8645b7d40d27dab7b7d0e8ef6f96a73820a /modules/search/views | |
| parent | b0618aab7a72eb0e5495e3c5f4d2a57f343c0076 (diff) | |
| parent | f5420b4eab76b9846528dfee507cacce93a29ecb (diff) | |
Merge pull request #76 from chilversc/search-filter-album
Search within current album. Resolves #1402
Diffstat (limited to 'modules/search/views')
| -rw-r--r-- | modules/search/views/search.html.php | 12 | ||||
| -rw-r--r-- | modules/search/views/search_link.html.php | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/modules/search/views/search.html.php b/modules/search/views/search.html.php index 4279cbab..f1906744 100644 --- a/modules/search/views/search.html.php +++ b/modules/search/views/search.html.php @@ -8,6 +8,7 @@ <ul> <li> <label for="q"><?= t("Search the gallery") ?></label> + <input name="album" type="hidden" value="<?= html::clean_attribute($album->id) ?>" /> <input name="q" id="q" type="text" value="<?= html::clean_attribute($q) ?>" class="text" /> </li> <li> @@ -20,6 +21,17 @@ <div id="g-search-results"> <h1><?= t("Search results") ?></h1> + <? if ($album->id == item::root()->id): ?> + <div> + <?= t("Searched the whole gallery.") ?> + </div> + <? else: ?> + <div> + <?= t("Searched within album <b>%album</b>.", array("album" => html::purify($album->title))) ?> + <a href="<?= url::site(url::merge(array("album" => item::root()->id))) ?>"><?= t("Search whole gallery") ?></a> + </div> + <? endif; ?> + <? if (count($items)): ?> <ul id="g-album-grid" class="ui-helper-clearfix"> <? foreach ($items as $item): ?> diff --git a/modules/search/views/search_link.html.php b/modules/search/views/search_link.html.php index dd3a76a4..b2eacd4a 100644 --- a/modules/search/views/search_link.html.php +++ b/modules/search/views/search_link.html.php @@ -9,4 +9,11 @@ <input type="submit" value="<?= t("Go")->for_html_attr() ?>" class="submit" /> </li> </ul> + <? if (isset($item) && $item instanceof Item_Model_Core): ?> + <? if ($item->is_album ()): ?> + <input type="hidden" name="album" value="<?= $item->id ?>" /> + <? else: ?> + <input type="hidden" name="album" value="<?= $item->parent_id ?>" /> + <? endif; ?> + <? endif; ?> </form> |
