aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-06-01 12:11:07 +0200
committerMario Vavti <mario@mariovavti.com>2018-06-01 12:11:07 +0200
commit6bf0f4225c0fc7ecc1762ed5cfe2c4861cd1bd4e (patch)
treee97a2f276650c978e6415db00449f81f00d236ba
parentd03c27d18c10d287cbfd3133b3301934d0457636 (diff)
downloadvolse-hubzilla-6bf0f4225c0fc7ecc1762ed5cfe2c4861cd1bd4e.tar.gz
volse-hubzilla-6bf0f4225c0fc7ecc1762ed5cfe2c4861cd1bd4e.tar.bz2
volse-hubzilla-6bf0f4225c0fc7ecc1762ed5cfe2c4861cd1bd4e.zip
move file and groups filter to submenu
-rw-r--r--Zotlabs/Widget/Activity_filter.php65
-rw-r--r--Zotlabs/Widget/Activity_order.php16
-rw-r--r--view/tpl/activity_filter_widget.tpl11
-rwxr-xr-xview/tpl/common_pills.tpl31
-rw-r--r--view/tpl/common_widget.tpl6
5 files changed, 94 insertions, 35 deletions
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php
index a85ab8dc1..18207b37b 100644
--- a/Zotlabs/Widget/Activity_filter.php
+++ b/Zotlabs/Widget/Activity_filter.php
@@ -17,7 +17,7 @@ class Activity_filter {
if(feature_enabled(local_channel(),'personal_tab')) {
if(x($_GET,'conv')) {
$conv_active = (($_GET['conv'] == 1) ? 'active' : '');
- $filter_active = true;
+ $filter_active = 'personal';
}
$tabs[] = [
@@ -32,7 +32,7 @@ class Activity_filter {
if(feature_enabled(local_channel(),'star_posts')) {
if(x($_GET,'star')) {
$starred_active = (($_GET['star'] == 1) ? 'active' : '');
- $filter_active = true;
+ $filter_active = 'star';
}
$tabs[] = [
@@ -53,17 +53,26 @@ class Activity_filter {
foreach($groups as $g) {
if(x($_GET,'gid')) {
$group_active = (($_GET['gid'] == $g['id']) ? 'active' : '');
- $filter_active = true;
+ $filter_active = 'group';
}
-
- $tabs[] = [
+ $gsub[] = [
'label' => $g['gname'],
- 'icon' => 'users',
+ 'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&gid=' . $g['id'],
'sel' => $group_active,
'title' => sprintf(t('Show posts related to the %s privacy group'), $g['gname']),
];
}
+ $tabs[] = [
+ 'id' => 'privacy_groups',
+ 'label' => t('Privacy Groups'),
+ 'icon' => 'users',
+ 'url' => '#',
+ 'sel' => (($filter_active == 'group') ? true : false),
+ 'title' => sprintf(t('Show posts that i have filed to %s'), $t['term']),
+ 'sub' => $gsub
+
+ ];
}
}
@@ -77,50 +86,64 @@ class Activity_filter {
foreach($terms as $t) {
if(x($_GET,'file')) {
$file_active = (($_GET['file'] == $t['term']) ? 'active' : '');
- $filter_active = true;
+ $filter_active = 'file';
}
-
- $tabs[] = [
+ $tsub[] = [
'label' => $t['term'],
- 'icon' => 'folder',
+ 'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&file=' . $t['term'],
'sel' => $file_active,
- 'title' => sprintf(t('Show posts that i have filed to %s'), $t['term']),
+ 'title' => '',
];
}
+
+ $tabs[] = [
+ 'label' => t('Saved Folders'),
+ 'icon' => 'folder',
+ 'url' => '#',
+ 'sel' => (($filter_active == 'file') ? true : false),
+ 'title' => sprintf(t('Show posts that i have filed to %s'), $t['term']),
+ 'sub' => $tsub
+
+ ];
}
}
if(x($_GET,'search')) {
- $filter_active = true;
+ $filter_active = 'search';
}
+ $reset = [];
if($filter_active) {
$reset = [
- 'label' => t('Remove Filter'),
+ 'label' => '',
'icon' => 'remove',
'url'=> z_root() . '/' . $cmd,
- 'sel'=> 'active bg-danger',
+ 'sel'=> '',
'title' => t('Remove active filter'),
];
- array_unshift($tabs, $reset);
}
$arr = ['tabs' => $tabs];
call_hooks('network_tabs', $arr);
- $tpl = get_markup_template('common_pills.tpl');
+ $o = '';
if($arr['tabs']) {
- return replace_macros($tpl, [
+ $content = replace_macros(get_markup_template('common_pills.tpl'), [
+ '$pills' => $arr['tabs'],
+ ]);
+
+ $o .= replace_macros(get_markup_template('activity_filter_widget.tpl'), [
'$title' => t('Activity Filters'),
- '$tabs' => $arr['tabs'],
+ '$reset' => $reset,
+ '$content' => $content,
]);
}
- else {
- return '';
- }
+
+ return $o;
+
}
}
diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php
index 10ec142d9..93bfc5a26 100644
--- a/Zotlabs/Widget/Activity_order.php
+++ b/Zotlabs/Widget/Activity_order.php
@@ -105,17 +105,21 @@ class Activity_order {
call_hooks('network_tabs', $arr);
- $tpl = get_markup_template('common_pills.tpl');
+ $o = '';
if($arr['tabs']) {
- return replace_macros($tpl, [
+ $content = replace_macros(get_markup_template('common_pills.tpl'), [
+ '$pills' => $arr['tabs'],
+ ]);
+
+ $o = replace_macros(get_markup_template('common_widget.tpl'), [
'$title' => t('Activity Order'),
- '$tabs' => $arr['tabs'],
+ '$content' => $content,
]);
}
- else {
- return '';
- }
+
+ return $o;
+
}
}
diff --git a/view/tpl/activity_filter_widget.tpl b/view/tpl/activity_filter_widget.tpl
new file mode 100644
index 000000000..7ff5a4f7e
--- /dev/null
+++ b/view/tpl/activity_filter_widget.tpl
@@ -0,0 +1,11 @@
+<div class="widget">
+ <h3 class="d-flex justify-content-between align-items-center">
+ {{$title}}
+ {{if $reset}}
+ <a href="{{$reset.url}}" class="text-muted" title="{{$reset.title}}">
+ <i class="fa fa-fw fa-{{$reset.icon}}"></i>
+ </a>
+ {{/if}}
+ </h3>
+ {{$content}}
+</div>
diff --git a/view/tpl/common_pills.tpl b/view/tpl/common_pills.tpl
index d10aa365b..37d500bd1 100755
--- a/view/tpl/common_pills.tpl
+++ b/view/tpl/common_pills.tpl
@@ -1,8 +1,23 @@
-<div class="widget">
- <h3>{{$title}}</h3>
- <ul class="nav nav-pills flex-column">
- {{foreach $tabs as $tab}}
- <li class="nav-item"{{if $tab.id}} id="{{$tab.id}}"{{/if}}><a class="nav-link{{if $tab.sel}} {{$tab.sel}}{{/if}}" href="{{$tab.url}}"{{if $tab.title}} title="{{$tab.title}}"{{/if}}>{{if $tab.icon}}<i class="fa fa-fw fa-{{$tab.icon}}"></i> {{/if}}{{$tab.label}}</a></li>
- {{/foreach}}
- </ul>
-</div>
+<ul class="nav nav-pills flex-column">
+ {{foreach $pills as $p}}
+ <li class="nav-item"{{if $p.id}} id="{{$p.id}}"{{/if}}>
+ <a class="nav-link{{if $p.sel}} {{$p.sel}}{{/if}}" href="{{$p.url}}"{{if $p.title}} title="{{$p.title}}"{{/if}}{{if $p.sub}} onclick="{{if $p.sel}}closeOpen('{{$p.id}}_sub');{{else}}openClose('{{$p.id}}_sub');{{/if}} return false;"{{/if}}>
+ {{if $p.icon}}<i class="fa fa-fw fa-{{$p.icon}}"></i>{{/if}}
+ {{$p.label}}
+ {{if $p.sub}}<i class="fa fa-fw fa-caret-down"></i>{{/if}}
+ </a>
+ {{if $p.sub}}
+ <ul class="nav nav-pills flex-column ml-4" id="{{$p.id}}_sub"{{if !$p.sel}} style="display: none;"{{/if}}>
+ {{foreach $p.sub as $ps}}
+ <li class="nav-item"{{if $ps.id}} id="{{$ps.id}}"{{/if}}>
+ <a class="nav-link{{if $ps.sel}} {{$ps.sel}}{{/if}}" href="{{$ps.url}}"{{if $ps.title}} title="{{$ps.title}}"{{/if}}>
+ {{if $ps.icon}}<i class="fa fa-fw fa-{{$ps.icon}}"></i>{{/if}}
+ {{$ps.label}}
+ </a>
+ </li>
+ {{/foreach}}
+ </ul>
+ {{/if}}
+ </li>
+ {{/foreach}}
+</ul>
diff --git a/view/tpl/common_widget.tpl b/view/tpl/common_widget.tpl
new file mode 100644
index 000000000..e542031dc
--- /dev/null
+++ b/view/tpl/common_widget.tpl
@@ -0,0 +1,6 @@
+<div class="widget">
+ <h3>
+ {{$title}}
+ </h3>
+ {{$content}}
+</div>