diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-23 02:16:21 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-23 02:16:21 -0800 |
commit | 97ed467224b77dff4d30a88707eb30e6a7728f25 (patch) | |
tree | 81283b1bdf293709e396387217d6bc97aa5bae8b | |
parent | 3688376a6f0d2e1ba0a98345aba0d7b82940db4a (diff) | |
parent | eda9ce4cf8059b88c9c8e65037548357fc792257 (diff) | |
download | nextcloud-server-97ed467224b77dff4d30a88707eb30e6a7728f25.tar.gz nextcloud-server-97ed467224b77dff4d30a88707eb30e6a7728f25.zip |
Merge pull request #418 from libasys/Fix-IE8-fileactions-binding
Fixes two issues if you using IE8. IE8 has problems with .bind actions a...
-rw-r--r-- | apps/files/js/fileactions.js | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 40dd9f14a69..80b9c01f838 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -70,34 +70,43 @@ var FileActions = { } parent.children('a.name').append('<span class="fileactions" />'); var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions()); - var actionHandler = function (parent, action, event) { + + var actionHandler = function (event) { event.stopPropagation(); event.preventDefault(); - FileActions.currentFile = parent; - file = FileActions.getCurrentFile(); - action(file); + + FileActions.currentFile = event.data.elem; + var file = FileActions.getCurrentFile(); + + event.data.actionFunc(file); }; - for (name in actions) { + + $.each(actions, function (name, action) { // NOTE: Temporary fix to prevent rename action in root of Shared directory if (name === 'Rename' && $('#dir').val() === '/Shared') { - continue; + return true; } - if ((name === 'Download' || actions[name] !== defaultAction) && name !== 'Delete') { + + if ((name === 'Download' || action !== defaultAction) && name !== 'Delete') { var img = FileActions.icons[name]; if (img.call) { img = img(file); } var html = '<a href="#" class="action" data-action="'+name+'">'; if (img) { - html += '<img class ="svg" src="' + img + '"/> '; + html += '<img class ="svg" src="' + img + '" /> '; } html += t('files', name) + '</a>'; + var element = $(html); element.data('action', name); - element.click(actionHandler.bind(null, parent, actions[name])); + //alert(element); + element.on('click',{a:null, elem:parent, actionFunc:actions[name]},actionHandler); parent.find('a.name>span.fileactions').append(element); } - } + + }); + if (actions['Delete']) { var img = FileActions.icons['Delete']; if (img.call) { @@ -114,7 +123,7 @@ var FileActions = { element.append($('<img class ="svg" src="' + img + '"/>')); } element.data('action', actions['Delete']); - element.click(actionHandler.bind(null, parent, actions['Delete'])); + element.on('click',{a:null, elem:parent, actionFunc:actions['Delete']},actionHandler); parent.parent().children().last().append(element); } }, |