diff options
author | Mario <mario@mariovavti.com> | 2021-09-27 11:13:16 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-09-27 11:13:16 +0000 |
commit | 14004fbf7f9762dab6b8ecd7f39fb6c9565dd5e0 (patch) | |
tree | 5d862a6de823c1f68641c3346793fb5281bb7d48 | |
parent | 73e8af98f21f69195f723782c69243e0d7237780 (diff) | |
download | volse-hubzilla-14004fbf7f9762dab6b8ecd7f39fb6c9565dd5e0.tar.gz volse-hubzilla-14004fbf7f9762dab6b8ecd7f39fb6c9565dd5e0.tar.bz2 volse-hubzilla-14004fbf7f9762dab6b8ecd7f39fb6c9565dd5e0.zip |
support un-starring of apps in app bin
-rw-r--r-- | view/tpl/app_nav.tpl | 2 | ||||
-rw-r--r-- | view/tpl/app_nav_pinned.tpl | 2 | ||||
-rw-r--r-- | view/tpl/navbar_default.tpl | 53 |
3 files changed, 48 insertions, 9 deletions
diff --git a/view/tpl/app_nav.tpl b/view/tpl/app_nav.tpl index 0d6e66892..c3a7bc8b6 100644 --- a/view/tpl/app_nav.tpl +++ b/view/tpl/app_nav.tpl @@ -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> diff --git a/view/tpl/app_nav_pinned.tpl b/view/tpl/app_nav_pinned.tpl index b114ed19e..bf942dd48 100644 --- a/view/tpl/app_nav_pinned.tpl +++ b/view/tpl/app_nav_pinned.tpl @@ -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> diff --git a/view/tpl/navbar_default.tpl b/view/tpl/navbar_default.tpl index eae74daca..e2cda2db7 100644 --- a/view/tpl/navbar_default.tpl +++ b/view/tpl/navbar_default.tpl @@ -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; |