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}} {{if $nav.login && !$userinfo}}
<div class="d-lg-none pt-1 pb-1"> <div class="d-lg-none pt-1 pb-1">
{{if $nav.loginmenu.1.4}} {{if $nav.loginmenu.1.4}}
@ -18,7 +19,7 @@
</div> </div>
{{/if}} {{/if}}
{{if $userinfo}} {{if $userinfo}}
<div class="d-flex justify-content-start"> <div class="d-flex" style="max-width: 50%">
<div class="dropdown"> <div class="dropdown">
<div class="fakelink usermenu" data-bs-toggle="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}}">
@ -66,7 +67,7 @@
</div> </div>
{{if $sel.name}} {{if $sel.name}}
<div id="nav-app-link-wrapper" class="navbar-nav{{if $sitelocation}} has_location{{/if}}"> <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}} {{$sel.name}}
{{if $sitelocation}} {{if $sitelocation}}
<br><small>{{$sitelocation}}</small> <br><small>{{$sitelocation}}</small>
@ -192,7 +193,8 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
</div> </div>
</nav>
<div class="offcanvas offcanvas-end" tabindex="-1" id="app-bin" aria-labelledby="app-bin-label"> <div class="offcanvas offcanvas-end" tabindex="-1" id="app-bin" aria-labelledby="app-bin-label">
<div class="offcanvas-header"> <div class="offcanvas-header">
<div class="lh-1" id="app-bin-label"> <div class="lh-1" id="app-bin-label">
@ -204,6 +206,7 @@
</div> </div>
{{/if}} {{/if}}
</div> </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> <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div> </div>
<div class="offcanvas-body pt-0"> <div class="offcanvas-body pt-0">
@ -216,20 +219,20 @@
{{/foreach}} {{/foreach}}
{{/if}} {{/if}}
{{if $navbar_apps.0}} {{if $navbar_apps.0}}
<div id="nav-app-bin-container" class="d-lg-none"> <div class="d-lg-none dropdown-header text-uppercase">
<div class="dropdown-header text-uppercase">
{{$pinned_apps}} {{$pinned_apps}}
</div> </div>
<div id="nav-app-bin-container" class="d-lg-none">
{{foreach $navbar_apps as $navbar_app}} {{foreach $navbar_apps as $navbar_app}}
{{$navbar_app|replace:'navbar-app nav-link':'dropdown-item nav-app-sortable'|replace:'fa':'generic-icons-nav fa'}} {{$navbar_app|replace:'navbar-app nav-link':'dropdown-item nav-app-sortable'|replace:'fa':'generic-icons-nav fa'}}
{{/foreach}} {{/foreach}}
</div> </div>
{{/if}} {{/if}}
{{if $is_owner}} {{if $is_owner}}
<div id="app-bin-container" data-token="{{$form_security_token}}">
<div class="dropdown-header text-uppercase"> <div class="dropdown-header text-uppercase">
{{$featured_apps}} {{$featured_apps}}
</div> </div>
<div id="app-bin-container" data-token="{{$form_security_token}}">
{{foreach $nav_apps as $nav_app}} {{foreach $nav_apps as $nav_app}}
{{$nav_app}} {{$nav_app}}
{{/foreach}} {{/foreach}}
@ -253,14 +256,19 @@
animation: 150, animation: 150,
delay: 200, delay: 200,
delayOnTouchOnly: true, delayOnTouchOnly: true,
onStart: function (e) {
$('#app-bin-trash').removeClass('d-none');
},
onEnd: function (e) { onEnd: function (e) {
$('#app-bin-trash').addClass('d-none');
let app_str = ''; let app_str = '';
$('#app-bin-container a').each(function () { $('#app-bin-container a:visible').each(function () {
if(app_str.length) { if(app_str.length) {
app_str = app_str.concat(',', $(this).text()); app_str = app_str.concat(',', this.text);
} }
else { else {
app_str = app_str.concat($(this).text()); app_str = app_str.concat(this.text);
} }
}); });
$.post( $.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; var papp, app_icon, app_url;
$(document).on('dragstart', function (e) { $(document).on('dragstart', function (e) {
papp = e.target.dataset.papp || null; papp = e.target.dataset.papp || null;