From 0b31956888714fcf408537def7064104f59f6343 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Thu, 6 Aug 2015 10:07:30 +0200 Subject: [PATCH] fix issue #3136 behavior: - When you enter the first time the loader is open, I increase maximum open time to 15s. - On the first load the search page opens the first tab with content. - When you search in the left bar a loader appears on the input and your current tab doesn't change even if you don't have content in the tab. --- app/coffee/modules/common/loader.coffee | 7 ------ app/coffee/modules/search.coffee | 29 ++++++++++++++++++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/coffee/modules/common/loader.coffee b/app/coffee/modules/common/loader.coffee index 4ebc0215..aebc6a30 100644 --- a/app/coffee/modules/common/loader.coffee +++ b/app/coffee/modules/common/loader.coffee @@ -77,13 +77,6 @@ Loader = ($rootscope) -> lastResponseDate = 0 autoClose = () -> - maxAuto = 5000 - timeoutAuto = setTimeout (() -> - pageLoaded() - - clearInterval(intervalAuto) - ), maxAuto - intervalAuto = setInterval (() -> if lastResponseDate && requestCount == 0 pageLoaded() diff --git a/app/coffee/modules/search.coffee b/app/coffee/modules/search.coffee index 661dedfd..8a2ce080 100644 --- a/app/coffee/modules/search.coffee +++ b/app/coffee/modules/search.coffee @@ -164,13 +164,22 @@ module.directive("tgSearchBox", SearchBoxDirective) SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> linkTable = ($scope, $el, $attrs, $ctrl) -> + applyAutoTab = true + activeSectionName = "userstories" tabsDom = $el.find("section.search-filter") lastSeatchResults = null getActiveSection = (data) -> maxVal = 0 - selectedSectionName = null - selectedSectionData = null + selectedSection = {} + selectedSection.name = "userstories" + selectedSection.value = [] + + if !applyAutoTab + selectedSection.name = activeSectionName + selectedSection.value = data[activeSectionName] + + return selectedSection if data for name in ["userstories", "issues", "tasks", "wikipages"] @@ -178,14 +187,14 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> if value.length > maxVal maxVal = value.length - selectedSectionName = name - selectedSectionData = value + selectedSection.name = name + selectedSection.value = value break; if maxVal == 0 - return {name: "userstories", value: []} + return selectedSection - return {name:selectedSectionName, value: selectedSectionData} + return selectedSection renderFilterTabs = (data) -> for name, value of data @@ -197,6 +206,9 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> tabsDom.find("a.active").removeClass("active") tabsDom.find("li.#{section.name} a").addClass("active") + applyAutoTab = false + activeSectionName = section.name + templates = { issues: $templatecache.get("search-issues") tasks: $templatecache.get("search-tasks") @@ -221,8 +233,13 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) -> $scope.$watch "searchResults", (data) -> lastSeatchResults = data + + return if !lastSeatchResults + activeSection = getActiveSection(data) + renderFilterTabs(data) + renderTableContent(activeSection) markSectionTabActive(activeSection)