diff --git a/app/coffee/modules/admin/memberships.coffee b/app/coffee/modules/admin/memberships.coffee
index 24d8bf40..ff07ddb0 100644
--- a/app/coffee/modules/admin/memberships.coffee
+++ b/app/coffee/modules/admin/memberships.coffee
@@ -40,10 +40,11 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
"$routeParams",
"$q",
"$tgLocation",
+ "$tgNavUrls",
"$appTitle"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @appTitle) ->
_.bindAll(@)
@scope.sectionName = "Manage Members" #i18n
@@ -55,8 +56,11 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
promise.then () =>
@appTitle.set("Membership - " + @scope.project.name)
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
@scope.$on("membersform:new:success", @.loadMembers)
@@ -80,10 +84,6 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
@scope.projectId = data.project
return data
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
-
return promise.then(=> @.loadProject())
.then(=> @.loadUsersAndRoles())
.then(=> @.loadMembers())
diff --git a/app/coffee/modules/admin/project-profile.coffee b/app/coffee/modules/admin/project-profile.coffee
index 3acd5713..9e19c9ff 100644
--- a/app/coffee/modules/admin/project-profile.coffee
+++ b/app/coffee/modules/admin/project-profile.coffee
@@ -45,10 +45,11 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin)
"$routeParams",
"$q",
"$tgLocation",
+ "$tgNavUrls",
"$appTitle"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @appTitle) ->
@scope.project = {}
promise = @.loadInitialData()
@@ -58,7 +59,7 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)
diff --git a/app/coffee/modules/admin/project-values.coffee b/app/coffee/modules/admin/project-values.coffee
index 152b9e89..32c7ccbc 100644
--- a/app/coffee/modules/admin/project-values.coffee
+++ b/app/coffee/modules/admin/project-values.coffee
@@ -44,10 +44,11 @@ class ProjectValuesController extends mixOf(taiga.Controller, taiga.PageMixin)
"$routeParams",
"$q",
"$tgLocation",
+ "$tgNavUrls",
"$appTitle"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @appTitle) ->
@scope.project = {}
promise = @.loadInitialData()
@@ -55,8 +56,11 @@ class ProjectValuesController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then () =>
@appTitle.set("Project values - " + @scope.sectionName + " - " + @scope.project.name)
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
@scope.$on("admin:project-values:move", @.moveValue)
@@ -76,10 +80,6 @@ class ProjectValuesController extends mixOf(taiga.Controller, taiga.PageMixin)
@scope.projectId = data.project
return data
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
-
return promise.then( => @q.all([
@.loadProject(),
@.loadValues(),
diff --git a/app/coffee/modules/admin/roles.coffee b/app/coffee/modules/admin/roles.coffee
index 7cf90112..f9847cd4 100644
--- a/app/coffee/modules/admin/roles.coffee
+++ b/app/coffee/modules/admin/roles.coffee
@@ -41,10 +41,11 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
"$routeParams",
"$q",
"$tgLocation",
+ "$tgNavUrls",
"$appTitle"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @appTitle) ->
_.bindAll(@)
@scope.sectionName = "Permissions" #i18n
@@ -55,8 +56,11 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
promise.then () =>
@appTitle.set("Roles - " + @scope.project.name)
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
loadProject: ->
return @rs.projects.get(@scope.projectId).then (project) =>
@@ -75,10 +79,6 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
@scope.projectId = data.project
return data
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
-
return promise.then(=> @.loadProject())
.then(=> @.loadUsersAndRoles())
.then(=> @.loadRoles())
diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee
index f6d248fd..75375819 100644
--- a/app/coffee/modules/auth.coffee
+++ b/app/coffee/modules/auth.coffee
@@ -214,7 +214,7 @@ module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routePara
RegisterDirective = ($auth, $confirm, $location, $navUrls, $config) ->
link = ($scope, $el, $attrs) ->
if not $config.get("publicRegisterEnabled")
- $location.path("/not-found")
+ $location.path($navUrls.resolve("not-found"))
$location.replace()
$scope.data = {}
diff --git a/app/coffee/modules/backlog/main.coffee b/app/coffee/modules/backlog/main.coffee
index 3285f012..3e3c1e62 100644
--- a/app/coffee/modules/backlog/main.coffee
+++ b/app/coffee/modules/backlog/main.coffee
@@ -45,10 +45,12 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
"$q",
"$tgLocation",
"$appTitle",
+ "$tgNavUrls",
"tgLoader"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle, tgLoader) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle, @navUrls,
+ tgLoader) ->
_.bindAll(@)
@scope.sectionName = "Backlog"
@@ -76,7 +78,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
# On Error
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)
diff --git a/app/coffee/modules/base.coffee b/app/coffee/modules/base.coffee
index d9c2f9db..20ee06b7 100644
--- a/app/coffee/modules/base.coffee
+++ b/app/coffee/modules/base.coffee
@@ -45,6 +45,8 @@ module.directive("tgMain", ["$rootScope", "$window", TaigaMainDirective])
urls = {
"home": "/"
"error": "/error"
+ "not-found": "/not-found"
+
"login": "/login"
"forgot-password": "/forgot-password"
"change-password": "/change-password/:token"
diff --git a/app/coffee/modules/issues/detail.coffee b/app/coffee/modules/issues/detail.coffee
index cd1ab12f..7045a4ff 100644
--- a/app/coffee/modules/issues/detail.coffee
+++ b/app/coffee/modules/issues/detail.coffee
@@ -61,7 +61,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
# On Error
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)
diff --git a/app/coffee/modules/issues/list.coffee b/app/coffee/modules/issues/list.coffee
index 76374291..0ed87170 100644
--- a/app/coffee/modules/issues/list.coffee
+++ b/app/coffee/modules/issues/list.coffee
@@ -48,10 +48,12 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
"$q",
"$tgLocation",
"$appTitle",
+ "$tgNavUrls",
"tgLoader"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @urls, @params, @q, @location, @appTitle, tgLoader) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @urls, @params, @q, @location, @appTitle,
+ @navUrls, tgLoader) ->
@scope.sectionName = "Issues"
@scope.filters = {}
@@ -72,7 +74,7 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
# On Error
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)
diff --git a/app/coffee/modules/kanban/main.coffee b/app/coffee/modules/kanban/main.coffee
index 52f3911b..08789320 100644
--- a/app/coffee/modules/kanban/main.coffee
+++ b/app/coffee/modules/kanban/main.coffee
@@ -58,10 +58,12 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
"$q",
"$tgLocation",
"$appTitle",
+ "$tgNavUrls",
"tgLoader"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle, tgLoader) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @appTitle, @navUrls,
+ tgLoader) ->
_.bindAll(@)
@scope.sectionName = "Kanban"
@scope.statusViewModes = {}
@@ -73,17 +75,10 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
@appTitle.set("Kanban - " + @scope.project.name)
tgLoader.pageLoaded()
- # $(".task-column").mCustomScrollbar({
- # theme: 'minimal-dark'
- # scrollInertia: 0
- # axis: 'y'
- # });
-
-
# On Error
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)
diff --git a/app/coffee/modules/projects/main.coffee b/app/coffee/modules/projects/main.coffee
index 2fe946bb..6c947e07 100644
--- a/app/coffee/modules/projects/main.coffee
+++ b/app/coffee/modules/projects/main.coffee
@@ -26,6 +26,7 @@ bindOnce = @.taiga.bindOnce
class ProjectsController extends taiga.Controller
@.$inject = [
"$scope",
+ "$q",
"$tgResources",
"$rootScope",
"$tgNavUrls",
@@ -36,20 +37,28 @@ class ProjectsController extends taiga.Controller
"tgLoader"
]
- constructor: (@scope, @rs, @rootscope, @navurls, @auth, @location, @appTitle, @projectUrl, @tgLoader, @navUrls) ->
+ constructor: (@scope, @q, @rs, @rootscope, @navUrls, @auth, @location, @appTitle, @projectUrl,
+ @tgLoader) ->
@appTitle.set("Projects")
if !@auth.isAuthenticated()
- @location.path(@navurls.resolve("login"))
+ @location.path(@navUrls.resolve("login"))
@.user = @auth.getUser()
@.projects = []
- @.loadInitialData()
- .then () =>
+ promise = @.loadInitialData()
+
+ promise.then () =>
@scope.$emit("projects:loaded")
@tgLoader.pageLoaded()
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
+
loadInitialData: ->
return @rs.projects.list().then (projects) =>
@.projects = {'recents': projects.slice(0, 8), 'all': projects.slice(8)}
@@ -57,12 +66,14 @@ class ProjectsController extends taiga.Controller
for project in projects
project.url = @projectUrl.get(project)
+ return projects
+
newProject: ->
@rootscope.$broadcast("projects:create")
logout: ->
@auth.logout()
- @location.path(@navurls.resolve("login"))
+ @location.path(@navUrls.resolve("login"))
module.controller("ProjectsController", ProjectsController)
@@ -76,13 +87,21 @@ class ProjectController extends taiga.Controller
"$q",
"$rootScope",
"$appTitle",
- "$tgLocation"
+ "$tgLocation",
+ "$tgNavUrls"
]
- constructor: (@scope, @rs, @repo, @params, @q, @rootscope, @appTitle, @location) ->
- @.loadInitialData()
- .then () =>
- @appTitle.set(@scope.project.name)
+ constructor: (@scope, @rs, @repo, @params, @q, @rootscope, @appTitle, @location, @navUrls) ->
+ promise = @.loadInitialData()
+
+ promise.then () =>
+ @appTitle.set(@scope.project.name)
+
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
loadInitialData: ->
# Resolve project slug
@@ -90,13 +109,8 @@ class ProjectController extends taiga.Controller
@scope.projectId = data.project
return data
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
-
- return promise
- .then(=> @.loadPageData())
- .then(=> @scope.$emit("project:loaded", @scope.project))
+ return promise.then(=> @.loadPageData())
+ .then(=> @scope.$emit("project:loaded", @scope.project))
loadPageData: ->
return @q.all([
diff --git a/app/coffee/modules/search.coffee b/app/coffee/modules/search.coffee
index 002dbfdc..dee6d81a 100644
--- a/app/coffee/modules/search.coffee
+++ b/app/coffee/modules/search.coffee
@@ -43,10 +43,11 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
"$q",
"$tgLocation",
"$appTitle",
+ "$tgNavUrls",
"tgLoader"
]
- constructor: (@scope, @repo, @rs, @params, @q, @location, @appTitle, @tgLoader) ->
+ constructor: (@scope, @repo, @rs, @params, @q, @location, @appTitle, @navUrls, @tgLoader) ->
@scope.sectionName = "Search"
promise = @.loadInitialData()
@@ -54,8 +55,11 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then () =>
@appTitle.set("Search")
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
# Search input watcher
@scope.searchTerm = ""
@@ -97,10 +101,6 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
@scope.projectId = data.project
return data
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
-
return promise.then(=> @.loadProject())
.then(=> @.loadUsersAndRoles())
diff --git a/app/coffee/modules/taskboard/main.coffee b/app/coffee/modules/taskboard/main.coffee
index 68683b61..a95dc73b 100644
--- a/app/coffee/modules/taskboard/main.coffee
+++ b/app/coffee/modules/taskboard/main.coffee
@@ -45,10 +45,12 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
"$q",
"$appTitle",
"$tgLocation",
+ "$tgNavUrls"
"tgLoader"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @appTitle, @location, tgLoader) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @appTitle, @location, @navUrls,
+ tgLoader) ->
_.bindAll(@)
@scope.sectionName = "Taskboard"
@@ -63,7 +65,7 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
# On Error
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)
diff --git a/app/coffee/modules/tasks/detail.coffee b/app/coffee/modules/tasks/detail.coffee
index 6f08f8d0..fd502b91 100644
--- a/app/coffee/modules/tasks/detail.coffee
+++ b/app/coffee/modules/tasks/detail.coffee
@@ -46,7 +46,8 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
"tgLoader"
]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @log, @appTitle, @navUrls, tgLoader) ->
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @log, @appTitle, @navUrls,
+ tgLoader) ->
@scope.taskRef = @params.taskref
@scope.sectionName = "Task Details"
@@ -56,8 +57,11 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
@appTitle.set(@scope.task.subject + " - " + @scope.project.name)
tgLoader.pageLoaded()
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
@scope.$on("attachment:create", => @rootscope.$broadcast("history:reload"))
@@ -111,10 +115,6 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
@scope.taskId = data.task
return data
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
-
return promise.then(=> @.loadProject())
.then(=> @.loadUsersAndRoles())
.then(=> @.loadTask())
diff --git a/app/coffee/modules/user-settings/change-password.coffee b/app/coffee/modules/user-settings/change-password.coffee
index 0e20ea1a..3db6c237 100644
--- a/app/coffee/modules/user-settings/change-password.coffee
+++ b/app/coffee/modules/user-settings/change-password.coffee
@@ -31,54 +31,55 @@ module = angular.module("taigaUserSettings")
#############################################################################
class UserChangePasswordController extends mixOf(taiga.Controller, taiga.PageMixin)
- @.$inject = [
- "$scope",
- "$rootScope",
- "$tgRepo",
- "$tgConfirm",
- "$tgResources",
- "$routeParams",
- "$q",
- "$tgLocation",
- "$tgAuth"
- ]
+ @.$inject = [
+ "$scope",
+ "$rootScope",
+ "$tgRepo",
+ "$tgConfirm",
+ "$tgResources",
+ "$routeParams",
+ "$q",
+ "$tgLocation",
+ "$tgNavUrls",
+ "$tgAuth"
+ ]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @auth) ->
- @scope.sectionName = "Change Password" #i18n
- @scope.project = {}
- @scope.user = @auth.getUser()
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @auth) ->
+ @scope.sectionName = "Change Password" #i18n
+ @scope.project = {}
+ @scope.user = @auth.getUser()
- promise = @.loadInitialData()
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise = @.loadInitialData()
- loadProject: ->
- return @rs.projects.get(@scope.projectId).then (project) =>
- @scope.project = project
- @scope.$emit('project:loaded', project)
- return project
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
- loadInitialData: ->
- promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
- @scope.projectId = data.project
- return data
+ loadProject: ->
+ return @rs.projects.get(@scope.projectId).then (project) =>
+ @scope.project = project
+ @scope.$emit('project:loaded', project)
+ return project
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
+ loadInitialData: ->
+ promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
+ @scope.projectId = data.project
+ return data
- return promise.then(=> @.loadProject())
+ return promise.then(=> @.loadProject())
- save: ->
- if @scope.newPassword1 != @scope.newPassword2
- @confirm.notify('error', "The passwords dosn't match")
- return
+ save: ->
+ if @scope.newPassword1 != @scope.newPassword2
+ @confirm.notify('error', "The passwords dosn't match")
+ return
- promise = @rs.userSettings.changePassword(@scope.currentPassword, @scope.newPassword1)
- promise.then =>
- @confirm.notify('success')
- promise.then null, (response) =>
- @confirm.notify('error', response.data._error_message)
+ promise = @rs.userSettings.changePassword(@scope.currentPassword, @scope.newPassword1)
+ promise.then =>
+ @confirm.notify('success')
+ promise.then null, (response) =>
+ @confirm.notify('error', response.data._error_message)
module.controller("UserChangePasswordController", UserChangePasswordController)
diff --git a/app/coffee/modules/user-settings/main.coffee b/app/coffee/modules/user-settings/main.coffee
index 5f1a7413..5dd38aa3 100644
--- a/app/coffee/modules/user-settings/main.coffee
+++ b/app/coffee/modules/user-settings/main.coffee
@@ -29,62 +29,63 @@ module = angular.module("taigaUserSettings")
#############################################################################
class UserSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
- @.$inject = [
- "$scope",
- "$rootScope",
- "$tgRepo",
- "$tgConfirm",
- "$tgResources",
- "$routeParams",
- "$q",
- "$tgLocation",
- "$tgAuth"
- ]
+ @.$inject = [
+ "$scope",
+ "$rootScope",
+ "$tgRepo",
+ "$tgConfirm",
+ "$tgResources",
+ "$routeParams",
+ "$q",
+ "$tgLocation",
+ "$tgNavUrls",
+ "$tgAuth"
+ ]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @auth) ->
- @scope.sectionName = "User Profile" #i18n
- @scope.project = {}
- @scope.user = @auth.getUser()
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @auth) ->
+ @scope.sectionName = "User Profile" #i18n
+ @scope.project = {}
+ @scope.user = @auth.getUser()
- promise = @.loadInitialData()
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise = @.loadInitialData()
- loadProject: ->
- return @rs.projects.get(@scope.projectId).then (project) =>
- @scope.project = project
- @scope.$emit('project:loaded', project)
- return project
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
- loadInitialData: ->
- promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
- @scope.projectId = data.project
- return data
+ loadProject: ->
+ return @rs.projects.get(@scope.projectId).then (project) =>
+ @scope.project = project
+ @scope.$emit('project:loaded', project)
+ return project
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
+ loadInitialData: ->
+ promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
+ @scope.projectId = data.project
+ return data
- return promise.then(=> @.loadProject())
+ return promise.then(=> @.loadProject())
- saveUserProfile: ->
- updatingEmail = @scope.user.isAttributeModified("email")
- promise = @repo.save(@scope.user)
- promise.then =>
- @auth.setUser(@scope.user)
- if updatingEmail
- @confirm.success("Check your inbox!
- We have sent a mail to your account
- with the instructions to set your new address") #TODO: i18n
- else
- @confirm.notify('success')
+ saveUserProfile: ->
+ updatingEmail = @scope.user.isAttributeModified("email")
+ promise = @repo.save(@scope.user)
+ promise.then =>
+ @auth.setUser(@scope.user)
+ if updatingEmail
+ @confirm.success("Check your inbox!
+ We have sent a mail to your account
+ with the instructions to set your new address") #TODO: i18n
+ else
+ @confirm.notify('success')
- promise.then null, (response) =>
- @confirm.notify('error', response._error_message)
- @scope.user = @auth.getUser()
+ promise.then null, (response) =>
+ @confirm.notify('error', response._error_message)
+ @scope.user = @auth.getUser()
- openDeleteLightbox: ->
- @rootscope.$broadcast("deletelightbox:new", @scope.user)
+ openDeleteLightbox: ->
+ @rootscope.$broadcast("deletelightbox:new", @scope.user)
module.controller("UserSettingsController", UserSettingsController)
diff --git a/app/coffee/modules/user-settings/notifications.coffee b/app/coffee/modules/user-settings/notifications.coffee
index db470d1c..b6e392f0 100644
--- a/app/coffee/modules/user-settings/notifications.coffee
+++ b/app/coffee/modules/user-settings/notifications.coffee
@@ -31,49 +31,50 @@ module = angular.module("taigaUserSettings")
#############################################################################
class UserNotificationsController extends mixOf(taiga.Controller, taiga.PageMixin)
- @.$inject = [
- "$scope",
- "$rootScope",
- "$tgRepo",
- "$tgConfirm",
- "$tgResources",
- "$routeParams",
- "$q",
- "$tgLocation",
- "$tgAuth"
- ]
+ @.$inject = [
+ "$scope",
+ "$rootScope",
+ "$tgRepo",
+ "$tgConfirm",
+ "$tgResources",
+ "$routeParams",
+ "$q",
+ "$tgLocation",
+ "$tgNavUrls",
+ "$tgAuth"
+ ]
- constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @auth) ->
- @scope.sectionName = "Email Notifications" #i18n
- @scope.project = {}
- @scope.user = @auth.getUser()
+ constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @auth) ->
+ @scope.sectionName = "Email Notifications" #i18n
+ @scope.project = {}
+ @scope.user = @auth.getUser()
- promise = @.loadInitialData()
- promise.then null, ->
- console.log "FAIL" #TODO
+ promise = @.loadInitialData()
- loadProject: ->
- return @rs.projects.get(@scope.projectId).then (project) =>
- @scope.project = project
- @scope.$emit('project:loaded', project)
- return project
+ promise.then null, (xhr) =>
+ if xhr and xhr.status == 404
+ @location.path(@navUrls.resolve("not-found"))
+ @location.replace()
+ return @q.reject(xhr)
- loadNotifyPolicies: ->
- return @rs.notifyPolicies.list().then (notifyPolicies) =>
- @scope.notifyPolicies = notifyPolicies
- return notifyPolicies
+ loadProject: ->
+ return @rs.projects.get(@scope.projectId).then (project) =>
+ @scope.project = project
+ @scope.$emit('project:loaded', project)
+ return project
- loadInitialData: ->
- promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
- @scope.projectId = data.project
- return data
+ loadNotifyPolicies: ->
+ return @rs.notifyPolicies.list().then (notifyPolicies) =>
+ @scope.notifyPolicies = notifyPolicies
+ return notifyPolicies
- promise.then null, =>
- @location.path("/not-found")
- @location.replace()
+ loadInitialData: ->
+ promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
+ @scope.projectId = data.project
+ return data
- return promise.then(=> @.loadProject())
- .then(=> @.loadNotifyPolicies())
+ return promise.then(=> @.loadProject())
+ .then(=> @.loadNotifyPolicies())
module.controller("UserNotificationsController", UserNotificationsController)
diff --git a/app/coffee/modules/userstories/detail.coffee b/app/coffee/modules/userstories/detail.coffee
index 6da90974..6b8e0485 100644
--- a/app/coffee/modules/userstories/detail.coffee
+++ b/app/coffee/modules/userstories/detail.coffee
@@ -61,7 +61,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
# On Error
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)
diff --git a/app/coffee/modules/wiki/main.coffee b/app/coffee/modules/wiki/main.coffee
index a26916a8..93a8911a 100644
--- a/app/coffee/modules/wiki/main.coffee
+++ b/app/coffee/modules/wiki/main.coffee
@@ -65,7 +65,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
# On Error
promise.then null, (xhr) =>
if xhr and xhr.status == 404
- @location.path("/not-found")
+ @location.path(@navUrls.resolve("not-found"))
@location.replace()
return @q.reject(xhr)