commit
bdc75f54c5
|
@ -77,13 +77,6 @@ Loader = ($rootscope) ->
|
||||||
lastResponseDate = 0
|
lastResponseDate = 0
|
||||||
|
|
||||||
autoClose = () ->
|
autoClose = () ->
|
||||||
maxAuto = 5000
|
|
||||||
timeoutAuto = setTimeout (() ->
|
|
||||||
pageLoaded()
|
|
||||||
|
|
||||||
clearInterval(intervalAuto)
|
|
||||||
), maxAuto
|
|
||||||
|
|
||||||
intervalAuto = setInterval (() ->
|
intervalAuto = setInterval (() ->
|
||||||
if lastResponseDate && requestCount == 0
|
if lastResponseDate && requestCount == 0
|
||||||
pageLoaded()
|
pageLoaded()
|
||||||
|
|
|
@ -164,13 +164,22 @@ module.directive("tgSearchBox", SearchBoxDirective)
|
||||||
|
|
||||||
SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) ->
|
SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) ->
|
||||||
linkTable = ($scope, $el, $attrs, $ctrl) ->
|
linkTable = ($scope, $el, $attrs, $ctrl) ->
|
||||||
|
applyAutoTab = true
|
||||||
|
activeSectionName = "userstories"
|
||||||
tabsDom = $el.find("section.search-filter")
|
tabsDom = $el.find("section.search-filter")
|
||||||
lastSeatchResults = null
|
lastSeatchResults = null
|
||||||
|
|
||||||
getActiveSection = (data) ->
|
getActiveSection = (data) ->
|
||||||
maxVal = 0
|
maxVal = 0
|
||||||
selectedSectionName = null
|
selectedSection = {}
|
||||||
selectedSectionData = null
|
selectedSection.name = "userstories"
|
||||||
|
selectedSection.value = []
|
||||||
|
|
||||||
|
if !applyAutoTab
|
||||||
|
selectedSection.name = activeSectionName
|
||||||
|
selectedSection.value = data[activeSectionName]
|
||||||
|
|
||||||
|
return selectedSection
|
||||||
|
|
||||||
if data
|
if data
|
||||||
for name in ["userstories", "issues", "tasks", "wikipages"]
|
for name in ["userstories", "issues", "tasks", "wikipages"]
|
||||||
|
@ -178,14 +187,14 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) ->
|
||||||
|
|
||||||
if value.length > maxVal
|
if value.length > maxVal
|
||||||
maxVal = value.length
|
maxVal = value.length
|
||||||
selectedSectionName = name
|
selectedSection.name = name
|
||||||
selectedSectionData = value
|
selectedSection.value = value
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if maxVal == 0
|
if maxVal == 0
|
||||||
return {name: "userstories", value: []}
|
return selectedSection
|
||||||
|
|
||||||
return {name:selectedSectionName, value: selectedSectionData}
|
return selectedSection
|
||||||
|
|
||||||
renderFilterTabs = (data) ->
|
renderFilterTabs = (data) ->
|
||||||
for name, value of data
|
for name, value of data
|
||||||
|
@ -197,6 +206,9 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) ->
|
||||||
tabsDom.find("a.active").removeClass("active")
|
tabsDom.find("a.active").removeClass("active")
|
||||||
tabsDom.find("li.#{section.name} a").addClass("active")
|
tabsDom.find("li.#{section.name} a").addClass("active")
|
||||||
|
|
||||||
|
applyAutoTab = false
|
||||||
|
activeSectionName = section.name
|
||||||
|
|
||||||
templates = {
|
templates = {
|
||||||
issues: $templatecache.get("search-issues")
|
issues: $templatecache.get("search-issues")
|
||||||
tasks: $templatecache.get("search-tasks")
|
tasks: $templatecache.get("search-tasks")
|
||||||
|
@ -221,8 +233,13 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location) ->
|
||||||
|
|
||||||
$scope.$watch "searchResults", (data) ->
|
$scope.$watch "searchResults", (data) ->
|
||||||
lastSeatchResults = data
|
lastSeatchResults = data
|
||||||
|
|
||||||
|
return if !lastSeatchResults
|
||||||
|
|
||||||
activeSection = getActiveSection(data)
|
activeSection = getActiveSection(data)
|
||||||
|
|
||||||
renderFilterTabs(data)
|
renderFilterTabs(data)
|
||||||
|
|
||||||
renderTableContent(activeSection)
|
renderTableContent(activeSection)
|
||||||
markSectionTabActive(activeSection)
|
markSectionTabActive(activeSection)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue