aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-08-24 08:37:51 +0000
committerMario <mario@mariovavti.com>2021-08-24 08:37:51 +0000
commitfa1878fda16b983c79eabbf04584917cd4e46279 (patch)
tree30aa9f9fd1778aeab63ef2b2bb5849afa652c37d
parentb129d74a38e5f611dce9118ed8b6d676fdabaf44 (diff)
downloadvolse-hubzilla-fa1878fda16b983c79eabbf04584917cd4e46279.tar.gz
volse-hubzilla-fa1878fda16b983c79eabbf04584917cd4e46279.tar.bz2
volse-hubzilla-fa1878fda16b983c79eabbf04584917cd4e46279.zip
nav cleanup
-rw-r--r--Zotlabs/Module/Channel.php2
-rw-r--r--include/nav.php60
-rw-r--r--view/tpl/navbar_default.tpl95
3 files changed, 51 insertions, 106 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 20cbe0b5c..6fac610aa 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -226,7 +226,7 @@ class Channel extends Controller {
if (!$update) {
- nav_set_selected('Channel Home');
+ nav_set_selected('Channel');
// search terms header
if ($search) {
diff --git a/include/nav.php b/include/nav.php
index 30f5fd9b8..e16e0ceab 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -18,14 +18,11 @@ function nav($template = 'default') {
App::$page['htmlhead'] = App::$page['htmlhead'] ?? '';
App::$page['htmlhead'] .= '<script>$(document).ready(function() { $("#nav-search-text").search_autocomplete(\'' . z_root() . '/acl' . '\');});</script>';
$is_owner = (((local_channel()) && ((App::$profile_uid == local_channel()) || (App::$profile_uid == 0))) ? true : false);
- $observer = [];
- $sitelocation = '';
+ $observer = App::get_observer();
if (local_channel()) {
- $channel = App::get_channel();
- $observer = App::get_observer();
-
- $prof = q("select id from profile where uid = %d and is_default = 1",
+ $channel = App::get_channel();
+ $prof = q("select id from profile where uid = %d and is_default = 1",
intval($channel['channel_id'])
);
@@ -34,10 +31,10 @@ function nav($template = 'default') {
intval(get_account_id())
);
}
+
$sitelocation = (($is_owner) ? '' : App::$profile['reddress']);
}
- elseif (remote_channel()) {
- $observer = App::get_observer();
+ else {
$sitelocation = ((App::$profile['reddress']) ? App::$profile['reddress'] : '@' . App::get_hostname());
}
@@ -47,9 +44,9 @@ function nav($template = 'default') {
$navbar_apps = [];
$channel_apps = [];
- if (isset(App::$profile['channel_address']))
+ if (isset(App::$profile['channel_address'])) {
$channel_apps[] = channel_apps($is_owner, App::$profile['channel_address']);
-
+ }
/**
*
@@ -164,8 +161,9 @@ function nav($template = 'default') {
];
}
- if (((get_config('system', 'register_policy') == REGISTER_OPEN) || (get_config('system', 'register_policy') == REGISTER_APPROVE)) && (empty($_SESSION['authenticated'])))
+ if ((get_config('system', 'register_policy') == REGISTER_OPEN || get_config('system', 'register_policy') == REGISTER_APPROVE) && empty($_SESSION['authenticated'])) {
$nav['register'] = ['register', t('Register'), "", t('Create an account'), 'register_nav_btn'];
+ }
if (!get_config('system', 'hide_help')) {
$help_url = z_root() . '/help?f=&cmd=' . App::$cmd;
@@ -204,10 +202,6 @@ function nav($template = 'default') {
call_hooks('nav', $x);
- // Not sure the best place to put this on the page. So I'm implementing it but leaving it
- // turned off until somebody discovers this and figures out a good location for it.
- $powered_by = '';
-
$url = '';
$settings_url = '';
@@ -253,6 +247,7 @@ function nav($template = 'default') {
$pinned_list[] = Apps::app_encode($li);
}
}
+
Apps::translate_system_apps($pinned_list);
usort($pinned_list, 'Zotlabs\\Lib\\Apps::app_name_compare');
@@ -266,6 +261,7 @@ function nav($template = 'default') {
$syslist[] = Apps::app_encode($li);
}
}
+
Apps::translate_system_apps($syslist);
}
@@ -293,12 +289,13 @@ function nav($template = 'default') {
if ($syslist) {
foreach ($syslist as $app) {
- if (isset(App::$nav_sel['name']) && App::$nav_sel['name'] == $app['name'])
+ if (isset(App::$nav_sel['name']) && App::$nav_sel['name'] == $app['name']) {
$app['active'] = true;
+ }
if ($is_owner) {
$nav_apps[] = Apps::app_render($app, 'nav');
}
- elseif (!$is_owner && (!isset($app['requires']) || (isset($app['requires']) && strpos($app['requires'], 'local_channel') === false))) {
+ elseif (!isset($app['requires']) || (isset($app['requires']) && strpos($app['requires'], 'local_channel') === false)) {
$nav_apps[] = Apps::app_render($app, 'nav');
}
}
@@ -326,8 +323,7 @@ function nav($template = 'default') {
'$localuser' => local_channel(),
'$is_owner' => $is_owner,
'$sel' => App::$nav_sel,
- '$powered_by' => $powered_by,
- '$help' => t('@name, !forum, #tag, ?doc, content'),
+ '$help' => t('@name, #tag, ?doc, content'),
'$pleasewait' => t('Please wait...'),
'$nav_apps' => $nav_apps,
'$navbar_apps' => $navbar_apps,
@@ -335,14 +331,14 @@ function nav($template = 'default') {
'$channel_thumb' => ((App::$profile) ? App::$profile['thumb'] : ''),
'$channel_apps' => $channel_apps,
'$addapps' => t('Apps'),
- '$apps' => t('Apps'),
'$channelapps' => t('Channel Apps'),
'$sysapps' => t('System Apps'),
- '$orderapps' => t('Arrange Apps'),
+ '$pinned_apps' => t('Pinned Apps'),
+ '$featured_apps' => t('Featured Apps'),
'$url' => (($url) ? $url : z_root() . '/' . App::$cmd),
'$settings_url' => $settings_url,
- '$name' => App::$profile['channel_name'],
- '$thumb' => App::$profile['thumb'],
+ '$name' => ((!$is_owner) ? App::$profile['channel_name'] : ''),
+ '$thumb' => ((!$is_owner) ? App::$profile['thumb'] : ''),
'$form_security_token' => get_form_security_token('pconfig')
]);
@@ -373,29 +369,33 @@ function nav_set_selected($raw_name, $settings_url = '') {
App::$nav_sel['name'] = $item['name'];
- if ($settings_url)
+ if ($settings_url) {
App::$nav_sel['settings_url'] = z_root() . '/' . $settings_url;
+ }
}
function channel_apps($is_owner = false, $nickname = null) {
// Don't provide any channel apps if we're running as the sys channel
- if (App::$is_sys)
- return '';
+ if (App::$is_sys) {
+ return EMPTY_STR;
+ }
$channel = App::get_channel();
- if ($channel && is_null($nickname))
+ if ($channel && is_null($nickname)) {
$nickname = $channel['channel_address'];
+ }
$uid = ((isset(App::$profile['profile_uid'])) ? App::$profile['profile_uid'] : local_channel());
- if (!get_pconfig($uid, 'system', 'channelapps', '1'))
- return;
+ if (!get_pconfig($uid, 'system', 'channelapps', '1')) {
+ return EMPTY_STR;
+ }
if ($uid == local_channel()) {
- return;
+ return EMPTY_STR;
}
else {
$cal_link = '/cal/' . $nickname;
diff --git a/view/tpl/navbar_default.tpl b/view/tpl/navbar_default.tpl
index ba297c9b6..6f93238a1 100644
--- a/view/tpl/navbar_default.tpl
+++ b/view/tpl/navbar_default.tpl
@@ -156,16 +156,6 @@
<a class="nav-link text-white notifications-btn" href="#"><i id="notifications-btn-icon" class="fa fa-exclamation-circle notifications-btn-icon"></i></a>
</li>
{{/if}}
- {{**if $channel_menu && $channel_apps.0}}
- <li class="nav-item dropdown" id="channel-menu">
- <a class="nav-link" href="#" data-bs-toggle="dropdown"><img src="{{$channel_thumb}}" style="height:14px; width:14px;position:relative; top:-2px;" /></a>
- <div id="dropdown-menu" class="dropdown-menu dropdown-menu-end">
- {{foreach $channel_apps as $channel_app}}
- {{$channel_app}}
- {{/foreach}}
- </div>
- </li>
- {{/if**}}
{{if $navbar_apps}}
{{foreach $navbar_apps as $navbar_app}}
<li class="nav-app-sortable">
@@ -175,59 +165,9 @@
{{/if}}
<li class="nav-item dropdown" id="app-menu">
<a class="nav-link" href="#" data-bs-toggle="offcanvas" data-bs-target="#app-bin" aria-controls="app-bin"><i class="fa fa-fw fa-bars"></i></a>
- <!--div id="dropdown-menu" class="dropdown-menu dropdown-menu-end">
- {{if $channel_apps.0 && ! $channel_menu}}
- {{foreach $channel_apps as $channel_app}}
- {{$channel_app}}
- {{/foreach}}
- <div class="dropdown-divider"></div>
- <div class="dropdown-header text-black-50 sys-apps-toggle" onclick="$('#dropdown-menu').click(function(e) { e.stopPropagation(); }); openClose('sys_apps');">
- {{$sysapps_toggle}}
- </div>
- <div id="sys_apps" style="display:none;">
- {{/if}}
- {{foreach $nav_apps as $nav_app}}
- {{$nav_app}}
- {{/foreach}}
- {{if $channel_apps.0 && ! $channel_menu}}
- </div>
- {{/if}}
- {{if $is_owner}}
- <div class="dropdown-divider"></div>
- <a class="dropdown-item" href="/apps"><i class="generic-icons-nav fa fa-fw fa-plus-circle"></i>{{$addapps}}</a>
- <a class="dropdown-item" href="/apporder"><i class="generic-icons-nav fa fa-fw fa-sort"></i>{{$orderapps}}</a>
- {{/if}}
- </div-->
</li>
</ul>
</div>
- <!--div class="collapse d-lg-none" id="navbar-collapse-2">
- <div class="navbar-nav">
- {{if $channel_apps.0}}
- {{foreach $channel_apps as $channel_app}}
- {{$channel_app|replace:'dropdown-item':'nav-link'}}
- {{/foreach}}
- <div class="dropdown-header text-white-50 sys-apps-toggle" onclick="openClose('sys-apps-collapsed');">
- {{$sysapps_toggle}}
- </div>
- <div id="sys-apps-collapsed" style="display:none;">
- {{/if}}
- {{foreach $navbar_apps as $navbar_app}}
- {{$navbar_app}}
- {{/foreach}}
- {{foreach $nav_apps as $nav_app}}
- {{$nav_app|replace:'dropdown-item':'nav-link'}}
- {{/foreach}}
- {{if $channel_apps.0}}
- </div>
- {{/if}}
- {{if $is_owner}}
- <div class="dropdown-divider"></div>
- <a class="nav-link" href="/apps"><i class="generic-icons-nav fa fa-fw fa-plus-circle"></i>{{$addapps}}</a>
- <a class="nav-link" href="/apporder"><i class="generic-icons-nav fa fa-fw fa-sort"></i>{{$orderapps}}</a>
- {{/if}}
- </div>
- </div-->
{{if $nav.help.6}}
<div id="contextual-help-content" class="contextual-help-content">
{{$nav.help.5}}
@@ -240,46 +180,51 @@
</div>
<div class="offcanvas offcanvas-end" tabindex="-1" id="app-bin" aria-labelledby="app-bin-label">
<div class="offcanvas-header">
- <div class="offcanvas-title" id="app-bin-label">
+ <div class="lh-1" id="app-bin-label">
{{if $name}}
- <div class="h3"><img src="{{$thumb}}" class="menu-img-1"> {{$name}}</div>
- {{else}}
- <div class="h3">{{$apps}}</div>
+ <img src="{{$thumb}}" class="menu-img-2">
+ <div class="float-start pe-2">
+ <div class="fw-bold">{{$name}}</div>
+ <div class="text-muted">{{$sitelocation}}</div>
+ </div>
{{/if}}
</div>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
- <div class="offcanvas-body">
- {{if $channel_apps.0 && ! $channel_menu}}
- <div class="dropdown-header">
+ <div class="offcanvas-body pt-0">
+ {{if $channel_apps.0}}
+ <div class="dropdown-header text-uppercase">
{{$channelapps}}
</div>
{{foreach $channel_apps as $channel_app}}
{{$channel_app}}
{{/foreach}}
- <div class="dropdown-divider"></div>
- <div class="dropdown-header">
- {{$sysapps}}
- </div>
{{/if}}
<div id="nav-app-bin-container" class="d-lg-none">
+ <div class="dropdown-header text-uppercase">
+ {{$pinned_apps}}
+ </div>
{{foreach $navbar_apps as $navbar_app}}
{{$navbar_app|replace:'navbar-app nav-link':'dropdown-item nav-app-sortable'|replace:'fa':'generic-icons-nav fa'}}
{{/foreach}}
- <div class="dropdown-divider"></div>
</div>
{{if $is_owner}}
<div id="app-bin-container" data-token="{{$form_security_token}}">
+ <div class="dropdown-header text-uppercase">
+ {{$featured_apps}}
+ </div>
+ {{else}}
+ <div class="dropdown-header text-uppercase">
+ {{$sysapps}}
+ </div>
{{/if}}
{{foreach $nav_apps as $nav_app}}
{{$nav_app}}
{{/foreach}}
{{if $is_owner}}
</div>
- {{/if}}
- {{if $is_owner}}
<div class="dropdown-divider"></div>
- <a class="dropdown-item" href="/apps"><i class="generic-icons-nav fa fa-fw fa-plus-circle"></i>{{$addapps}}</a>
+ <a class="dropdown-item" href="/apps"><i class="generic-icons-nav fa fa-fw fa-plus"></i>{{$addapps}}</a>
{{/if}}
</div>
</div>