Merge pull request #7737 from MrPetovan/task/4090-move-search-to-src
Saved Search fixes
This commit is contained in:
commit
05c4fd9daa
12 changed files with 20 additions and 23 deletions
|
@ -912,7 +912,7 @@ class HTML
|
||||||
'$save_label' => $save_label,
|
'$save_label' => $save_label,
|
||||||
'$search_hint' => L10n::t('@name, !forum, #tags, content'),
|
'$search_hint' => L10n::t('@name, !forum, #tags, content'),
|
||||||
'$mode' => $mode,
|
'$mode' => $mode,
|
||||||
'$return_url' => urlencode('search?q=' . $s),
|
'$return_url' => urlencode('search?q=' . urlencode($s)),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$aside) {
|
if (!$aside) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Index extends BaseSearchModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
self::getApp()->page['aside'] .= Widget\SavedSearches::getHTML('search?q=' . $search, $search);
|
self::getApp()->page['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nav::setSelected('search');
|
Nav::setSelected('search');
|
||||||
|
|
|
@ -10,17 +10,17 @@ use Friendica\Util\Strings;
|
||||||
|
|
||||||
class Saved extends BaseModule
|
class Saved extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function init()
|
||||||
{
|
{
|
||||||
/** @var Arguments $args */
|
/** @var Arguments $args */
|
||||||
$args = self::getClass(Arguments::class);
|
$args = self::getClass(Arguments::class);
|
||||||
|
|
||||||
$action = $args->get(2, 'none');
|
$action = $args->get(2, 'none');
|
||||||
$search = Strings::escapeTags(trim(rawurldecode($args->get(3, ''))));
|
$search = Strings::escapeTags(trim(rawurldecode($_GET['term'] ?? '')));
|
||||||
|
|
||||||
$return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search);
|
$return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search);
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user() && $search) {
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'add':
|
case 'add':
|
||||||
$fields = ['uid' => local_user(), 'term' => $search];
|
$fields = ['uid' => local_user(), 'term' => $search];
|
||||||
|
|
|
@ -191,8 +191,8 @@ return [
|
||||||
'/search' => [
|
'/search' => [
|
||||||
'[/]' => [Module\Search\Index::class, [R::GET]],
|
'[/]' => [Module\Search\Index::class, [R::GET]],
|
||||||
'/acl' => [Module\Search\Acl::class, [R::GET, R::POST]],
|
'/acl' => [Module\Search\Acl::class, [R::GET, R::POST]],
|
||||||
'/saved/add/{term}' => [Module\Search\Saved::class, [R::GET]],
|
'/saved/add' => [Module\Search\Saved::class, [R::GET]],
|
||||||
'/saved/remove/{term}' => [Module\Search\Saved::class, [R::GET]],
|
'/saved/remove' => [Module\Search\Saved::class, [R::GET]],
|
||||||
],
|
],
|
||||||
|
|
||||||
'/settings' => [
|
'/settings' => [
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<input type="submit" name="submit" id="search-submit" value="{{$search_label}}"/>
|
<input type="submit" name="submit" id="search-submit" value="{{$search_label}}"/>
|
||||||
{{if $s}}
|
{{if $s}}
|
||||||
<a href="search/saved/add/{{$q}}?return_url={{$return_url}}">{{$save_label}}</a>
|
<a href="search/saved/add?term={{$q}}&return_url={{$return_url}}">{{$save_label}}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/strip}}
|
{{/strip}}
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<ul role="menu" id="saved-search-ul">
|
<ul role="menu" id="saved-search-ul">
|
||||||
{{foreach $saved as $search}}
|
{{foreach $saved as $search}}
|
||||||
<li role="menuitem" class="saved-search-li clear">
|
<li role="menuitem" class="saved-search-li clear">
|
||||||
<a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="iconspacer savedsearchdrop"></a>
|
<a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="iconspacer savedsearchdrop"></a>
|
||||||
<a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
|
<a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
|
||||||
</li>
|
</li>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
@ -2312,7 +2312,7 @@ ul.dropdown-menu li:hover {
|
||||||
.search-content-wrapper > .section-title-wrapper {
|
.search-content-wrapper > .section-title-wrapper {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#navbar-button > #search-save-form > #search-save {
|
#navbar-button > #search-save {
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
}
|
}
|
||||||
/* Section-Content-Wrapper */
|
/* Section-Content-Wrapper */
|
||||||
|
|
|
@ -169,7 +169,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the "Save the search" button to the second navbar
|
// move the "Save the search" button to the second navbar
|
||||||
$(".search-content-wrapper #search-save-form ").appendTo("#topbar-second > .container > #navbar-button");
|
$(".search-content-wrapper #search-save").appendTo("#topbar-second > .container > #navbar-button");
|
||||||
|
|
||||||
// append the vcard-short-info to the second nav after passing the element
|
// append the vcard-short-info to the second nav after passing the element
|
||||||
// with .fn (vcard username). Use scrollspy to get the scroll position.
|
// with .fn (vcard username). Use scrollspy to get the scroll position.
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
<form class="navbar-form" role="search" method="get" action="{{$nav.search.0}}">
|
<form class="navbar-form" role="search" method="get" action="{{$nav.search.0}}">
|
||||||
<!-- <img class="hidden-xs" src="{{$nav.userinfo.icon}}" alt="{{$nav.userinfo.name}}" style="max-width:33px; max-height:33px; min-width:33px; min-height:33px; width:33px; height:33px;"> -->
|
<!-- <img class="hidden-xs" src="{{$nav.userinfo.icon}}" alt="{{$nav.userinfo.name}}" style="max-width:33px; max-height:33px; min-width:33px; min-height:33px; width:33px; height:33px;"> -->
|
||||||
<div class="form-group form-group-search">
|
<div class="form-group form-group-search">
|
||||||
<input accesskey="s" id="nav-search-input-field" class="form-control form-search" type="text" name="search" data-toggle="tooltip" title="{{$search_hint}}" placeholder="{{$nav.search.1}}">
|
<input accesskey="s" id="nav-search-input-field" class="form-control form-search" type="text" name="q" data-toggle="tooltip" title="{{$search_hint}}" placeholder="{{$nav.search.1}}">
|
||||||
<button class="btn btn-default btn-sm form-button-search" type="submit">{{$nav.search.1}}</button>
|
<button class="btn btn-default btn-sm form-button-search" type="submit">{{$nav.search.1}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -18,7 +18,7 @@ Some parts of this template will be moved by js to other places (see theme.js) -
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
{{* The button to save searches *}}
|
{{* The button to save searches *}}
|
||||||
{{if $s}}
|
{{if $s}}
|
||||||
<a href="search/saved/add/{{$q}}?return_url={{$return_url}}" class="btn btn-primary btn-small pull-right">{{$save_label}}</a>
|
<a href="search/saved/add?term={{$q}}&return_url={{$return_url}}" class="btn btn-primary btn-small pull-right">{{$save_label}}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* The select popup menu to select what kind of results the user would like to search for *}}
|
{{* The select popup menu to select what kind of results the user would like to search for *}}
|
||||||
|
@ -46,16 +46,13 @@ Some parts of this template will be moved by js to other places (see theme.js) -
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $s}}
|
{{if $s}}
|
||||||
<form id="search-save-form" action="search/saved/add/{{$q}}" method="get">
|
<a href="search/saved/add?term={{$q}}&return_url={{$return_url}}" class="btn btn-sm btn-main pull-right" id="search-save" title="{{$save_label}}" aria-label="{{$save_label}}" value="{{$save_label}}" data-toggle="tooltip">
|
||||||
<input type="hidden" name="return_url" value="{{$return_url}}">
|
|
||||||
<button class="btn btn-sm btn-main pull-right" type="submit" id="search-save" title="{{$save_label}}" aria-label="{{$save_label}}" value="{{$save_label}}" data-toggle="tooltip">
|
|
||||||
{{if $mode == "tag"}}
|
{{if $mode == "tag"}}
|
||||||
<i class="fa fa-plus fa-2x" aria-hidden="true"></i>
|
<i class="fa fa-plus fa-2x" aria-hidden="true"></i>
|
||||||
{{else}}
|
{{else}}
|
||||||
<i class="fa fa-floppy-o fa-2x" aria-hidden="true"></i>
|
<i class="fa fa-floppy-o fa-2x" aria-hidden="true"></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="sr-only">{{$save_label}}</span>
|
<span class="sr-only">{{$save_label}}</span>
|
||||||
</button>
|
</a>
|
||||||
</form>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<ul role="menu" id="saved-search-ul">
|
<ul role="menu" id="saved-search-ul">
|
||||||
{{foreach $saved as $search}}
|
{{foreach $saved as $search}}
|
||||||
<li role="menuitem" class="saved-search-li clear">
|
<li role="menuitem" class="saved-search-li clear">
|
||||||
<a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right widget-action faded-icon">
|
<a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right widget-action faded-icon">
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
|
<a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{{foreach $saved as $search}}
|
{{foreach $saved as $search}}
|
||||||
<li class="tool {{if $search.selected}}selected{{/if}}">
|
<li class="tool {{if $search.selected}}selected{{/if}}">
|
||||||
<a href="search?q={{$search.encodedterm}}" class="label">{{$search.term}}</a>
|
<a href="search?q={{$search.encodedterm}}" class="label">{{$search.term}}</a>
|
||||||
<a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" class="action icon s10 delete" title="{{$search.delete}}" onclick="return confirmDelete();"></a>
|
<a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" class="action icon s10 delete" title="{{$search.delete}}" onclick="return confirmDelete();"></a>
|
||||||
</li>
|
</li>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in a new issue