implement reset button for filters
This commit is contained in:
parent
7e8c7f86f0
commit
d03c27d18c
@ -10,12 +10,14 @@ class Activity_filter {
|
|||||||
return '';
|
return '';
|
||||||
|
|
||||||
$cmd = \App::$cmd;
|
$cmd = \App::$cmd;
|
||||||
|
$filter_active = false;
|
||||||
|
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
|
|
||||||
if(feature_enabled(local_channel(),'personal_tab')) {
|
if(feature_enabled(local_channel(),'personal_tab')) {
|
||||||
if(x($_GET,'conv')) {
|
if(x($_GET,'conv')) {
|
||||||
$conv_active = (($_GET['conv'] == 1) ? 'active' : '');
|
$conv_active = (($_GET['conv'] == 1) ? 'active' : '');
|
||||||
|
$filter_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabs[] = [
|
$tabs[] = [
|
||||||
@ -30,6 +32,7 @@ class Activity_filter {
|
|||||||
if(feature_enabled(local_channel(),'star_posts')) {
|
if(feature_enabled(local_channel(),'star_posts')) {
|
||||||
if(x($_GET,'star')) {
|
if(x($_GET,'star')) {
|
||||||
$starred_active = (($_GET['star'] == 1) ? 'active' : '');
|
$starred_active = (($_GET['star'] == 1) ? 'active' : '');
|
||||||
|
$filter_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabs[] = [
|
$tabs[] = [
|
||||||
@ -50,6 +53,7 @@ class Activity_filter {
|
|||||||
foreach($groups as $g) {
|
foreach($groups as $g) {
|
||||||
if(x($_GET,'gid')) {
|
if(x($_GET,'gid')) {
|
||||||
$group_active = (($_GET['gid'] == $g['id']) ? 'active' : '');
|
$group_active = (($_GET['gid'] == $g['id']) ? 'active' : '');
|
||||||
|
$filter_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabs[] = [
|
$tabs[] = [
|
||||||
@ -73,6 +77,7 @@ class Activity_filter {
|
|||||||
foreach($terms as $t) {
|
foreach($terms as $t) {
|
||||||
if(x($_GET,'file')) {
|
if(x($_GET,'file')) {
|
||||||
$file_active = (($_GET['file'] == $t['term']) ? 'active' : '');
|
$file_active = (($_GET['file'] == $t['term']) ? 'active' : '');
|
||||||
|
$filter_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabs[] = [
|
$tabs[] = [
|
||||||
@ -86,6 +91,21 @@ class Activity_filter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(x($_GET,'search')) {
|
||||||
|
$filter_active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($filter_active) {
|
||||||
|
$reset = [
|
||||||
|
'label' => t('Remove Filter'),
|
||||||
|
'icon' => 'remove',
|
||||||
|
'url'=> z_root() . '/' . $cmd,
|
||||||
|
'sel'=> 'active bg-danger',
|
||||||
|
'title' => t('Remove active filter'),
|
||||||
|
];
|
||||||
|
array_unshift($tabs, $reset);
|
||||||
|
}
|
||||||
|
|
||||||
$arr = ['tabs' => $tabs];
|
$arr = ['tabs' => $tabs];
|
||||||
|
|
||||||
call_hooks('network_tabs', $arr);
|
call_hooks('network_tabs', $arr);
|
||||||
|
Reference in New Issue
Block a user