From eb031e7ee26bcd47762b9407986a71a565e8f749 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 10 Jan 2018 16:08:39 +0100 Subject: [PATCH] rename the "save" button to 'follow' when searching for tags --- include/text.php | 26 ++++++++++++++++++------- view/theme/frio/templates/searchbox.tpl | 7 ++++++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/include/text.php b/include/text.php index 7ed561bbbb..838785eaac 100644 --- a/include/text.php +++ b/include/text.php @@ -1033,22 +1033,34 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { } /** - * search box + * @brief Search box. * - * @param string $s search query - * @param string $id html id - * @param string $url search url - * @param boolean $savedsearch show save search button + * @param string $s Search query. + * @param string $id HTML id + * @param string $url Search url. + * @param bool $save Show save search button. + * @param bool $aside Display the search widgit aside. + * + * @return string Formatted HTML. */ -function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = true) { +function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = true) +{ + $mode = 'text'; + + if (strpos($s, '#') === 0) { + $mode = 'tag'; + } + $save_label = $mode === 'text' ? t('Save') : t('Follow'); + $values = array( '$s' => htmlspecialchars($s), '$id' => $id, '$action_url' => $url, '$search_label' => t('Search'), - '$save_label' => t('Save'), + '$save_label' => $save_label, '$savedsearch' => Feature::isEnabled(local_user(),'savedsearch'), '$search_hint' => t('@name, !forum, #tags, content'), + '$mode' => $mode ); if (!$aside) { diff --git a/view/theme/frio/templates/searchbox.tpl b/view/theme/frio/templates/searchbox.tpl index d95d1a4114..5c80f9b6a3 100644 --- a/view/theme/frio/templates/searchbox.tpl +++ b/view/theme/frio/templates/searchbox.tpl @@ -50,7 +50,12 @@ Some parts of this template will be moved by js to other places (see theme.js) - {{if $savedsearch}}
- + {{* In dependence of the search content we show different buttons *}} + {{if $mode == "tag"}} + + {{else}} + + {{/if}}
{{/if}} -- 2.39.5