This commit is contained in:
ivan 2021-12-14 22:44:24 +03:00
parent b001e6763b
commit d6ffbc416c
1 changed files with 239 additions and 198 deletions

View File

@ -1,4 +1,5 @@
<div class="container-fluid">
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid flex-nowrap">
{{if $nav.login && !$userinfo}}
<div class="d-lg-none pt-1 pb-1">
{{if $nav.loginmenu.1.4}}
@ -18,7 +19,7 @@
</div>
{{/if}}
{{if $userinfo}}
<div class="d-flex justify-content-start">
<div class="d-flex" style="max-width: 50%">
<div class="dropdown">
<div class="fakelink usermenu" data-bs-toggle="dropdown">
<img id="avatar" src="{{$userinfo.icon}}" alt="{{$userinfo.name}}">
@ -66,7 +67,7 @@
</div>
{{if $sel.name}}
<div id="nav-app-link-wrapper" class="navbar-nav{{if $sitelocation}} has_location{{/if}}">
<a id="nav-app-link" href="{{$url}}" class="nav-link text-truncate">
<a id="nav-app-link" href="{{$url}}" class="nav-link text-truncate" style="width: 100%">
{{$sel.name}}
{{if $sitelocation}}
<br><small>{{$sitelocation}}</small>
@ -193,6 +194,7 @@
</div>
{{/if}}
</div>
</nav>
<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">
@ -204,6 +206,7 @@
</div>
{{/if}}
</div>
<i id="app-bin-trash" class="fa fa-2x fa-fw fa-trash-o d-none"></i>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body pt-0">
@ -216,20 +219,20 @@
{{/foreach}}
{{/if}}
{{if $navbar_apps.0}}
<div id="nav-app-bin-container" class="d-lg-none">
<div class="dropdown-header text-uppercase">
<div class="d-lg-none dropdown-header text-uppercase">
{{$pinned_apps}}
</div>
<div id="nav-app-bin-container" class="d-lg-none">
{{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>
<div id="app-bin-container" data-token="{{$form_security_token}}">
{{foreach $nav_apps as $nav_app}}
{{$nav_app}}
{{/foreach}}
@ -253,14 +256,19 @@
animation: 150,
delay: 200,
delayOnTouchOnly: true,
onStart: function (e) {
$('#app-bin-trash').removeClass('d-none');
},
onEnd: function (e) {
$('#app-bin-trash').addClass('d-none');
let app_str = '';
$('#app-bin-container a').each(function () {
$('#app-bin-container a:visible').each(function () {
if(app_str.length) {
app_str = app_str.concat(',', $(this).text());
app_str = app_str.concat(',', this.text);
}
else {
app_str = app_str.concat($(this).text());
app_str = app_str.concat(this.text);
}
});
$.post(
@ -404,6 +412,39 @@
});
$('#app-bin-trash').on('dragover', function (e) {
e.preventDefault();
e.stopPropagation();
$('#app-bin-container a[href=\'' + app_url + '\']').fadeOut();
});
$('#app-bin-trash').on('dragleave', function (e) {
e.preventDefault();
e.stopPropagation();
$('#app-bin-container a[href=\'' + app_url + '\']').fadeIn();
});
$('#app-bin-trash').on('drop', function (e) {
e.preventDefault();
e.stopPropagation();
if (papp === null)
return;
$.ajax({
type: 'post',
url: 'appman',
data: {
'aj' : 1,
'feature' : 'nav_featured_app',
'papp' : papp
}
});
});
var papp, app_icon, app_url;
$(document).on('dragstart', function (e) {
papp = e.target.dataset.papp || null;