From 2ec9bf9048b86092c3c31a150df75eae753df7c1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 5 Feb 2019 21:40:56 +0100 Subject: [PATCH] UI: Fixes for repo topic editor (#5971) - Properly hides the edit interface when saving a empty topic list - Align the Done button with the edit box --- public/js/index.js | 15 +++++++-------- templates/repo/home.tmpl | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index c69cb753d..810d83534 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2635,16 +2635,15 @@ function initTopicbar() { }, function(data, textStatus, xhr){ if (xhr.responseJSON.status === 'ok') { viewDiv.children(".topic").remove(); - if (topics.length === 0) { - return - } - var topicArray = topics.split(","); + if (topics.length) { + var topicArray = topics.split(","); - var last = viewDiv.children("a").last(); - for (var i=0; i < topicArray.length; i++) { - $('
'+topicArray[i]+'
').insertBefore(last) + var last = viewDiv.children("a").last(); + for (var i=0; i < topicArray.length; i++) { + $('
'+topicArray[i]+'
').insertBefore(last) + } } - editDiv.css('display', 'none'); // hide Semantic UI Grid + editDiv.css('display', 'none'); viewDiv.show(); } }).fail(function(xhr){ diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 72c0e47ed..5a08a95ad 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -41,7 +41,7 @@
- {{.i18n.Tr "repo.topic.done"}}