]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix #2711 using a custom event, also use css selectors over filterAttr
authorJörn Friedrich Dreyer <jfd@butonic.de>
Thu, 8 Aug 2013 11:50:04 +0000 (13:50 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Thu, 15 Aug 2013 21:10:39 +0000 (23:10 +0200)
apps/files/js/fileactions.js
apps/files_sharing/js/share.js
core/js/share.js

index 14fca6f14829cfab7344d06af04115e22634a481..3044a9da33f67e149196511618bb33d05bd33cf0 100644 (file)
@@ -65,7 +65,7 @@ var FileActions = {
                FileActions.currentFile = parent;
                var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
                var file = FileActions.getCurrentFile();
-               if ($('tr').filterAttr('data-file', file).data('renaming')) {
+               if ($('tr[data-file="'+file+'"]').data('renaming')) {
                        return;
                }
                parent.children('a.name').append('<span class="fileactions" />');
@@ -164,10 +164,11 @@ $(document).ready(function () {
                        window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val());
                });
        }
-
        $('#fileList tr').each(function () {
                FileActions.display($(this).children('td.filename'));
        });
+       
+       $('#fileList').trigger(jQuery.Event("fileActionsReady"));
 
 });
 
index eb5a6e8cb7fe27e001353a3e348757e60b4638a9..b2efafde4e78868fcd062582bdad7e6c2c15d685 100644 (file)
@@ -4,6 +4,10 @@ $(document).ready(function() {
 
        if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined'  && !disableSharing) {
 
+               $('#fileList').one('fileActionsReady',function(){
+                       OC.Share.loadIcons('file');
+               });
+
                FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
                        if ($('#dir').val() == '/') {
                                var item = $('#dir').val() + filename;
@@ -33,6 +37,5 @@ $(document).ready(function() {
                                OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
                        }
                });
-               OC.Share.loadIcons('file');
        }
-});
+});
\ No newline at end of file
index 8825186f23d00235b3c2b269bdd76e23e536b533..6292877719fcfbd93558af92853c23433d2595ec 100644 (file)
@@ -22,9 +22,9 @@ OC.Share={
                                        if (itemType != 'file' && itemType != 'folder') {
                                                $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
                                        } else {
-                                               var file = $('tr').filterAttr('data-id', item);
+                                               var file = $('tr[data-id="'+item+'"]');
                                                if (file.length > 0) {
-                                                       var action = $(file).find('.fileactions .action').filterAttr('data-action', 'Share');
+                                                       var action = $(file).find('.fileactions .action[data-action="Share"]');
                                                        var img = action.find('img').attr('src', image);
                                                        action.addClass('permanent');
                                                        action.html(' '+t('core', 'Shared')).prepend(img);
@@ -36,7 +36,7 @@ OC.Share={
                                                                // Search for possible parent folders that are shared
                                                                while (path != last) {
                                                                        if (path == data['path']) {
-                                                                               var actions = $('.fileactions .action').filterAttr('data-action', 'Share');
+                                                                               var actions = $('.fileactions .action[data-action="Share"]');
                                                                                $.each(actions, function(index, action) {
                                                                                        var img = $(action).find('img');
                                                                                        if (img.attr('src') != OC.imagePath('core', 'actions/public')) {