aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-01-18 12:44:40 +0100
committerMario Vavti <mario@mariovavti.com>2018-01-18 12:44:40 +0100
commit53e353abf2abe43b14f05fbf38e232a68f0689ad (patch)
treed1d31376891b989a2f9ec33cf88fc6bade4a218b
parent23a20ba6a549aacd637606857147a4949f5637fe (diff)
downloadvolse-hubzilla-53e353abf2abe43b14f05fbf38e232a68f0689ad.tar.gz
volse-hubzilla-53e353abf2abe43b14f05fbf38e232a68f0689ad.tar.bz2
volse-hubzilla-53e353abf2abe43b14f05fbf38e232a68f0689ad.zip
consolidate navbar tucson and some javascript cleanup
-rw-r--r--include/nav.php32
-rw-r--r--view/css/navbar_tucson.css3
-rw-r--r--view/js/main.js15
-rw-r--r--view/tpl/hdr.tpl3
-rwxr-xr-xview/tpl/navbar_tucson.tpl168
5 files changed, 48 insertions, 173 deletions
diff --git a/include/nav.php b/include/nav.php
index 8566cc58c..9c88541d1 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -100,38 +100,6 @@ EOT;
if(local_channel()) {
-
-
- $nav['network'] = array('network', t('Activity'), "", t('Network Activity'),'network_nav_btn');
- $nav['network']['all'] = [ 'network', t('View your network activity'), '','' ];
- $nav['network']['mark'] = array('', t('Mark all activity notifications seen'), '','');
-
- $nav['home'] = array('channel/' . $channel['channel_address'], t('Channel Home'), "", t('Channel home'),'home_nav_btn');
- $nav['home']['all'] = [ 'channel/' . $channel['channel_address'], t('View your channel home'), '' , '' ];
- $nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '','');
-
-
- $nav['intros'] = array('connections/ifpending', t('Connections'), "", t('Connections'),'connections_nav_btn');
- if(is_site_admin())
- $nav['registrations'] = array('admin/accounts', t('Registrations'), "", t('Registrations'),'registrations_nav_btn');
-
-
- $nav['notifications'] = array('notifications/system', t('Notices'), "", t('Notifications'),'notifications_nav_btn');
- $nav['notifications']['all']=array('notifications/system', t('View all notifications'), "", "");
- $nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '','');
-
- $nav['messages'] = array('mail/combined', t('Mail'), "", t('Private mail'),'mail_nav_btn');
- $nav['messages']['all']=array('mail/combined', t('View your private messages'), "", "");
- $nav['messages']['mark'] = array('', t('Mark all private messages seen'), '','');
- $nav['messages']['inbox'] = array('mail/inbox', t('Inbox'), "", t('Inbox'));
- $nav['messages']['outbox']= array('mail/outbox', t('Outbox'), "", t('Outbox'));
- $nav['messages']['new'] = array('mail/new', t('New Message'), "", t('New Message'));
-
-
- $nav['all_events'] = array('events', t('Events'), "", t('Event Calendar'),'events_nav_btn');
- $nav['all_events']['all']=array('events', t('View events'), "", "");
- $nav['all_events']['mark'] = array('', t('Mark all events seen'), '','');
-
if(! $_SESSION['delegate']) {
$nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage Your Channels'),'manage_nav_btn');
}
diff --git a/view/css/navbar_tucson.css b/view/css/navbar_tucson.css
index 79f95fe63..e69de29bb 100644
--- a/view/css/navbar_tucson.css
+++ b/view/css/navbar_tucson.css
@@ -1,3 +0,0 @@
-#notifications {
- display: none;
-}
diff --git a/view/js/main.js b/view/js/main.js
index 52b836936..0e3dcb0ec 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -878,18 +878,10 @@ function justifyPhotosAjax(id) {
function notify_popup_loader(notifyType) {
- /* notifications template - different for navbar and notifications widget */
- var navbar_notifications_tpl= unescape($("#navbar-notifications-template[rel=template]").html());
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
- //var notifications_all = unescape($('<div>').append( $("#nav-" + notifyType + "-see-all").clone() ).html()); //outerHtml hack
- //var notifications_mark = unescape($('<div>').append( $("#nav-" + notifyType + "-mark-all").clone() ).html()); //outerHtml hack
- //var notifications_tt_only = unescape($('<div>').append( $("#tt-" + notifyType + "-only").clone() ).html()); //outerHtml hack
- //var notifications_cn_only = unescape($('<div>').append( $("#cn-" + notifyType + "-only").clone() ).html()); //outerHtml hack
- //var notifications_empty = unescape($("#nav-" + notifyType + "-menu").html());
-
var notify_menu = $("#nav-" + notifyType + "-menu");
-
var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : '');
+
$.get(pingExCmd, function(data) {
if(data.invalid == 1) {
@@ -904,10 +896,8 @@ function notify_popup_loader(notifyType) {
notify_menu.html('');
$(data.notify).each(function() {
- html = navbar_notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top);
- $("#navbar-" + notifyType + "-menu").append(html);
html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top);
- $("#nav-" + notifyType + "-menu").append(html);
+ notify_menu.append(html);
});
$(".dropdown-menu img[data-src], .notification img[data-src]").each(function(i, el){
@@ -920,7 +910,6 @@ function notify_popup_loader(notifyType) {
$('#nav-' + notifyType + '-menu [data-thread_top=false]').hide();
var filter = $('#cn-' + notifyType + '-input').val();
-
if(filter) {
$('#nav-' + notifyType + '-menu .notification').each(function(i, el){
var cn = $(el).data('contact_name').toLowerCase();
diff --git a/view/tpl/hdr.tpl b/view/tpl/hdr.tpl
index 29137c740..e69de29bb 100644
--- a/view/tpl/hdr.tpl
+++ b/view/tpl/hdr.tpl
@@ -1,3 +0,0 @@
-<div id="navbar-notifications-template" rel="template" style="display:none;">
- <a class="dropdown-item clearfix dropdown-notification {5}" href="{0}" title="{2} {3}"><img class="menu-img-3" data-src="{1}"><span class="contactname">{2}</span><span class="dropdown-sub-text">{3}<br>{4}</span></a>
-</div> \ No newline at end of file
diff --git a/view/tpl/navbar_tucson.tpl b/view/tpl/navbar_tucson.tpl
index 08fc40656..2c9570938 100755
--- a/view/tpl/navbar_tucson.tpl
+++ b/view/tpl/navbar_tucson.tpl
@@ -16,12 +16,9 @@
{{/if}}
</div>
{{/if}}
-
-
-
{{if $userinfo}}
-<div class="dropdown usermenu">
- <div class="fakelink" data-toggle="dropdown">
+<div class="dropdown">
+ <div class="fakelink usermenu" data-toggle="dropdown">
<img id="avatar" src="{{$userinfo.icon}}" alt="{{$userinfo.name}}">
<i class="fa fa-caret-down"></i>
</div>
@@ -31,7 +28,7 @@
<a class="dropdown-item{{if $usermenu.2}} active{{/if}}" href="{{$usermenu.0}}" title="{{$usermenu.3}}" role="menuitem" id="{{$usermenu.4}}">{{$usermenu.1}}</a>
{{/foreach}}
{{if $nav.manage}}
- <a class="dropdown-item{{if $sel.active == Manage}} active{{/if}}" href="{{$nav.manage.0}}" title="{{$nav.manage.3}}" role="menuitem" id="{{$nav.manage.4}}">{{$nav.manage.1}}</a>
+ <a class="dropdown-item{{if $sel.name == Manage}} active{{/if}}" href="{{$nav.manage.0}}" title="{{$nav.manage.3}}" role="menuitem" id="{{$nav.manage.4}}">{{$nav.manage.1}}</a>
{{/if}}
{{if $nav.channels}}
{{foreach $nav.channels as $chan}}
@@ -43,7 +40,11 @@
{{/if}}
{{if $nav.settings}}
<div class="dropdown-divider"></div>
- <a class="dropdown-item{{if $sel.active == Settings}} active{{/if}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}" role="menuitem" id="{{$nav.settings.4}}">{{$nav.settings.1}}</a>
+ <a class="dropdown-item{{if $sel.name == Settings}} active{{/if}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}" role="menuitem" id="{{$nav.settings.4}}">{{$nav.settings.1}}</a>
+ {{/if}}
+ {{if $nav.admin}}
+ <div class="dropdown-divider"></div>
+ <a class="dropdown-item{{if $sel.name == Admin}} active{{/if}}" href="{{$nav.admin.0}}" title="{{$nav.admin.3}}" role="menuitem" id="{{$nav.admin.4}}">{{$nav.admin.1}}</a>
{{/if}}
{{if $nav.logout}}
<div class="dropdown-divider"></div>
@@ -51,7 +52,6 @@
{{/if}}
</div>
{{/if}}
-
{{if ! $is_owner}}
<div class="dropdown-menu" role="menu" aria-labelledby="avatar">
<a class="dropdown-item" href="{{$nav.rusermenu.0}}" role="menuitem">{{$nav.rusermenu.1}}</a>
@@ -59,129 +59,37 @@
</div>
{{/if}}
</div>
+{{if $sel.name}}
+<div id="nav-app-link-wrapper" class="navbar-nav mr-auto">
+ <a id="nav-app-link" href="{{$url}}" class="nav-link text-truncate">
+ {{$sel.name}}
+ {{if $sitelocation}}
+ <br><small>{{$sitelocation}}</small>
+ {{/if}}
+ </a>
+</div>
{{/if}}
-
-
-
-{{if $navbar_apps}}
-<ul class="navbar-nav mr-auto d-none d-xl-flex">
-{{foreach $navbar_apps as $navbar_app}}
-<li>
-{{$navbar_app}}
-</li>
-{{/foreach}}
-</ul>
{{/if}}
-
-
<div class="navbar-toggler-right">
-
{{if $nav.help.6}}
<button id="context-help-btn" class="navbar-toggler border-0" type="button" onclick="contextualHelp(); return false;">
<i class="fa fa-question-circle"></i>
</button>
{{/if}}
-
- <button id="expand-aside" type="button" class="navbar-toggler border-0" data-toggle="offcanvas" data-target="#region_1">
+ <button id="expand-aside" type="button" class="d-lg-none navbar-toggler border-0" data-toggle="offcanvas" data-target="#region_1">
<i class="fa fa-arrow-circle-right" id="expand-aside-icon"></i>
</button>
-
{{if $localuser || $nav.pubs}}
- <button id="notifications-btn-1" type="button" class="navbar-toggler border-0 text-white notifications-btn" data-toggle="collapse" data-target="#navbar-collapse-1">
- <i id="notifications-btn-icon-1" class="fa fa-exclamation notifications-btn-icon"></i>
+ <button id="notifications-btn-1" type="button" class="navbar-toggler border-0 text-white notifications-btn">
+ <i id="notifications-btn-icon-1" class="fa fa-exclamation-circle notifications-btn-icon"></i>
</button>
{{/if}}
-
<button id="menu-btn" class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navbar-collapse-2">
<i class="fa fa-bars"></i>
</button>
</div>
-
-
-
-
-
<div class="collapse navbar-collapse" id="navbar-collapse-1">
-
<ul class="navbar-nav mr-auto">
- {{if $nav.network}}
- <li class="nav-item dropdown network-button" style="display: none;">
- <a class="nav-link" href="#" title="{{$nav.network.3}}" id="{{$nav.network.4}}" data-toggle="dropdown" rel="#navbar-network-menu">
- <i class="fa fa-fw fa-th"></i>
- <span class="badge badge-pill badge-secondary network-update"></span>
- </a>
- <div id="navbar-network-menu" class="dropdown-menu" rel="network">
- <a class="dropdown-item" id="nav-network-see-all" href="{{$nav.network.all.0}}">{{$nav.network.all.1}}</a>
- <a class="dropdown-item" id="nav-network-mark-all" href="#" onclick="markRead('network'); return false;">{{$nav.network.mark.1}}</a>
- {{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
- </div>
- </li>
- {{/if}}
- {{if $nav.home}}
- <li class="nav-item dropdown home-button" style="display: none;">
- <a class="nav-link" href="#" title="{{$nav.home.3}}" id="{{$nav.home.4}}" data-toggle="dropdown" rel="#navbar-home-menu">
- <i class="fa fa-fw fa-home"></i>
- <span class="badge badge-pill badge-danger home-update"></span>
- </a>
- <div id="navbar-home-menu" class="dropdown-menu" rel="home">
- <a class="dropdown-item" id="nav-home-see-all" href="{{$nav.home.all.0}}">{{$nav.home.all.1}}</a>
- <a class="dropdown-item" id="nav-home-mark-all" href="#" onclick="markRead('home'); return false;">{{$nav.home.mark.1}}</a>
- {{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
- </div>
- </li>
- {{/if}}
- {{if $nav.messages}}
- <li class="nav-item dropdown mail-button" style="display: none;">
- <a class="nav-link" href="#" title="{{$nav.messages.3}}" id="{{$nav.messages.4}}" data-toggle="dropdown" rel="#navbar-mail-menu">
- <i class="fa fa-fw fa-envelope"></i>
- <span class="badge badge-pill badge-danger mail-update"></span>
- </a>
- <div id="navbar-mail-menu" class="dropdown-menu" rel="messages">
- <a class="dropdown-item" id="nav-messages-see-all" href="{{$nav.messages.all.0}}">{{$nav.messages.all.1}}</a>
- <a class="dropdown-item" id="nav-messages-mark-all" href="#" onclick="markRead('messages'); return false;">{{$nav.messages.mark.1}}</a>
- {{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
- </div>
- </li>
- {{/if}}
- {{if $nav.all_events}}
- <li class="nav-item dropdown all_events-button" style="display: none;">
- <a class="nav-link" href="#" title="{{$nav.all_events.3}}" id="{{$nav.all_events.4}}" data-toggle="dropdown" rel="#navbar-all_events-menu">
- <i class="fa fa-fw fa-calendar"></i>
- <span class="badge badge-pill badge-secondary all_events-update"></span>
- </a>
- <div id="navbar-all_events-menu" class="dropdown-menu" rel="all_events">
- <a class="dropdown-item" id="nav-all_events-see-all" href="{{$nav.all_events.all.0}}">{{$nav.all_events.all.1}}</a>
- <a class="dropdown-item" id="nav-all_events-mark-all" href="#" onclick="markRead('all_events'); return false;">{{$nav.all_events.mark.1}}</a>
- {{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
- </div>
- </li>
- {{/if}}
- {{if $nav.intros}}
- <li class="nav-item dropdown intros-button" style="display: none;">
- <a class="nav-link" href="#" title="{{$nav.intros.3}}" id="{{$nav.intros.4}}" data-toggle="dropdown" rel="#navbar-intros-menu">
- <i class="fa fa-fw fa-users"></i>
- <span class="badge badge-pill badge-danger intros-update"></span>
- </a>
- <div id="navbar-intros-menu" class="dropdown-menu" rel="intros">
- <a class="dropdown-item" id="nav-intros-see-all" href="{{$nav.intros.all.0}}">{{$nav.intros.all.1}}</a>
- {{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
- </div>
- </li>
- {{/if}}
- {{if $nav.notifications}}
- <li class="nav-item dropdown notify-button" style="display: none;">
- <a class="nav-link" href="#" title="{{$nav.notifications.1}}" id="{{$nav.notifications.4}}" data-toggle="dropdown" rel="#navbar-notify-menu">
- <i class="fa fa-fw fa-exclamation"></i>
- <span class="badge badge-pill badge-danger notify-update"></span>
- </a>
- <div id="navbar-notify-menu" class="dropdown-menu" rel="notify">
- <a class="dropdown-item" id="nav-notify-see-all" href="{{$nav.notifications.all.0}}">{{$nav.notifications.all.1}}</a>
- <a class="dropdown-item" id="nav-notify-mark-all" href="#" onclick="markRead('notify'); return false;">{{$nav.notifications.mark.1}}</a>
- {{$emptynotifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
- </div>
- </li>
- {{/if}}
-
{{if $nav.login && !$userinfo}}
<li class="nav-item d-none d-xl-flex">
{{if $nav.loginmenu.1.4}}
@@ -205,16 +113,11 @@
<a class="nav-link" href="{{$nav.alogout.0}}" title="{{$nav.alogout.3}}" id="{{$nav.alogout.4}}">{{$nav.alogout.1}}</a>
</li>
{{/if}}
-
</ul>
+ <div id="banner" class="navbar-text">{{$banner}}</div>
-
-
- <div id="banner" class="navbar-text d-none d-xl-flex">{{$banner}}</div>
-
-
- <ul id="nav-right" class="navbar-nav ml-auto d-none d-xl-flex">
+ <ul id="nav-right" class="navbar-nav ml-auto">
<li class="nav-item collapse clearfix" id="nav-search">
<form class="form-inline" method="get" action="search" role="search">
<input class="form-control form-control-sm mt-1 mr-2" id="nav-search-text" type="text" value="" placeholder="&#xf002; {{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();" onblur="closeMenu('nav-search'); openMenu('nav-search-btn');"/>
@@ -236,7 +139,7 @@
<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_apps.0}}
+ {{if $channel_menu && $channel_apps.0}}
<li class="nav-item dropdown" id="channel-menu">
<a class="nav-link" href="#" data-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-right">
@@ -246,12 +149,32 @@
</div>
</li>
{{/if}}
+ {{if $navbar_apps}}
+ {{foreach $navbar_apps as $navbar_app}}
+ <li>
+ {{$navbar_app}}
+ </li>
+ {{/foreach}}
+ {{/if}}
<li class="nav-item dropdown" id="app-menu">
<a class="nav-link" href="#" data-toggle="dropdown"><i class="fa fa-fw fa-bars"></i></a>
<div id="dropdown-menu" class="dropdown-menu dropdown-menu-right">
+ {{if $channel_apps.0 && ! $channel_menu}}
+ {{foreach $channel_apps as $channel_app}}
+ {{$channel_app}}
+ {{/foreach}}
+ <div class="dropdown-divider"></div>
+ <div class="dropdown-header 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>
@@ -261,8 +184,6 @@
</li>
</ul>
</div>
-
-
<div class="collapse d-lg-none" id="navbar-collapse-2">
<div class="navbar-nav mr-auto">
{{if $channel_apps.0}}
@@ -274,6 +195,9 @@
</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}}