Refactor: Use tgNavUrls service instead the real url
parent
5da5aa1dc0
commit
d5dccd8a04
|
@ -143,7 +143,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then =>
|
@confirm.ask(title, subtitle).then =>
|
||||||
@.repo.remove(@scope.issue).then =>
|
@.repo.remove(@scope.issue).then =>
|
||||||
@location.path("/project/#{@scope.project.slug}/issues")
|
@location.path(@navUrls.resolve("project-issues", {project: @scope.project.slug}))
|
||||||
|
|
||||||
module.controller("IssueDetailController", IssueDetailController)
|
module.controller("IssueDetailController", IssueDetailController)
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ module.controller("IssueDetailController", IssueDetailController)
|
||||||
## Issue Main Directive
|
## Issue Main Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
IssueDirective = ($tgrepo, $log, $location, $confirm) ->
|
IssueDirective = ($tgrepo, $log, $location, $confirm, $navUrls) ->
|
||||||
linkSidebar = ($scope, $el, $attrs, $ctrl) ->
|
linkSidebar = ($scope, $el, $attrs, $ctrl) ->
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
|
@ -168,7 +168,11 @@ IssueDirective = ($tgrepo, $log, $location, $confirm) ->
|
||||||
|
|
||||||
onSuccess = ->
|
onSuccess = ->
|
||||||
$confirm.notify("success")
|
$confirm.notify("success")
|
||||||
$location.path("/project/#{$scope.project.slug}/issue/#{$scope.issue.ref}")
|
ctx = {
|
||||||
|
project: $scope.project.slug
|
||||||
|
ref: $scope.issue.ref
|
||||||
|
}
|
||||||
|
$location.path($navUrls.resolve("project-issues-detail", ctx))
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
|
@ -197,7 +201,8 @@ IssueDirective = ($tgrepo, $log, $location, $confirm) ->
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", IssueDirective])
|
module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", "$tgNavUrls",
|
||||||
|
IssueDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
|
@ -137,7 +137,7 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin, taig
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then =>
|
@confirm.ask(title, subtitle).then =>
|
||||||
@.repo.remove(@scope.task).then =>
|
@.repo.remove(@scope.task).then =>
|
||||||
@location.path("/project/#{@scope.project.slug}/backlog")
|
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
|
||||||
|
|
||||||
module.controller("TaskDetailController", TaskDetailController)
|
module.controller("TaskDetailController", TaskDetailController)
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ module.controller("TaskDetailController", TaskDetailController)
|
||||||
## Task Main Directive
|
## Task Main Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
TaskDirective = ($tgrepo, $log, $location, $confirm) ->
|
TaskDirective = ($tgrepo, $log, $location, $confirm, $navUrls) ->
|
||||||
linkSidebar = ($scope, $el, $attrs, $ctrl) ->
|
linkSidebar = ($scope, $el, $attrs, $ctrl) ->
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
|
@ -162,7 +162,11 @@ TaskDirective = ($tgrepo, $log, $location, $confirm) ->
|
||||||
|
|
||||||
onSuccess = ->
|
onSuccess = ->
|
||||||
$confirm.notify("success")
|
$confirm.notify("success")
|
||||||
$location.path("/project/#{$scope.project.slug}/task/#{$scope.task.ref}")
|
ctx = {
|
||||||
|
project: $scope.project.slug
|
||||||
|
ref: $scope.task.ref
|
||||||
|
}
|
||||||
|
$location.path($navUrls.resolve("project-tasks-detail", ctx))
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
|
@ -189,7 +193,8 @@ TaskDirective = ($tgrepo, $log, $location, $confirm) ->
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgTaskDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", TaskDirective])
|
module.directive("tgTaskDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", "$tgNavUrls",
|
||||||
|
TaskDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
|
@ -149,7 +149,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin,
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then =>
|
@confirm.ask(title, subtitle).then =>
|
||||||
@.repo.remove(@scope.us).then =>
|
@.repo.remove(@scope.us).then =>
|
||||||
@location.path("/project/#{@scope.project.slug}/backlog")
|
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
|
||||||
|
|
||||||
module.controller("UserStoryDetailController", UserStoryDetailController)
|
module.controller("UserStoryDetailController", UserStoryDetailController)
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ module.controller("UserStoryDetailController", UserStoryDetailController)
|
||||||
## User story Main Directive
|
## User story Main Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
UsDirective = ($tgrepo, $log, $location, $confirm) ->
|
UsDirective = ($tgrepo, $log, $location, $confirm, $navUrls) ->
|
||||||
linkSidebar = ($scope, $el, $attrs, $ctrl) ->
|
linkSidebar = ($scope, $el, $attrs, $ctrl) ->
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
|
@ -175,7 +175,11 @@ UsDirective = ($tgrepo, $log, $location, $confirm) ->
|
||||||
|
|
||||||
onSuccess = ->
|
onSuccess = ->
|
||||||
$confirm.notify("success")
|
$confirm.notify("success")
|
||||||
$location.path("/project/#{$scope.project.slug}/us/#{$scope.us.ref}")
|
ctx = {
|
||||||
|
project: $scope.project.slug
|
||||||
|
ref: $scope.us.ref
|
||||||
|
}
|
||||||
|
$location.path($navUrls.resolve("project-userstories-detail", ctx))
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
|
@ -202,7 +206,7 @@ UsDirective = ($tgrepo, $log, $location, $confirm) ->
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgUsDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", UsDirective])
|
module.directive("tgUsDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", "$tgNavUrls", UsDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
Loading…
Reference in New Issue