diff options
author | Sam Tuke <samtuke@owncloud.com> | 2012-09-12 14:10:12 +0100 |
---|---|---|
committer | Sam Tuke <samtuke@owncloud.com> | 2012-09-12 14:10:12 +0100 |
commit | 9bfdf47cd43139ca5c3fba255fd4486d06b6d72c (patch) | |
tree | 1627e430660141804d6143818659dd1222a5ea49 /apps/files_versions/js | |
parent | 0fe3354c61827b55708fc79f81d0edd2ca8b4c00 (diff) | |
download | nextcloud-server-9bfdf47cd43139ca5c3fba255fd4486d06b6d72c.tar.gz nextcloud-server-9bfdf47cd43139ca5c3fba255fd4486d06b6d72c.zip |
Fixed bug oc-1659 - history dialogue cannot be closed once opened
Diffstat (limited to 'apps/files_versions/js')
-rw-r--r-- | apps/files_versions/js/versions.js | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/apps/files_versions/js/versions.js b/apps/files_versions/js/versions.js index 1c8d083ea42..495848b8226 100644 --- a/apps/files_versions/js/versions.js +++ b/apps/files_versions/js/versions.js @@ -11,24 +11,33 @@ $(document).ready(function() { $(document).ready(function(){ if (typeof FileActions !== 'undefined') { // Add history button to files/index.php - FileActions.register('file','History', OC.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/history');},function(filename){ - - if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback - - var file = $('#dir').val()+'/'+filename; - // Check if drop down is already visible for a different file - if (($('#dropdown').length > 0)) { - if (file != $('#dropdown').data('file')) { - $('#dropdown').hide('blind', function() { - $('#dropdown').remove(); - $('tr').removeClass('mouseOver'); - createVersionsDropdown(filename, file); - }); + FileActions.register( + 'file' + ,'History' + , OC.PERMISSION_UPDATE + , function() { + // Specify icon for hitory button + return OC.imagePath('core','actions/history'); + } + ,function(filename){ + // Action to perform when clicked + if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback + + var file = $('#dir').val()+'/'+filename; + // Check if drop down is already visible for a different file + if (($('#dropdown').length > 0)) { + if (file != $('#dropdown').data('file')) { + $('#dropdown').hide('blind', function() { + $('#dropdown').remove(); + $('tr').removeClass('mouseOver'); + createVersionsDropdown(filename, file); + }); + } + } else { + createVersionsDropdown(filename, file); } - } else { - createVersionsDropdown(filename, file); } - }); + ); } }); @@ -42,7 +51,6 @@ function createVersionsDropdown(filename, files) { html += '<option value=""></option>'; html += '</select>'; html += '</div>'; - //html += '<input type="button" value="Revert file" onclick="revertFile()" />'; html += '<input type="button" value="All versions..." onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" />'; html += '<input id="link" style="display:none; width:90%;" />'; @@ -60,9 +68,7 @@ function createVersionsDropdown(filename, files) { data: { source: files }, async: false, success: function( versions ) { - - //alert("helo "+OC.linkTo('files_versions', 'ajax/getVersions.php')); - + if (versions) { $.each( versions, function(index, row ) { addVersion( row ); @@ -103,7 +109,7 @@ function createVersionsDropdown(filename, files) { } - function addVersion(revision ) { + function addVersion( revision ) { name=formatDate(revision.version*1000); var version=$('<option/>'); version.attr('value',revision.version); @@ -122,8 +128,23 @@ function createVersionsDropdown(filename, files) { version.appendTo('#found_versions'); } - + + $('tr').filterAttr('data-file',filename).addClass('mouseOver'); $('#dropdown').show('blind'); } + +$(this).click( + function(event) { + + if ($('#dropdown').has(event.target).length === 0) { + $('#dropdown').hide('blind', function() { + $('#dropdown').remove(); + $('tr').removeClass('mouseOver'); + }); + } + + + } +);
\ No newline at end of file |