Merge pull request #227 from taigaio/bug/1847/hide-loading-on-permissions-errors

Bug #1847: Hide loading overlay on permissions error
stable
Alejandro 2015-01-09 09:31:24 +01:00
commit e6daab8a76
11 changed files with 29 additions and 13 deletions

View File

@ -74,11 +74,12 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
@scope.$broadcast("showTags", @showTags) @scope.$broadcast("showTags", @showTags)
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
# Finally
promise.finally tgLoader.pageLoaded
initializeEventHandlers: -> initializeEventHandlers: ->
@scope.$on "usform:bulk:success", => @scope.$on "usform:bulk:success", =>
@.loadUserstories() @.loadUserstories()

View File

@ -62,11 +62,13 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then => promise.then =>
@appTitle.set(@scope.issue.subject + " - " + @scope.project.name) @appTitle.set(@scope.issue.subject + " - " + @scope.project.name)
@.initializeOnDeleteGoToUrl() @.initializeOnDeleteGoToUrl()
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
# Finally
promise.finally tgLoader.pageLoaded
initializeEventHandlers: -> initializeEventHandlers: ->
@scope.$on "attachment:create", => @scope.$on "attachment:create", =>
@rootscope.$broadcast("history:reload") @rootscope.$broadcast("history:reload")

View File

@ -71,11 +71,13 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
# On Success # On Success
promise.then => promise.then =>
@appTitle.set("Issues - " + @scope.project.name) @appTitle.set("Issues - " + @scope.project.name)
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
# Finally
promise.finally tgLoader.pageLoaded
@scope.$on "issueform:new:success", => @scope.$on "issueform:new:success", =>
@analytics.trackEvent("issue", "create", "create issue on issues list", 1) @analytics.trackEvent("issue", "create", "create issue on issues list", 1)
@.loadIssues() @.loadIssues()

View File

@ -78,11 +78,13 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
# On Success # On Success
promise.then => promise.then =>
@appTitle.set("Kanban - " + @scope.project.name) @appTitle.set("Kanban - " + @scope.project.name)
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
# Finally
promise.finally tgLoader.pageLoaded
initializeEventHandlers: -> initializeEventHandlers: ->
@scope.$on "usform:new:success", => @scope.$on "usform:new:success", =>
@.loadUserstories() @.loadUserstories()

View File

@ -38,7 +38,7 @@ class ProjectsController extends taiga.Controller
] ]
constructor: (@scope, @q, @rs, @rootscope, @navUrls, @auth, @location, @appTitle, @projectUrl, constructor: (@scope, @q, @rs, @rootscope, @navUrls, @auth, @location, @appTitle, @projectUrl,
@tgLoader) -> tgLoader) ->
@appTitle.set("Projects") @appTitle.set("Projects")
if !@auth.isAuthenticated() if !@auth.isAuthenticated()
@ -51,10 +51,12 @@ class ProjectsController extends taiga.Controller
promise.then () => promise.then () =>
@scope.$emit("projects:loaded") @scope.$emit("projects:loaded")
@tgLoader.pageLoaded()
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
# Finally
promise.finally tgLoader.pageLoaded
loadInitialData: -> loadInitialData: ->
return @rs.projects.list().then (projects) => return @rs.projects.list().then (projects) =>
@.projects = {'recents': projects.slice(0, 8), 'all': projects} @.projects = {'recents': projects.slice(0, 8), 'all': projects}

View File

@ -88,9 +88,11 @@ class SearchController extends mixOf(taiga.Controller, taiga.PageMixin)
loadSearchData: (term) -> loadSearchData: (term) ->
promise = @rs.search.do(@scope.projectId, term).then (data) => promise = @rs.search.do(@scope.projectId, term).then (data) =>
@scope.searchResults = data @scope.searchResults = data
@tgLoader.pageLoaded()
return data return data
promise.finally =>
@tgLoader.pageLoaded()
return promise return promise
loadInitialData: -> loadInitialData: ->

View File

@ -64,11 +64,13 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
# On Success # On Success
promise.then => promise.then =>
@appTitle.set("Taskboard - " + @scope.project.name) @appTitle.set("Taskboard - " + @scope.project.name)
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
# Finally
promise.finally tgLoader.pageLoaded
initializeEventHandlers: -> initializeEventHandlers: ->
# TODO: Reload entire taskboard after create/edit tasks seems # TODO: Reload entire taskboard after create/edit tasks seems
# a big overhead. It should be optimized in near future. # a big overhead. It should be optimized in near future.

View File

@ -58,10 +58,11 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then () => promise.then () =>
@appTitle.set(@scope.task.subject + " - " + @scope.project.name) @appTitle.set(@scope.task.subject + " - " + @scope.project.name)
@.initializeOnDeleteGoToUrl() @.initializeOnDeleteGoToUrl()
tgLoader.pageLoaded()
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
promise.finally tgLoader.pageLoaded
initializeEventHandlers: -> initializeEventHandlers: ->
@scope.$on "attachment:create", => @scope.$on "attachment:create", =>
@analytics.trackEvent("attachment", "create", "create attachment on task", 1) @analytics.trackEvent("attachment", "create", "create attachment on task", 1)

View File

@ -53,11 +53,13 @@ class TeamController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then => promise.then =>
#TODO: i18n #TODO: i18n
@appTitle.set("Team - " + @scope.project.name) @appTitle.set("Team - " + @scope.project.name)
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
# Finally
promise.finally tgLoader.pageLoaded
setRole: (role) -> setRole: (role) ->
if role if role
@scope.filtersRole = role @scope.filtersRole = role

View File

@ -60,10 +60,10 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then => promise.then =>
@appTitle.set(@scope.us.subject + " - " + @scope.project.name) @appTitle.set(@scope.us.subject + " - " + @scope.project.name)
@.initializeOnDeleteGoToUrl() @.initializeOnDeleteGoToUrl()
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
promise.finally tgLoader.pageLoaded
initializeEventHandlers: -> initializeEventHandlers: ->
@scope.$on "related-tasks:update", => @scope.$on "related-tasks:update", =>

View File

@ -63,10 +63,10 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
# On Success # On Success
promise.then () => promise.then () =>
@appTitle.set("Wiki - " + @scope.project.name) @appTitle.set("Wiki - " + @scope.project.name)
tgLoader.pageLoaded()
# On Error # On Error
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
promise.finally tgLoader.pageLoaded
loadProject: -> loadProject: ->
return @rs.projects.getBySlug(@params.pslug).then (project) => return @rs.projects.getBySlug(@params.pslug).then (project) =>