navbar tpl fix

This commit is contained in:
ivan 2021-09-09 13:39:58 +03:00
parent 975fdcdb34
commit 18f16a2646
1 changed files with 393 additions and 227 deletions

View File

@ -1,7 +1,8 @@
{{if $nav.login && !$userinfo}} <div class="container-fluid">
<div class="d-lg-none pt-1 pb-1"> {{if $nav.login && !$userinfo}}
<div class="d-lg-none pt-1 pb-1">
{{if $nav.loginmenu.1.4}} {{if $nav.loginmenu.1.4}}
<a class="btn btn-primary btn-sm text-white" href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}_collapse" data-toggle="modal" data-target="#nav-login"> <a class="btn btn-primary btn-sm text-white" href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}_collapse" data-bs-toggle="modal" data-bs-target="#nav-login">
{{$nav.loginmenu.1.1}} {{$nav.loginmenu.1.1}}
</a> </a>
{{else}} {{else}}
@ -14,11 +15,12 @@
{{$nav.register.1}} {{$nav.register.1}}
</a> </a>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}
{{if $userinfo}} {{if $userinfo}}
<div class="dropdown"> <div class="d-flex justify-content-start">
<div class="fakelink usermenu" data-toggle="dropdown"> <div class="dropdown">
<div class="fakelink usermenu" data-bs-toggle="dropdown">
<img id="avatar" src="{{$userinfo.icon}}" alt="{{$userinfo.name}}"> <img id="avatar" src="{{$userinfo.icon}}" alt="{{$userinfo.name}}">
<i class="fa fa-caret-down"></i> <i class="fa fa-caret-down"></i>
</div> </div>
@ -27,6 +29,9 @@
{{foreach $nav.usermenu as $usermenu}} {{foreach $nav.usermenu as $usermenu}}
<a class="dropdown-item{{if $usermenu.2}} active{{/if}}" href="{{$usermenu.0}}" title="{{$usermenu.3}}" role="menuitem" id="{{$usermenu.4}}">{{$usermenu.1}}</a> <a class="dropdown-item{{if $usermenu.2}} active{{/if}}" href="{{$usermenu.0}}" title="{{$usermenu.3}}" role="menuitem" id="{{$usermenu.4}}">{{$usermenu.1}}</a>
{{/foreach}} {{/foreach}}
{{if $nav.group}}
<a class="dropdown-item" href="{{$nav.group.0}}" title="{{$nav.group.3}}" role="menuitem" id="{{$nav.group.4}}">{{$nav.group.1}}</a>
{{/if}}
{{if $nav.manage}} {{if $nav.manage}}
<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> <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}}
@ -58,32 +63,34 @@
<a class="dropdown-item" href="{{$nav.rusermenu.2}}" role="menuitem">{{$nav.rusermenu.3}}</a> <a class="dropdown-item" href="{{$nav.rusermenu.2}}" role="menuitem">{{$nav.rusermenu.3}}</a>
</div> </div>
{{/if}} {{/if}}
</div> </div>
<div class="navbuttons navbar-nav mr-auto"> {{if $sel.name}}
<li class="nav-item dropdown"> <div id="nav-app-link-wrapper" class="navbar-nav{{if $sitelocation}} has_location{{/if}}">
<a href="channel" class="nav-link" title="Channel"><i class="fa fa-lg fa-fw fa-home"></i></a>
</li>
<li class="nav-item dropdown">
<a href="network" class="nav-link" title="Network"><i class="fa fa-lg fa-fw fa-th"></i></a>
</li>
</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"> <a id="nav-app-link" href="{{$url}}" class="nav-link text-truncate">
{{$sel.name}}
{{if $sitelocation}} {{if $sitelocation}}
<br><small>{{$sitelocation}}</small> <br><small>{{$sitelocation}}</small>
{{/if}} {{/if}}
</a> </a>
</div> </div>
{{/if}} {{if $settings_url}}
{{/if}} <div id="nav-app-settings-link-wrapper" class="navbar-nav">
<div class="navbar-toggler-right"> <a id="nav-app-settings-link" href="{{$settings_url}}/?f=&rpath={{$url}}" class="nav-link">
<i class="fa fa-fw fa-cog"></i>
</a>
</div>
{{/if}}
{{/if}}
</div>
{{/if}}
<div class="navbar-toggler-right">
{{if $nav.help.6}} {{if $nav.help.6}}
<button id="context-help-btn" class="navbar-toggler border-0" type="button" onclick="contextualHelp(); return false;"> <button id="context-help-btn" class="navbar-toggler border-0" type="button" onclick="contextualHelp(); return false;">
<i class="fa fa-question-circle"></i> <i class="fa fa-question-circle"></i>
</button> </button>
{{/if}} {{/if}}
<button id="expand-aside" type="button" class="d-lg-none 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">
<i class="fa fa-arrow-circle-right" id="expand-aside-icon"></i> <i class="fa fa-arrow-circle-right" id="expand-aside-icon"></i>
</button> </button>
{{if $localuser || $nav.pubs}} {{if $localuser || $nav.pubs}}
@ -91,12 +98,12 @@
<i id="notifications-btn-icon-1" class="fa fa-exclamation-circle notifications-btn-icon"></i> <i id="notifications-btn-icon-1" class="fa fa-exclamation-circle notifications-btn-icon"></i>
</button> </button>
{{/if}} {{/if}}
<button id="menu-btn" class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navbar-collapse-2"> <button id="menu-btn" class="navbar-toggler border-0" type="button" data-bs-toggle="offcanvas" data-bs-target="#app-bin">
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</button> </button>
</div> </div>
<div class="collapse navbar-collapse" id="navbar-collapse-1"> <div class="collapse navbar-collapse justify-content-between" id="navbar-collapse-1">
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav">
{{if $nav.login && !$userinfo}} {{if $nav.login && !$userinfo}}
<li class="nav-item"> <li class="nav-item">
<a href="help" class="nav-link {{if (substr($url,17,4)=="help")}} active{{/if}}" title="{{$nav.help.3}}"><i class="fa fa-fw fa-question-circle"></i></a> <a href="help" class="nav-link {{if (substr($url,17,4)=="help")}} active{{/if}}" title="{{$nav.help.3}}"><i class="fa fa-fw fa-question-circle"></i></a>
@ -106,11 +113,11 @@
</li> </li>
<li class="nav-item d-lg-flex"> <li class="nav-item d-lg-flex">
{{if $nav.loginmenu.1.4}} {{if $nav.loginmenu.1.4}}
<a class="nav-link{{if (substr($url,17,5)=="login")}} active{{/if}}" href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}" data-toggle="modal" data-target="#nav-login"> <a class="nav-link" href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}" data-bs-toggle="modal" data-bs-target="#nav-login">
{{$nav.loginmenu.1.1}} {{$nav.loginmenu.1.1}}
</a> </a>
{{else}} {{else}}
<a class="nav-link{{if (substr($url,17,5)=="login")}} active{{/if}}" href="login" title="{{$nav.loginmenu.1.3}}"> <a class="nav-link" href="login" title="{{$nav.loginmenu.1.3}}">
{{$nav.loginmenu.1.1}} {{$nav.loginmenu.1.1}}
</a> </a>
{{/if}} {{/if}}
@ -118,7 +125,7 @@
{{/if}} {{/if}}
{{if $nav.register}} {{if $nav.register}}
<li class="nav-item {{$nav.register.2}} d-lg-flex"> <li class="nav-item {{$nav.register.2}} d-lg-flex">
<a class="nav-link{{if (substr($url,17,8)=="register")}} active{{/if}}" href="{{$nav.register.0}}" title="{{$nav.register.3}}" id="{{$nav.register.4}}">{{$nav.register.1}}</a> <a class="nav-link" href="{{$nav.register.0}}" title="{{$nav.register.3}}" id="{{$nav.register.4}}">{{$nav.register.1}}</a>
</li> </li>
{{/if}} {{/if}}
{{if $nav.alogout}} {{if $nav.alogout}}
@ -130,10 +137,10 @@
<div id="banner" class="navbar-text">{{$banner}}</div> <div id="banner" class="navbar-text">{{$banner}}</div>
<ul id="nav-right" class="navbar-nav ml-auto"> <ul id="nav-right" class="navbar-nav">
<li class="nav-item collapse clearfix" id="nav-search"> <li class="nav-item collapse clearfix" id="nav-search">
<form class="form-inline" method="get" action="search" role="search"> <form class="form-inline" method="get" action="{{$nav.search.4}}" role="search">
<input class="form-control form-control-sm mt-1 mr-2" id="nav-search-text" type="text" value="" placeholder="{{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();" onblur="closeMenu('nav-search'); openMenu('nav-search-btn');"/> <input class="form-control form-control-sm mt-1 me-2" id="nav-search-text" type="text" value="" placeholder="{{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();" onblur="closeMenu('nav-search'); openMenu('nav-search-btn');"/>
</form> </form>
<div id="nav-search-spinner" class="spinner-wrapper"> <div id="nav-search-spinner" class="spinner-wrapper">
<div class="spinner s"></div> <div class="spinner s"></div>
@ -164,86 +171,245 @@
<a class="nav-link text-white notifications-btn" href="#"><i id="notifications-btn-icon" class="fa fa-exclamation-circle notifications-btn-icon"></i></a> <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> </li>
{{/if}} {{/if}}
{{if $localuser}}
<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 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>
{{/if}}
{{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">
{{foreach $channel_apps as $channel_app}}
{{$channel_app}}
{{/foreach}}
</div>
</li>
{{/if}}
{{if $navbar_apps}} {{if $navbar_apps}}
{{foreach $navbar_apps as $navbar_app}} {{foreach $navbar_apps as $navbar_app}}
<li> <li class="nav-app-sortable">
{{$navbar_app}} {{$navbar_app}}
</li> </li>
{{/foreach}} {{/foreach}}
{{/if}} {{/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>
</li>
</ul> </ul>
</div>
<div class="collapse d-lg-none" id="navbar-collapse-2">
<div class="navbar-nav mr-auto">
{{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>
<div id="sys-apps-collapsed" style="display:none;"> {{if $nav.help.6}}
{{/if}} <div id="contextual-help-content" class="contextual-help-content">
{{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}} {{$nav.help.5}}
<div class="float-right"> <div class="float-end">
<a class="btn btn-primary btn-sm" target="hubzilla-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}"><i class="fa fa-question"></i>&nbsp;{{$fulldocs}}</a> <a class="btn btn-primary btn-sm" target="hubzilla-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}"><i class="fa fa-question"></i>&nbsp;{{$fulldocs}}</a>
<a class="contextual-help-tool" href="#" onclick="contextualHelp(); return false;"><i class="fa fa-times"></i></a> <a class="contextual-help-tool" href="#" onclick="contextualHelp(); return false;"><i class="fa fa-times"></i></a>
</div> </div>
</div>
{{/if}}
</div> </div>
<div class="offcanvas offcanvas-end" tabindex="-1" id="app-bin" aria-labelledby="app-bin-label">
<div class="offcanvas-header">
<div class="lh-1" id="app-bin-label">
{{if $name}}
<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 pt-0">
{{if $channel_apps.0}}
<div class="dropdown-header text-uppercase">
{{$channelapps}}
</div>
{{foreach $channel_apps as $channel_app}}
{{$channel_app}}
{{/foreach}}
{{/if}}
{{if $navbar_apps.0}}
<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>
{{/if}}
{{if $is_owner}}
<div id="app-bin-container" data-token="{{$form_security_token}}">
<div class="dropdown-header text-uppercase">
{{$featured_apps}}
</div>
{{foreach $nav_apps as $nav_app}}
{{$nav_app}}
{{/foreach}}
</div>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/apps"><i class="generic-icons-nav fa fa-fw fa-plus"></i>{{$addapps}}</a>
{{else}}
<div class="dropdown-header text-uppercase">
{{$sysapps}}
</div>
{{foreach $nav_apps as $nav_app}}
{{$nav_app}}
{{/foreach}}
{{/if}}
</div>
</div>
{{if $is_owner}}
<script>
var app_bin = document.getElementById('app-bin-container');
new Sortable(app_bin, {
animation: 150,
delay: 200,
delayOnTouchOnly: true,
onEnd: function (e) {
let app_str = '';
$('#app-bin-container a').each(function () {
if(app_str.length) {
app_str = app_str.concat(',', $(this).text());
}
else {
app_str = app_str.concat($(this).text());
}
});
$.post(
'pconfig',
{
'aj' : 1,
'cat' : 'system',
'k' : 'app_order',
'v' : app_str,
'form_security_token' : $('#app-bin-container').data('token')
}
);
}
});
var nav_app_bin = document.getElementById('nav-right');
new Sortable(nav_app_bin, {
animation: 150,
delay: 200,
delayOnTouchOnly: true,
draggable: '.nav-app-sortable',
onEnd: function (e) {
let nav_app_str = '';
$('#nav-right .nav-app-sortable').each(function () {
if(nav_app_str.length) {
nav_app_str = nav_app_str.concat(',', $(this).text());
}
else {
nav_app_str = nav_app_str.concat($(this).text());
}
});
$.post(
'pconfig',
{
'aj' : 1,
'cat' : 'system',
'k' : 'app_pin_order',
'v' : nav_app_str,
'form_security_token' : $('#app-bin-container').data('token')
}
);
}
});
var nav_app_bin_container = document.getElementById('nav-app-bin-container');
new Sortable(nav_app_bin_container, {
animation: 150,
delay: 200,
delayOnTouchOnly: true,
onEnd: function (e) {
let nav_app_str = '';
$('#nav-app-bin-container a').each(function () {
if(nav_app_str.length) {
nav_app_str = nav_app_str.concat(',', $(this).text());
}
else {
nav_app_str = nav_app_str.concat($(this).text());
}
});
$.post(
'pconfig',
{
'aj' : 1,
'cat' : 'system',
'k' : 'app_pin_order',
'v' : nav_app_str,
'form_security_token' : $('#app-bin-container').data('token')
}
);
}
});
$('#nav-right').on('dragover', function (e) {
e.preventDefault();
e.stopPropagation();
$(this).css('box-shadow', '0px 0px 3px red inset');
});
$('#nav-right').on('dragleave', function (e) {
e.preventDefault();
e.stopPropagation();
$(this).css('box-shadow', '');
});
$('#nav-right').on('drop', function (e) {
e.preventDefault();
e.stopPropagation();
$(this).css('box-shadow', '');
if (papp === null)
return;
$.ajax({
type: 'post',
url: 'appman',
data: {
'aj' : 1,
'feature' : 'nav_pinned_app',
'papp' : papp
}
})
.done( function() {
$('<li><a class="navbar-app nav-link" href="' + app_url + '"><i class="fa fa-fw fa-' + app_icon + '"></i></li>').insertBefore('#app-menu');
});
});
$('#app-menu').on('dragover', function (e) {
e.preventDefault();
e.stopPropagation();
$(this).css('box-shadow', '0px 0px 1px red inset');
});
$('#app-menu').on('dragleave', function (e) {
e.preventDefault();
e.stopPropagation();
$(this).css('box-shadow', '');
});
$('#app-menu').on('drop', function (e) {
e.preventDefault();
e.stopPropagation();
$(this).css('box-shadow', '');
if (papp === null)
return;
$.ajax({
type: 'post',
url: 'appman',
data: {
'aj' : 1,
'feature' : 'nav_featured_app',
'papp' : papp
}
})
.done( function() {
$('<a class="dropdown-item" href="' + app_url + '"><i class="generic-icons-nav fa fa-fw fa-' + app_icon + '"></i>' + app_name + '</a>').appendTo('#app-bin-container');
});
});
var papp, app_icon, app_url;
$(document).on('dragstart', function (e) {
papp = e.target.dataset.papp || null;
app_icon = e.target.dataset.icon || null;
app_url = e.target.dataset.url || null;
app_name = e.target.dataset.name || null;
});
</script>
{{/if}} {{/if}}