]> git.mxchange.org Git - friendica.git/commitdiff
item deletion: use js to delete items. so we don't have to reload the page
authorrabuzarus <>
Wed, 11 May 2016 14:04:11 +0000 (16:04 +0200)
committerrabuzarus <>
Wed, 11 May 2016 14:04:11 +0000 (16:04 +0200)
css/style.css
js/textedit.js
js/theme.js
templates/jot-header.tpl
templates/search_item.tpl
templates/threaded_conversation.tpl
templates/wall_thread.tpl

index 949c9eef85f270a8b106a9362f3ae4f59a43e02a..942b89b55035a26861cdcbc5070ce160a756a177 100644 (file)
@@ -84,6 +84,22 @@ iframe, img {
     line-height: 1.5;
 }
 
+a#item-delete-selected {
+    cursor: pointer;
+    color: white;
+    position: fixed;
+    z-index: 49;
+    right: 20px;
+    top: 100px;
+    opacity: 0.8;
+    font-size: 2.9em;
+    padding: 0 12px 0 12px;
+    border-radius: 10px;
+    background-color: $link_color;
+    line-height: 1.5;
+    display: none;
+}
+
 /*
 * Overwriting and Extend Bootstrap
 */
index f9944d5ff70d0a7056fd97cfe0e4b29cd728648d..40b49685a7b713d3f77ee51e8184143ff3bcbaca 100644 (file)
@@ -178,3 +178,18 @@ function qCommentInsert(obj,id) {
 }
 
 function confirmDelete() { return confirm(aStr.delitem); }
