fix #1706 preserve navigation active in US and tasks

stable
Juanfran 2014-11-27 16:43:15 +01:00
parent f2fffa3235
commit 6870b9a057
3 changed files with 19 additions and 3 deletions

View File

@ -311,6 +311,22 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
<div class="menu-container"></div> <div class="menu-container"></div>
""") """)
# If the last page was kanban or backlog and
# the new one is the task detail or the us details
# this method preserve the last section name.
getSectionName = ($el, sectionName, project) ->
oldSectionName = $el.find("a.active").parent().attr("id")?.replace("nav-", "")
if sectionName == "backlog-kanban"
if oldSectionName in ["backlog", "kanban"]
sectionName = oldSectionName
else if project.is_backlog_activated && !project.is_kanban_activated
sectionName = "backlog"
else if !project.is_backlog_activated && project.is_kanban_activated
sectionName = "kanban"
return sectionName
renderMainMenu = ($el) -> renderMainMenu = ($el) ->
html = mainTemplate({}) html = mainTemplate({})
$el.html(html) $el.html(html)
@ -320,7 +336,7 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $
# content loaded signal is raised using inner scope. # content loaded signal is raised using inner scope.
renderMenuEntries = ($el, targetScope, project={}) -> renderMenuEntries = ($el, targetScope, project={}) ->
container = $el.find(".menu-container") container = $el.find(".menu-container")
sectionName = targetScope.section sectionName = getSectionName($el, targetScope.section, project)
ctx = { ctx = {
user: $auth.getUser(), user: $auth.getUser(),

View File

@ -5,7 +5,7 @@ block head
block content block content
div.wrapper(ng-controller="TaskDetailController as ctrl", div.wrapper(ng-controller="TaskDetailController as ctrl",
ng-init="section='backlog'") ng-init="section='backlog-kanban'")
div.main.us-detail div.main.us-detail
div.us-detail-header.header-with-actions div.us-detail-header.header-with-actions
include views/components/mainTitle include views/components/mainTitle

View File

@ -5,7 +5,7 @@ block head
block content block content
div.wrapper(ng-controller="UserStoryDetailController as ctrl", div.wrapper(ng-controller="UserStoryDetailController as ctrl",
ng-init="section='backlog'") ng-init="section='backlog-kanban'")
div.main.us-detail div.main.us-detail
div.us-detail-header.header-with-actions div.us-detail-header.header-with-actions
include views/components/mainTitle include views/components/mainTitle