diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index 81589d24..52c5fafb 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -136,17 +136,17 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, tgLoade $httpProvider.defaults.headers.get = {} # Add next param when user try to access to a secction need auth permissions. - authHttpIntercept = ($q, $location, $confirm) -> + authHttpIntercept = ($q, $location, $confirm, $navUrls) -> return (promise) -> return promise.then null, (response) -> if response.status == 0 - $location.path("/error") + $location.path($navUrls.resolve("error")) else if response.status == 401 nextPath = $location.path() - $location.url("/login").search("next=#{nextPath}") + $location.url($navUrls.resolve("login")).search("next=#{nextPath}") return $q.reject(response) - $provide.factory("authHttpIntercept", ["$q", "$location", "$tgConfirm", authHttpIntercept]) + $provide.factory("authHttpIntercept", ["$q", "$location", "$tgConfirm", "$tgNavUrls", authHttpIntercept]) $httpProvider.responseInterceptors.push('authHttpIntercept') $httpProvider.interceptors.push('loaderInterceptor') diff --git a/app/coffee/modules/admin/project-profile.coffee b/app/coffee/modules/admin/project-profile.coffee index f3ff0fcc..28be9169 100644 --- a/app/coffee/modules/admin/project-profile.coffee +++ b/app/coffee/modules/admin/project-profile.coffee @@ -30,6 +30,7 @@ bindOnce = @.taiga.bindOnce module = angular.module("taigaAdmin") + ############################################################################# ## Project Profile Controller ############################################################################# @@ -85,14 +86,14 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin) openDeleteLightbox: -> @rootscope.$broadcast("deletelightbox:new", @scope.project) - module.controller("ProjectProfileController", ProjectProfileController) + ############################################################################# ## Project Profile Directive ############################################################################# -ProjectProfileDirective = ($rootscope, $log, $repo, $confirm, $location) -> +ProjectProfileDirective = ($rootscope, $log, $repo, $confirm) -> link = ($scope, $el, $attrs) -> form = $el.find("form").checksley({"onlyOneErrorElement": true}) submit = => @@ -101,7 +102,6 @@ ProjectProfileDirective = ($rootscope, $log, $repo, $confirm, $location) -> promise = $repo.save($scope.project) promise.then -> $confirm.notify("success") - $location.path("/project/#{$scope.project.slug}/admin/project-profile/details") $scope.$emit("project:loaded", $scope.project) promise.then null, (data) -> @@ -119,6 +119,9 @@ ProjectProfileDirective = ($rootscope, $log, $repo, $confirm, $location) -> return {link:link} +module.directive("tgProjectProfile", ["$rootScope", "$log", "$tgRepo", "$tgConfirm", ProjectProfileDirective]) + + ############################################################################# ## Project Features Directive ############################################################################# @@ -161,5 +164,4 @@ ProjectFeaturesDirective = ($rootscope, $log, $repo, $confirm) -> return {link:link} -module.directive("tgProjectProfile", ["$rootScope", "$log", "$tgRepo", "$tgConfirm", "$tgLocation", ProjectProfileDirective]) module.directive("tgProjectFeatures", ["$rootScope", "$log", "$tgRepo", "$tgConfirm", ProjectFeaturesDirective]) diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 919916bf..03e32156 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -403,7 +403,7 @@ ChangeEmailDirective = ($repo, $model, $auth, $confirm, $location, $params, $nav onSuccessSubmit = (response) -> $repo.queryOne("users", $auth.getUser().id).then (data) => $auth.setUser(data) - $location.path($navUrls.resolve("home")) # TODO: Use the future 'urls' service + $location.path($navUrls.resolve("home")) $confirm.success("Our Oompa Loompas updated your email") #TODO: i18n onErrorSubmit = (response) -> diff --git a/app/coffee/modules/base.coffee b/app/coffee/modules/base.coffee index 3d1c43ee..e0e29489 100644 --- a/app/coffee/modules/base.coffee +++ b/app/coffee/modules/base.coffee @@ -72,6 +72,7 @@ urls = { "project-wiki": "/project/:project/wiki", "project-wiki-page": "/project/:project/wiki/:slug", + "project-wiki-page-edit": "/project/:project/wiki/:slug/edit", # Admin "project-admin-home": "/project/:project/admin/project-profile/details" diff --git a/app/coffee/modules/nav.coffee b/app/coffee/modules/nav.coffee index e168f860..ec043a52 100644 --- a/app/coffee/modules/nav.coffee +++ b/app/coffee/modules/nav.coffee @@ -25,9 +25,11 @@ bindOnce = @.taiga.bindOnce module = angular.module("taigaNavMenu", []) + ############################################################################# ## Projects Navigation ############################################################################# + class ProjectsNavigationController extends taiga.Controller @.$inject = ["$scope", "$rootScope", "$tgResources", "$tgNavUrls", "$projectUrl"] @@ -59,7 +61,9 @@ class ProjectsNavigationController extends taiga.Controller @rootscope.$broadcast("projects:create") filterProjects: (text) -> - @scope.filteredProjects = _.filter(@scope.projects, (project) -> project.name.toLowerCase().indexOf(text) > -1) + @scope.filteredProjects = _.filter @scope.projects, (project) -> + project.name.toLowerCase().indexOf(text) > -1 + @scope.filterText = text @rootscope.$broadcast("projects:filtered") @@ -193,7 +197,7 @@ module.directive("tgProjectsNav", ["$rootScope", "animationFrame", "$timeout", " ## Project ############################################################################# -ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location) -> +ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location, $navUrls) -> menuEntriesTemplate = _.template("""