]> source.dussan.org Git - nextcloud-server.git/commitdiff
only add versions if the drop down was added
authorBjörn Schießle <schiessle@owncloud.com>
Tue, 23 Jul 2013 08:49:19 +0000 (10:49 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Tue, 23 Jul 2013 08:49:19 +0000 (10:49 +0200)
apps/files_versions/js/versions.js

index 0b8bc41f25505722acba48ee832125ed62e5ed5e..f0c1f356f3b6e61215693b5c5abc4175ba6a59d2 100644 (file)
@@ -51,6 +51,7 @@ function createVersionsDropdown(filename, files) {
                async: false,
                success: function( versions ) {
 
+                       // first decide which kind of dialog we need
                        if (versions) {
 
                                var html = '<div id="dropdown" class="drop drop-versions" data-file="'+escapeHTML(files)+'">';
@@ -62,9 +63,6 @@ function createVersionsDropdown(filename, files) {
                                html += '<input type="button" value="All versions..." name="makelink" id="makelink" />';
                                html += '<input id="link" style="display:none; width:90%;" />';
 
-                               $.each( versions, function(index, row ) {
-                                       addVersion( row );
-                               });
                        } else {
                                var html = '<div id="dropdown" class="drop drop-versions" data-file="'+escapeHTML(files)+'">';
                                html += '<div style="text-align:center;">No other versions available</div></div>';
@@ -77,6 +75,13 @@ function createVersionsDropdown(filename, files) {
                                $(html).appendTo($('thead .share'));
                        }
 
+                       // if versions are available populate the dialog
+                       if (versions) {
+                               $.each( versions, function(index, row ) {
+                                       addVersion( row );
+                               });
+                       }
+
                        $('#found_versions').change(function(){
                                var revision=parseInt($(this).val());
                                revertFile(files,revision);