]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix notify user, and made js more resiliant to changes
authorRamiro Aparicio <rapariciog@gmail.com>
Mon, 21 Oct 2013 14:14:23 +0000 (16:14 +0200)
committerRamiro Aparicio <rapariciog@gmail.com>
Mon, 21 Oct 2013 14:14:23 +0000 (16:14 +0200)
core/ajax/share.php
core/js/share.js

index dbad8f2e971e12a8a4223dcfd9a01de3cf43ebe7..77529c620db47a4c6aa6241b1c03e01a4fb04067 100644 (file)
@@ -83,7 +83,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
                                ($return) ? OC_JSON::success() : OC_JSON::error();
                        }
                        break;
-       case 'informRecipients':
+               case 'informRecipients':
 
                        $l = OC_L10N::get('core');
 
index 6ec15f01c1eaaadd53a5863f80af332520a80497..1e61360f8a1d97d1bcc4e2e9e34af3616662fd11 100644 (file)
@@ -540,13 +540,13 @@ $(document).ready(function() {
        });
 
        $(document).on('click', '#dropdown .unshare', function() {
-               var li = $(this).parent();
+               var $li = $(this).closest('li');
                var itemType = $('#dropdown').data('item-type');
                var itemSource = $('#dropdown').data('item-source');
-               var shareType = $(li).data('share-type');
-               var shareWith = $(li).data('share-with');
+               var shareType = $li.data('share-type');
+               var shareWith = $li.data('share-with');
                OC.Share.unshare(itemType, itemSource, shareType, shareWith, function() {
-                       $(li).remove();
+                       $li.remove();
                        var index = OC.Share.itemShares[shareType].indexOf(shareWith);
                        OC.Share.itemShares[shareType].splice(index, 1);
                        OC.Share.updateIcon(itemType, itemSource);
@@ -558,8 +558,8 @@ $(document).ready(function() {
        });
 
        $(document).on('change', '#dropdown .permissions', function() {
+               var li = $(this).closest('li');
                if ($(this).attr('name') == 'edit') {
-                       var li = $(this).parent().parent();
                        var checkboxes = $('.permissions', li);
                        var checked = $(this).is(':checked');
                        // Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck
@@ -567,7 +567,6 @@ $(document).ready(function() {
                        $(checkboxes).filter('input[name="update"]').attr('checked', checked);
                        $(checkboxes).filter('input[name="delete"]').attr('checked', checked);
                } else {
-                       var li = $(this).parent().parent().parent();
                        var checkboxes = $('.permissions', li);
                        // Uncheck Edit if Create, Update, and Delete are not checked
                        if (!$(this).is(':checked')
@@ -590,8 +589,8 @@ $(document).ready(function() {
                });
                OC.Share.setPermissions($('#dropdown').data('item-type'),
                        $('#dropdown').data('item-source'),
-                       $(li).data('share-type'),
-                       $(li).data('share-with'),
+                       li.data('share-type'),
+                       li.data('share-with'),
                        permissions);
        });
 
@@ -745,7 +744,7 @@ $(document).ready(function() {
        });
 
        $(document).on('click', '#dropdown input[name=mailNotification]', function() {
-               var li = $(this).parent();
+               var $li = $(this).closest('li');
                var itemType = $('#dropdown').data('item-type');
                var itemSource = $('#dropdown').data('item-source');
                var action = '';
@@ -755,8 +754,8 @@ $(document).ready(function() {
                        action = 'informRecipientsDisabled';
                }
 
-               var shareType = $(li).data('share-type');
-               var shareWith = $(li).data('share-with');
+               var shareType = $li.data('share-type');
+               var shareWith = $li.data('share-with');
 
                $.post(OC.filePath('core', 'ajax', 'share.php'), {action: action, recipient: shareWith, shareType: shareType, itemSource: itemSource, itemType: itemType}, function(result) {
                        if (result.status !== 'success') {