Updating user settings urls

stable
Alejandro Alonso 2015-04-17 09:09:18 +02:00 committed by Juanfran
parent 1a75748763
commit 61d5f47157
7 changed files with 14 additions and 57 deletions

View File

@ -125,11 +125,11 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
{templateUrl: "contrib/main.html"}) {templateUrl: "contrib/main.html"})
# User settings # User settings
$routeProvider.when("/project/:pslug/user-settings/user-profile", $routeProvider.when("/user-settings/user-profile",
{templateUrl: "user/user-profile.html"}) {templateUrl: "user/user-profile.html"})
$routeProvider.when("/project/:pslug/user-settings/user-change-password", $routeProvider.when("/user-settings/user-change-password",
{templateUrl: "user/user-change-password.html"}) {templateUrl: "user/user-change-password.html"})
$routeProvider.when("/project/:pslug/user-settings/mail-notifications", $routeProvider.when("/user-settings/mail-notifications",
{templateUrl: "user/mail-notifications.html"}) {templateUrl: "user/mail-notifications.html"})
$routeProvider.when("/change-email/:email_token", $routeProvider.when("/change-email/:email_token",
{templateUrl: "user/change-email.html"}) {templateUrl: "user/change-email.html"})

View File

@ -103,10 +103,10 @@ urls = {
"project-admin-contrib": "/project/:project/admin/contrib/:plugin" "project-admin-contrib": "/project/:project/admin/contrib/:plugin"
# User settings # User settings
"user-settings-user-profile": "/project/:project/user-settings/user-profile" "user-settings-user-profile": "/user-settings/user-profile"
"user-settings-user-change-password": "/project/:project/user-settings/user-change-password" "user-settings-user-change-password": "/user-settings/user-change-password"
"user-settings-user-avatar": "/project/:project/user-settings/user-avatar" "user-settings-user-avatar": "/user-settings/user-avatar"
"user-settings-mail-notifications": "/project/:project/user-settings/mail-notifications" "user-settings-mail-notifications": "/user-settings/mail-notifications"
} }

View File

@ -49,23 +49,8 @@ class UserChangePasswordController extends mixOf(taiga.Controller, taiga.PageMix
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
@auth, @translate) -> @auth, @translate) ->
@scope.sectionName = @translate.instant("CHANGE_PASSWORD.SECTION_NAME") @scope.sectionName = @translate.instant("CHANGE_PASSWORD.SECTION_NAME")
@scope.project = {}
@scope.user = @auth.getUser() @scope.user = @auth.getUser()
promise = @.loadInitialData()
promise.then null, @.onInitialDataError.bind(@)
loadProject: ->
return @rs.projects.getBySlug(@params.pslug).then (project) =>
@scope.projectId = project.id
@scope.project = project
@scope.$emit('project:loaded', project)
return project
loadInitialData: ->
return @.loadProject()
module.controller("UserChangePasswordController", UserChangePasswordController) module.controller("UserChangePasswordController", UserChangePasswordController)

View File

@ -62,23 +62,11 @@ class UserSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
loadProject: -> loadInitialData: ->
return @rs.projects.getBySlug(@params.pslug).then (project) =>
@scope.projectId = project.id
@scope.project = project
@scope.$emit('project:loaded', project)
return project
loadLocales: ->
return @rs.locales.list().then (locales) => return @rs.locales.list().then (locales) =>
@scope.locales = locales @scope.locales = locales
return locales return locales
loadInitialData: ->
promise = @.loadProject()
promise.then => @.loadLocales()
return promise
openDeleteLightbox: -> openDeleteLightbox: ->
@rootscope.$broadcast("deletelightbox:new", @scope.user) @rootscope.$broadcast("deletelightbox:new", @scope.user)

View File

@ -46,30 +46,15 @@ class UserNotificationsController extends mixOf(taiga.Controller, taiga.PageMixi
constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @auth) -> constructor: (@scope, @rootscope, @repo, @confirm, @rs, @params, @q, @location, @navUrls, @auth) ->
@scope.sectionName = "USER_SETTINGS.NOTIFICATIONS.SECTION_NAME" @scope.sectionName = "USER_SETTINGS.NOTIFICATIONS.SECTION_NAME"
@scope.project = {}
@scope.user = @auth.getUser() @scope.user = @auth.getUser()
promise = @.loadInitialData() promise = @.loadInitialData()
promise.then null, @.onInitialDataError.bind(@) promise.then null, @.onInitialDataError.bind(@)
loadProject: -> loadInitialData: ->
return @rs.projects.getBySlug(@params.pslug).then (project) =>
@scope.projectId = project.id
@scope.project = project
@scope.$emit('project:loaded', project)
return project
loadNotifyPolicies: ->
return @rs.notifyPolicies.list().then (notifyPolicies) => return @rs.notifyPolicies.list().then (notifyPolicies) =>
@scope.notifyPolicies = notifyPolicies @scope.notifyPolicies = notifyPolicies
return notifyPolicies return notifyPolicies
loadInitialData: ->
promise = @.loadProject()
promise.then(=> @.loadNotifyPolicies())
return promise
module.controller("UserNotificationsController", UserNotificationsController) module.controller("UserNotificationsController", UserNotificationsController)

View File

@ -3,17 +3,16 @@ div.navbar-dropdown.dropdown-user
li li
a(href="#", title="{{ user.fullname }} profile") View Profile a(href="#", title="{{ user.fullname }} profile") View Profile
li li
a(href="#", title="Edit your profile") Edit Profile a(href="#", tg-nav="user-settings-user-profile", title="Edit your profile") Edit Profile
li li
a(href="#", title="Edit your organizations") Edit Organizations a(href="#", title="Edit your organizations") Edit Organizations
li li
a(href="#", title="Edit your settings") Settings a(href="#", title="Edit your settings") Settings
li li
a(href="#", title="Edit your notifications") Notifications a(href="#", tg-nav="user-settings-mail-notifications", title="Edit your notifications") Notifications
li li
a(href="#", title="Send feedback") Feedback a(href="#", title="Send feedback") Feedback
li li
a(href="#", title="Go to support") Help a(href="#", title="Go to support") Help
li li
a(href="#", title="Logout") Logout a(href="#", title="Logout") Logout

View File

@ -5,14 +5,14 @@ section.admin-menu
nav nav
ul ul
li#usersettingsmenu-user-profile li#usersettingsmenu-user-profile
a(href="", tg-nav="user-settings-user-profile:project=project.slug") a(href="", tg-nav="user-settings-user-profile")
span.title(translate="USER_SETTINGS.MENU.USER_PROFILE") span.title(translate="USER_SETTINGS.MENU.USER_PROFILE")
span.icon.icon-arrow-right span.icon.icon-arrow-right
li#usersettingsmenu-change-password li#usersettingsmenu-change-password
a(href="" tg-nav="user-settings-user-change-password:project=project.slug") a(href="" tg-nav="user-settings-user-change-password")
span.title(translate="USER_SETTINGS.MENU.CHANGE_PASSWORD") span.title(translate="USER_SETTINGS.MENU.CHANGE_PASSWORD")
span.icon.icon-arrow-right span.icon.icon-arrow-right
li#usersettingsmenu-mail-notifications li#usersettingsmenu-mail-notifications
a(href="", tg-nav="user-settings-mail-notifications:project=project.slug") a(href="", tg-nav="user-settings-mail-notifications")
span.title(translate="USER_SETTINGS.MENU.EMAIL_NOTIFICATIONS") span.title(translate="USER_SETTINGS.MENU.EMAIL_NOTIFICATIONS")
span.icon.icon-arrow-right span.icon.icon-arrow-right