+
+function dropItem(url, object) {
+       var confirm = confirmDelete();
+       if(confirm) {
+               $('body').css('cursor', 'wait');
+               $(object).fadeTo('fast', 0.33, function () {
+                       $.get(url).done(function() {
+                               $(object).remove();
+                               $('body').css('cursor', 'auto');
+                       });
+               });
+       }
+}
+
+       
\ No newline at end of file
index 1fa89c00b90f01f423782c3338df408d64a00a57..5cc5e49f0220301ce30c654174f55bc2684dc472 100644 (file)
@@ -68,6 +68,21 @@ $(document).ready(function(){
                if( $("#jot-popup").is(":hidden")) $("#topbar-second > .container > #navbar-button #jotOpen").hide();
        }
 
+       // show bulk deletion button at network page if checkbox is checked
+       $('input.item-select').change(function(){
+
+               if($(this).is(':checked')) {
+                       $("a#item-delete-selected").fadeTo('slow', 1);
+                       $("a#item-delete-selected").show();
+               } else {
+                       $("a#item-delete-selected").fadeTo('slow', 0, function(){
+                               $("a#item-delete-selected").hide();
+                       });
+                       
+               }
+
+       });
+
        // add search-headding to the scecond navbar
        if( $(".search-headding")) {
                $(".search-headding").appendTo("#topbar-second > .container > #tabmenu");
index f5b50b5595afb1796a9f0d65ed8b5022949371f3..5b826f45e2f41d06e59dedb098ff9f12de4b3578 100644 (file)
@@ -204,26 +204,46 @@ function enableOnUser(){
                **/
        });
 
-
        function deleteCheckedItems() {
                if(confirm('{{$delitems}}')) {
                        var checkedstr = '';
+                       var ItemsToDelete = {};
 
                        $("#item-delete-selected").hide();
                        $('#item-delete-selected-rotator').show();
+                       $('body').css('cursor', 'wait');
 
                        $('.item-select').each( function() {
                                if($(this).is(':checked')) {
                                        if(checkedstr.length != 0) {
                                                checkedstr = checkedstr + ',' + $(this).val();
+                                               var deleteItem = this.closest(".wall-item-container");
+                                               ItemsToDelete[deleteItem.id] = deleteItem;
                                        }
                                        else {
                                                checkedstr = $(this).val();
                                        }
+
+                                       // Get the corresponding item container
+                                       var deleteItem = this.closest(".wall-item-container");
+                                       ItemsToDelete[deleteItem.id] = deleteItem;
                                }
                        });
+
+                       // Fade the the the container from the items we want to delete
+                       for(var key in  ItemsToDelete) {
+                               $(ItemsToDelete[key]).fadeTo('fast', 0.33);
+                       };
+
                        $.post('item', { dropitems: checkedstr }, function(data) {
-                               window.location.reload();
+                       }).done(function() {
+                               // Loop through the ItemsToDelete Object and remove
+                               // corresponding item div
+                               for(var key in  ItemsToDelete) {
+                                       $(ItemsToDelete[key]).remove();
+                               }
+                               $('body').css('cursor', 'auto');
+                               $('#item-delete-selected-rotator').hide();
                        });
                }
        }
index da5b0d8e98a1f350ec1c4d5b1003d1fb9618bf68..d2f0b23785b07e008d89346de53a54df1f755da7 100644 (file)
@@ -19,7 +19,7 @@
                                        <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenuTools-{{$item.id}}">
                                                {{if $item.edpost}} {{* edit the posting *}}
                                                <li role="menuitem">
-                                                       <a href="#" href="{{$item.edpost.0}}" title="{{$item.edpost.1}}" class="navicon delete"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</a>
+                                                       <a href="#" href="{{$item.edpost.0}}" title="{{$item.edpost.1}}" class="navicon pencil"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</a>
                                                </li>
                                                {{/if}}
 
@@ -45,7 +45,7 @@
                                                {{if $item.drop.dropping}}
                                                <li role="separator" class="divider"></li>
                                                <li role="menuitem">
-                                                       <a href="item/drop/{{$item.id}}" class="navicon delete" onclick="return confirmDelete();" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</a>
+                                                       <a class="navicon delete" onclick="dropItem('item/drop/{{$item.id}}', '#item-{{$item.guid}}'); return false();" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</a>
                                                </li>
                                                {{/if}}
                                        </ul>
index 48a3f4ed6c73d9b87a69f9b0538f2fda71ba7f6c..f60ce345a812f28188819c67c35e3e85c3b278f3 100644 (file)
@@ -16,8 +16,8 @@
 <div id="conversation-end"></div>
 
 {{if $dropping}}
-<a id="item-delete-selected" href="#" onclick="deleteCheckedItems();return false;">
-       <span class="icon s22 delete text">{{$dropping}}</span>
+<a id="item-delete-selected" class="" href="#" title="{{$dropping}}" onclick="deleteCheckedItems();return false;" data-toggle="tooltip">
+       <i class="fa fa-trash" aria-hidden="true"></i>
 </a>
 <img id="item-delete-selected-rotator" class="like-rotator" src="images/rotator.gif" style="display: none;" />
 {{/if}}
index eaeb23c98e788cadffd997e26d38c8294d6cb2c4..3fa53764d0fca7c369e15c60d13c255f7786309a 100644 (file)
@@ -90,7 +90,7 @@ as the value of $top_child_total (this is done at the end of this file)
 
                                        {{if $item.edpost}} {{* edit the posting *}}
                                        <li role="menuitem">
-                                               <a href="#" onclick="editpost('{{$item.edpost.0}}?mode=modal'); return false;" title="{{$item.edpost.1}}" class="navicon delete"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</a>
+                                               <a href="#" onclick="editpost('{{$item.edpost.0}}?mode=modal'); return false;" title="{{$item.edpost.1}}" class="navicon pencil"><i class="fa fa-pencil"></i> {{$item.edpost.1}}</a>
                                        </li>
                                        {{/if}}
 
@@ -128,7 +128,7 @@ as the value of $top_child_total (this is done at the end of this file)
 
                                        {{if $item.drop.dropping}}
                                        <li role="menuitem">
-                                               <a href="item/drop/{{$item.id}}" class="navicon delete" onclick="return confirmDelete();" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</a>
+                                               <a class="navicon delete" onclick="dropItem('item/drop/{{$item.id}}', '#item-{{$item.guid}}'); return false();" title="{{$item.drop.delete}}"><i class="fa fa-trash"></i> {{$item.drop.delete}}</a>
                                        </li>
                                        {{/if}}
                                </ul>