commit
f30ddeb847
|
@ -136,6 +136,8 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
|||
{templateUrl: "/partials/error.html"})
|
||||
$routeProvider.when("/not-found",
|
||||
{templateUrl: "/partials/not-found.html"})
|
||||
$routeProvider.when("/permission-denied",
|
||||
{templateUrl: "/partials/permission-denied.html"})
|
||||
|
||||
$routeProvider.otherwise({redirectTo: '/not-found'})
|
||||
$locationProvider.html5Mode(true)
|
||||
|
|
|
@ -22,6 +22,16 @@
|
|||
class TaigaBase
|
||||
class TaigaService extends TaigaBase
|
||||
class TaigaController extends TaigaBase
|
||||
onInitialDataError: (xhr) =>
|
||||
if xhr
|
||||
if xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
else if xhr.status == 403
|
||||
@location.path(@navUrls.resolve("permission-denied"))
|
||||
@location.replace()
|
||||
|
||||
return @q.reject(xhr)
|
||||
|
||||
@.taiga.Base = TaigaBase
|
||||
@.taiga.Service = TaigaService
|
||||
|
|
|
@ -58,11 +58,7 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
|||
promise.then =>
|
||||
@appTitle.set("Membership - " + @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)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
@scope.$on "membersform:new:success", =>
|
||||
@.loadMembers()
|
||||
|
|
|
@ -57,11 +57,7 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
promise.then =>
|
||||
@appTitle.set("Project profile - " + @scope.sectionName + " - " + @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)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
@scope.$on "project:loaded", =>
|
||||
@appTitle.set("Project profile - " + @scope.sectionName + " - " + @scope.project.name)
|
||||
|
|
|
@ -57,11 +57,7 @@ class ProjectValuesController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
promise.then () =>
|
||||
@appTitle.set("Project values - " + @scope.sectionName + " - " + @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)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
@scope.$on("admin:project-values:move", @.moveValue)
|
||||
|
||||
|
|
|
@ -58,11 +58,7 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
|
|||
promise.then () =>
|
||||
@appTitle.set("Roles - " + @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)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
|
|
|
@ -74,11 +74,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
|||
tgLoader.pageLoaded()
|
||||
|
||||
# On Error
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
initializeEventHandlers: ->
|
||||
@scope.$on "usform:bulk:success", =>
|
||||
|
|
|
@ -46,6 +46,7 @@ urls = {
|
|||
"home": "/"
|
||||
"error": "/error"
|
||||
"not-found": "/not-found"
|
||||
"permission-denied": "/permission-denied"
|
||||
|
||||
"login": "/login"
|
||||
"forgot-password": "/forgot-password"
|
||||
|
|
|
@ -62,11 +62,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
@appTitle.set(@scope.issue.subject + " - " + @scope.project.name)
|
||||
|
||||
# On Error
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
|
||||
initializeEventHandlers: ->
|
||||
|
|
|
@ -74,11 +74,7 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
|||
tgLoader.pageLoaded()
|
||||
|
||||
# On Error
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
@scope.$on "issueform:new:success", =>
|
||||
@analytics.trackEvent("issue", "create", "create issue on issues list", 1)
|
||||
|
|
|
@ -78,12 +78,7 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
|||
tgLoader.pageLoaded()
|
||||
|
||||
# On Error
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
initializeEventHandlers: ->
|
||||
@scope.$on "usform:new:success", =>
|
||||
|
|
|
@ -53,11 +53,7 @@ class ProjectsController extends taiga.Controller
|
|||
@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)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
loadInitialData: ->
|
||||
return @rs.projects.list().then (projects) =>
|
||||
|
@ -96,11 +92,7 @@ class ProjectController extends taiga.Controller
|
|||
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)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
loadInitialData: ->
|
||||
# Resolve project slug
|
||||
|
|
|
@ -55,11 +55,7 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
promise.then () =>
|
||||
@appTitle.set("Search")
|
||||
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
# Search input watcher
|
||||
@scope.searchTerm = ""
|
||||
|
|
|
@ -66,11 +66,7 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
tgLoader.pageLoaded()
|
||||
|
||||
# On Error
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
initializeEventHandlers: ->
|
||||
# TODO: Reload entire taskboard after create/edit tasks seems
|
||||
|
|
|
@ -59,11 +59,7 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
@appTitle.set(@scope.task.subject + " - " + @scope.project.name)
|
||||
tgLoader.pageLoaded()
|
||||
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
initializeEventHandlers: ->
|
||||
@scope.$on "attachment:create", =>
|
||||
|
|
|
@ -51,11 +51,7 @@ class UserChangePasswordController extends mixOf(taiga.Controller, taiga.PageMix
|
|||
|
||||
promise = @.loadInitialData()
|
||||
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
|
|
|
@ -49,11 +49,7 @@ class UserSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
|
||||
promise = @.loadInitialData()
|
||||
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
|
|
|
@ -51,11 +51,7 @@ class UserNotificationsController extends mixOf(taiga.Controller, taiga.PageMixi
|
|||
|
||||
promise = @.loadInitialData()
|
||||
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
|
|
|
@ -62,11 +62,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
tgLoader.pageLoaded()
|
||||
|
||||
# On Error
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
initializeEventHandlers: ->
|
||||
@scope.$on "attachment:create", =>
|
||||
|
|
|
@ -65,11 +65,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
tgLoader.pageLoaded()
|
||||
|
||||
# On Error
|
||||
promise.then null, (xhr) =>
|
||||
if xhr and xhr.status == 404
|
||||
@location.path(@navUrls.resolve("not-found"))
|
||||
@location.replace()
|
||||
return @q.reject(xhr)
|
||||
promise.then null, @.onInitialDataError.bind(@)
|
||||
|
||||
loadProject: ->
|
||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
div.error-main
|
||||
div.error-container
|
||||
object.logo-svg(type="image/svg+xml", data="/svg/logo.svg")
|
||||
img(src="/images/logo.png", alt="TAIGA")
|
||||
h1.logo Permission denied
|
||||
p.error-text Error 403.
|
||||
a(href="/", title="") Take me home
|
Loading…
Reference in New Issue