support un-starring of apps in app bin

This commit is contained in:
Mario
2021-09-27 11:13:16 +00:00
parent 73e8af98f2
commit 14004fbf7f
3 changed files with 48 additions and 9 deletions

View File

@@ -1 +1 @@
<a class="dropdown-item{{if $app.active}} active{{/if}}" href="{{$app.url}}">{{if $icon}}<i class="generic-icons-nav fa fa-fw fa-{{$icon}}"></i>{{else}}<img src="{{$app.photo}}" width="16" height="16" style="margin-right:9px;"/>{{/if}}{{$app.name}}</a>
<a class="dropdown-item{{if $app.active}} active{{/if}}" href="{{$app.url}}" data-papp="{{$app.papp}}" data-icon="{{$icon}}" data-url="{{$app.url}}" data-name="{{$app.name}}">{{if $icon}}<i class="generic-icons-nav fa fa-fw fa-{{$icon}}"></i>{{else}}<img src="{{$app.photo}}" width="16" height="16" style="margin-right:9px;"/>{{/if}}{{$app.name}}</a>

View File

@@ -1,4 +1,4 @@
<a class="navbar-app nav-link{{if $app.active}} active{{/if}}" href="{{$app.url}}" title="{{$app.name}}" >
<a class="navbar-app nav-link{{if $app.active}} active{{/if}}" href="{{$app.url}}" title="{{$app.name}}">
{{if $icon}}
<i class="fa fa-fw fa-{{$icon}}"></i>
<span class="d-lg-none">{{$app.name}}</span>

View File

@@ -157,7 +157,7 @@
{{if $navbar_apps}}
{{foreach $navbar_apps as $navbar_app}}
<li class="nav-app-sortable">
{{$navbar_app}}
{{$navbar_app}}
</li>
{{/foreach}}
{{/if}}
@@ -188,6 +188,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">
@@ -210,10 +211,10 @@
</div>
{{/if}}
{{if $is_owner}}
<div class="dropdown-header text-uppercase">
{{$featured_apps}}
</div>
<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}}
@@ -237,14 +238,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(
@@ -388,6 +394,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;