Dowload user profile
parent
5c635cb5df
commit
912f9928fe
|
@ -234,6 +234,10 @@ class AuthService extends taiga.Service
|
||||||
data = _.clone(data, false)
|
data = _.clone(data, false)
|
||||||
return @http.post(url, data)
|
return @http.post(url, data)
|
||||||
|
|
||||||
|
exportProfile: () ->
|
||||||
|
url = @urls.resolve("users-export")
|
||||||
|
return @http.post(url)
|
||||||
|
|
||||||
module.service("$tgAuth", AuthService)
|
module.service("$tgAuth", AuthService)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ urls = {
|
||||||
"users-change-password": "/users/change_password"
|
"users-change-password": "/users/change_password"
|
||||||
"users-change-email": "/users/change_email"
|
"users-change-email": "/users/change_email"
|
||||||
"users-cancel-account": "/users/cancel"
|
"users-cancel-account": "/users/cancel"
|
||||||
|
"users-export": "/users/export"
|
||||||
"user-stats": "/users/%s/stats"
|
"user-stats": "/users/%s/stats"
|
||||||
"user-liked": "/users/%s/liked"
|
"user-liked": "/users/%s/liked"
|
||||||
"user-voted": "/users/%s/voted"
|
"user-voted": "/users/%s/voted"
|
||||||
|
|
|
@ -47,10 +47,11 @@ class UserSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
"$tgAuth",
|
"$tgAuth",
|
||||||
"$translate",
|
"$translate",
|
||||||
"tgErrorHandlingService"
|
"tgErrorHandlingService"
|
||||||
|
"$window"
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootscope, @config, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
constructor: (@scope, @rootscope, @config, @repo, @confirm, @rs, @params, @q, @location, @navUrls,
|
||||||
@auth, @translate, @errorHandlingService) ->
|
@auth, @translate, @errorHandlingService, @window) ->
|
||||||
@scope.sectionName = "USER_SETTINGS.MENU.SECTION_TITLE"
|
@scope.sectionName = "USER_SETTINGS.MENU.SECTION_TITLE"
|
||||||
|
|
||||||
@scope.project = {}
|
@scope.project = {}
|
||||||
|
@ -90,6 +91,18 @@ class UserSettingsController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
@config.get("defaultTheme") ||
|
@config.get("defaultTheme") ||
|
||||||
"taiga"
|
"taiga"
|
||||||
|
|
||||||
|
exportProfile: ->
|
||||||
|
onSuccess = (result) ->
|
||||||
|
dumpUrl = result.data.url
|
||||||
|
@window.open(dumpUrl, "_blank")
|
||||||
|
|
||||||
|
onError = (response) =>
|
||||||
|
if response.data?._error_message
|
||||||
|
@confirm.notify("error", response.data._error_message)
|
||||||
|
|
||||||
|
@auth.exportProfile().then(onSuccess, onError)
|
||||||
|
|
||||||
|
|
||||||
module.controller("UserSettingsController", UserSettingsController)
|
module.controller("UserSettingsController", UserSettingsController)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1516,6 +1516,7 @@
|
||||||
"USER_PROFILE": {
|
"USER_PROFILE": {
|
||||||
"ACTION_USE_GRAVATAR": "Use default image",
|
"ACTION_USE_GRAVATAR": "Use default image",
|
||||||
"ACTION_DELETE_ACCOUNT": "Delete Taiga account",
|
"ACTION_DELETE_ACCOUNT": "Delete Taiga account",
|
||||||
|
"ACTION_DOWNLOAD_PROFILE": "Download Taiga profile",
|
||||||
"CHANGE_EMAIL_SUCCESS": "<strong>Check your inbox!</strong><br />We have sent a mail to your account<br />with the instructions to set your new address",
|
"CHANGE_EMAIL_SUCCESS": "<strong>Check your inbox!</strong><br />We have sent a mail to your account<br />with the instructions to set your new address",
|
||||||
"CHANGE_PHOTO": "Change photo",
|
"CHANGE_PHOTO": "Change photo",
|
||||||
"FIELD": {
|
"FIELD": {
|
||||||
|
|
|
@ -116,6 +116,14 @@ div.wrapper(
|
||||||
title="{{'COMMON.SAVE' | translate}}",
|
title="{{'COMMON.SAVE' | translate}}",
|
||||||
translate="COMMON.SAVE"
|
translate="COMMON.SAVE"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
div.actions
|
||||||
|
a.download-profile(
|
||||||
|
href=""
|
||||||
|
title="{{'USER_PROFILE.ACTION_DOWNLOAD_PROFILE' | translate}}"
|
||||||
|
ng-click="ctrl.exportProfile()"
|
||||||
|
translate="USER_PROFILE.ACTION_DOWNLOAD_PROFILE"
|
||||||
|
)
|
||||||
a.delete-account(
|
a.delete-account(
|
||||||
href=""
|
href=""
|
||||||
title="{{'USER_PROFILE.ACTION_DELETE_ACCOUNT' | translate}}"
|
title="{{'USER_PROFILE.ACTION_DELETE_ACCOUNT' | translate}}"
|
||||||
|
|
|
@ -6,9 +6,22 @@
|
||||||
.submit-button {
|
.submit-button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-profile,
|
||||||
.delete-account {
|
.delete-account {
|
||||||
@include font-size(small);
|
@include font-size(small);
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 1rem;
|
flex: 1;
|
||||||
|
margin-top: .5rem;
|
||||||
|
}
|
||||||
|
.delete-account {
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue