diff --git a/static/scripts/app/views/dir.js b/static/scripts/app/views/dir.js index 4e7e68b484..0aef890613 100644 --- a/static/scripts/app/views/dir.js +++ b/static/scripts/app/views/dir.js @@ -89,6 +89,16 @@ define([ } } }); + + // hide 'rename form' + $(document).click(function(e) { + var target = e.target || event.srcElement; + var $form = $('#rename-form'); + if ($form.length && !$form.find('*').is(target)) { + $('.cancel', $form).click(); + } + }); + }, showDir: function(category, repo_id, path) { diff --git a/static/scripts/app/views/dirent.js b/static/scripts/app/views/dirent.js index b7fec6c749..1d566ab6e2 100644 --- a/static/scripts/app/views/dirent.js +++ b/static/scripts/app/views/dirent.js @@ -67,13 +67,13 @@ define([ }, highlight: function() { - if (app.globalState.noFileOpPopup) { + if (app.globalState.noFileOpPopup && !$('#rename-form').length) { this.$el.addClass('hl').find('.repo-file-op').removeClass('vh'); } }, rmHighlight: function() { - if (app.globalState.noFileOpPopup) { + if (app.globalState.noFileOpPopup && !$('#rename-form').length) { this.$el.removeClass('hl').find('.repo-file-op').addClass('vh'); } }, @@ -236,6 +236,8 @@ define([ $td.attr('colspan', 1).css({ 'width': $name.width() }); + + _this.$el.removeClass('hl').find('.repo-file-op').addClass('vh'); }; $('.cancel', form).click(cancelRename);