mirror of
https://github.com/friendica/friendica
synced 2024-12-23 16:00:16 +00:00
Merge pull request #2574 from rabuzarus/0607-saved-search
provide a general content wrapper + frio saved searches
This commit is contained in:
commit
d034822f07
7 changed files with 121 additions and 10 deletions
|
@ -975,6 +975,7 @@ function search($s,$id='search-box',$url='search',$save = false, $aside = true)
|
||||||
'$search_label' => t('Search'),
|
'$search_label' => t('Search'),
|
||||||
'$save_label' => t('Save'),
|
'$save_label' => t('Save'),
|
||||||
'$savedsearch' => feature_enabled(local_user(),'savedsearch'),
|
'$savedsearch' => feature_enabled(local_user(),'savedsearch'),
|
||||||
|
'$search_hint' => t('@name, !forum, #tags, content'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$aside) {
|
if (!$aside) {
|
||||||
|
|
|
@ -132,9 +132,6 @@ function search_content(&$a) {
|
||||||
|
|
||||||
nav_set_selected('search');
|
nav_set_selected('search');
|
||||||
|
|
||||||
|
|
||||||
$o = '<h3>' . t('Search') . '</h3>';
|
|
||||||
|
|
||||||
if(x($a->data,'search'))
|
if(x($a->data,'search'))
|
||||||
$search = notags(trim($a->data['search']));
|
$search = notags(trim($a->data['search']));
|
||||||
else
|
else
|
||||||
|
@ -146,8 +143,13 @@ function search_content(&$a) {
|
||||||
$search = ((x($_GET,'tag')) ? notags(trim(rawurldecode($_GET['tag']))) : '');
|
$search = ((x($_GET,'tag')) ? notags(trim(rawurldecode($_GET['tag']))) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// contruct a wrapper for the search header
|
||||||
$o .= search($search,'search-box','search',((local_user()) ? true : false), false);
|
$o .= replace_macros(get_markup_template("content_wrapper.tpl"),array(
|
||||||
|
'name' => "search-header",
|
||||||
|
'$title' => t("Search"),
|
||||||
|
'$title_size' => 3,
|
||||||
|
'$content' => search($search,'search-box','search',((local_user()) ? true : false), false)
|
||||||
|
));
|
||||||
|
|
||||||
if(strpos($search,'#') === 0) {
|
if(strpos($search,'#') === 0) {
|
||||||
$tag = true;
|
$tag = true;
|
||||||
|
@ -160,7 +162,7 @@ function search_content(&$a) {
|
||||||
return dirfind_content($a);
|
return dirfind_content($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(x($_GET,'search-option'))
|
if(x($_GET,'search-option'))
|
||||||
switch($_GET['search-option']) {
|
switch($_GET['search-option']) {
|
||||||
case 'fulltext':
|
case 'fulltext':
|
||||||
break;
|
break;
|
||||||
|
|
12
view/templates/content_wrapper.tpl
Normal file
12
view/templates/content_wrapper.tpl
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
<div {{if $name}}id="{{$name}}-wrapper"{{/if}} class="general-content-wrapper">
|
||||||
|
{{* give different possibilities for the size of the heading *}}
|
||||||
|
{{if $title && $title_size}}
|
||||||
|
<h{{$title_size}} {{if $name}}id="{{$name}}-heading"{{/if}}>{{$title}}</h{{$title_size}}>
|
||||||
|
{{elseif $title}}
|
||||||
|
{{include file="section_title.tpl"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* output the content *}}
|
||||||
|
{{$content}}
|
||||||
|
</div>
|
|
@ -138,6 +138,12 @@ a#item-delete-selected {
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
.btn-small {
|
||||||
|
padding: 6px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
background: $nav_bg;
|
background: $nav_bg;
|
||||||
color: $btn_primary_color !important;
|
color: $btn_primary_color !important;
|
||||||
|
@ -186,6 +192,13 @@ a#item-delete-selected {
|
||||||
background: $link_hover_color;
|
background: $link_hover_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-control-sm, .input-group-sm>.form-control, .input-group-sm>.input-group-addon, .input-group-sm>.input-group-btn>.btn {
|
||||||
|
padding: .275rem .75rem;
|
||||||
|
/*font-size: .875rem;*/
|
||||||
|
line-height: 1.5;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: .2rem;
|
||||||
|
}
|
||||||
/* Bootstrap media class fix/hack
|
/* Bootstrap media class fix/hack
|
||||||
* This is a test. I thought it does have some
|
* This is a test. I thought it does have some
|
||||||
* issues in some corner cases. Maybe we remove
|
* issues in some corner cases. Maybe we remove
|
||||||
|
@ -939,15 +952,18 @@ aside #follow-sidebar .form-group-search .form-button-search {
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
aside #group-sidebar .group-edit-tool {
|
aside #group-sidebar .group-edit-tool,
|
||||||
|
aside #saved-search-list .savedsearchdrop {
|
||||||
opacity: 0.1;
|
opacity: 0.1;
|
||||||
transition: all 0.25s ease-in-out;
|
transition: all 0.25s ease-in-out;
|
||||||
}
|
}
|
||||||
aside #group-sidebar .sidebar-group-li:hover .group-edit-tool {
|
aside #group-sidebar .sidebar-group-li:hover .group-edit-tool,
|
||||||
|
aside #saved-search-list .saved-search-li:hover .savedsearchdrop {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
transition: all 0.25s ease-in-out;
|
transition: all 0.25s ease-in-out;
|
||||||
}
|
}
|
||||||
aside #group-sidebar .sidebar-group-li .group-edit-tool:hover {
|
aside #group-sidebar .sidebar-group-li .group-edit-tool:hover,
|
||||||
|
aside #saved-search-list .saved-search-li .savedsearchdrop:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1643,7 +1659,22 @@ ul.dropdown-menu li:hover {
|
||||||
color: $link_color;
|
color: $link_color;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
/* Section-Content-Wrapper */
|
||||||
|
#search-header-wrapper {
|
||||||
|
padding: 15px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border: none;
|
||||||
|
/*background-color: #fff;*/
|
||||||
|
background-color: rgba(255,255,255,$contentbg_transp);
|
||||||
|
border-radius: 4px;
|
||||||
|
position: relative;
|
||||||
|
/*overflow: hidden;*/
|
||||||
|
color: #555;
|
||||||
|
box-shadow: 0 0 3px #dadada;
|
||||||
|
-webkit-box-shadow: 0 0 3px #dadada;
|
||||||
|
-moz-box-shadow: 0 0 3px #dadada;
|
||||||
|
}
|
||||||
|
|
||||||
/* PAGES */
|
/* PAGES */
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,9 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// initialize the bootstrap-select
|
||||||
|
$('.selectpicker').selectpicker();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
//function commentOpenUI(obj, id) {
|
//function commentOpenUI(obj, id) {
|
||||||
|
|
16
view/theme/frio/templates/saved_searches_aside.tpl
Normal file
16
view/theme/frio/templates/saved_searches_aside.tpl
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
{{if $saved}}
|
||||||
|
<div class="widget" id="saved-search-list">
|
||||||
|
<h3 id="search">{{$title}}</h3>
|
||||||
|
|
||||||
|
<ul role="menu" id="saved-search-ul">
|
||||||
|
{{foreach $saved as $search}}
|
||||||
|
<li role="menuitem" class="saved-search-li clear">
|
||||||
|
<a title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right" href="network/?f=&remove=1&search={{$search.encodedterm}}"><i class="fa fa-trash" aria-hidden="true"></i></a>
|
||||||
|
<a id="saved-search-term-{{$search.id}}" class="savedsearchterm" href="network/?f=&search={{$search.encodedterm}}">{{$search.term}}</a>
|
||||||
|
</li>
|
||||||
|
{{/foreach}}
|
||||||
|
</ul>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
46
view/theme/frio/templates/searchbox.tpl
Normal file
46
view/theme/frio/templates/searchbox.tpl
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
<div id="{{$id}}" {{* class="input-group" *}}>
|
||||||
|
<div id="search-wrapper">
|
||||||
|
<form action="{{$action_url}}" method="get" >
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2"></div>
|
||||||
|
<div class="col-md-8 ">
|
||||||
|
|
||||||
|
<div class="form-group form-group-search">
|
||||||
|
<input type="text" name="search" id="search-text" class="search-input form-control form-search" data-toggle="tooltip" title="{{$search_hint}}" placeholder="{{$search_label}}" value="{{$s}}" />
|
||||||
|
<button id="search-submit" class="btn btn-default btn-sm form-button-search" type="submit" name="submit" value="{{$search_label}}">{{$search_label}}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4"></div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
{{* The button to save searches *}}
|
||||||
|
{{if $savedsearch}}
|
||||||
|
<button class="btn btn-primary btn-small pull-right" type="submit" name="save" id="search-save" value="{{$save_label}}">{{$save_label}}</button>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* The select popup menu to select what kind of results the user would like to search for *}}
|
||||||
|
{{if $searchoption}}
|
||||||
|
<div class="col-md-6 pull-right">
|
||||||
|
<div class="form-group field select">
|
||||||
|
<select name="search-option" id="search-options" class="form-control form-control-sm">
|
||||||
|
<option value="fulltext">{{$searchoption.0}}</option>
|
||||||
|
<option value="tags">{{$searchoption.1}}</option>
|
||||||
|
<option value="contacts">{{$searchoption.2}}</option>
|
||||||
|
{{if $searchoption.3}}<option value="forums">{{$searchoption.3}}</option>{{/if}}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2"></div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in a new issue