Watch project list homepage changes

stable
Álex Hermida 2018-11-27 11:46:52 +01:00 committed by Alex Hermida
parent e050b31156
commit 66b4e4971f
2 changed files with 10 additions and 2 deletions

View File

@ -35,6 +35,7 @@ module = angular.module("taigaUserSettings")
class UserProjectSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
@.$inject = [
"$rootScope"
"$scope"
"$tgSections"
"$tgResources"
@ -43,7 +44,7 @@ class UserProjectSettingsController extends mixOf(taiga.Controller, taiga.PageMi
"tgCurrentUserService"
]
constructor: (@scope, @tgSections, @rs, @repo, @confirm, @currentUserService) ->
constructor: (@rootScope, @scope, @tgSections, @rs, @repo, @confirm, @currentUserService) ->
@scope.sections = @tgSections.list()
promise = @.loadInitialData()
@ -56,6 +57,7 @@ class UserProjectSettingsController extends mixOf(taiga.Controller, taiga.PageMi
updateCustomHomePage: (projectSettings) ->
onSuccess = =>
@currentUserService.loadProjects()
@rootScope.$broadcast("dropdown-project-list:updated")
@confirm.notify("success")
onError = =>

View File

@ -17,7 +17,7 @@
# File: navigation-bar/dropdown-project-list/dropdown-project-list.directive.coffee
###
DropdownProjectListDirective = (currentUserService, projectsService) ->
DropdownProjectListDirective = (rootScope, currentUserService, projectsService) ->
link = (scope, el, attrs, ctrl) ->
scope.vm = {}
@ -26,6 +26,11 @@ DropdownProjectListDirective = (currentUserService, projectsService) ->
scope.vm.newProject = ->
projectsService.newProject()
updateLinks = ->
el.find(".dropdown-project-list ul li a").data("fullUrl", "")
rootScope.$on("dropdown-project-list:updated", updateLinks)
directive = {
templateUrl: "navigation-bar/dropdown-project-list/dropdown-project-list.html"
scope: {
@ -37,6 +42,7 @@ DropdownProjectListDirective = (currentUserService, projectsService) ->
return directive
DropdownProjectListDirective.$inject = [
"$rootScope",
"tgCurrentUserService",
"tgProjectsService"
]