Commit eea13362 authored by Benoit Lavenier's avatar Benoit Lavenier

Merge branch '#684-delete-cesiumPlus-profile' into 'master'

#684 delete cesium profile

See merge request clients/cesium/cesium!560
parents 910a348a db7691fe
......@@ -298,6 +298,7 @@
"NO_PROFILE_DEFINED": "No Cesium+ profile",
"BTN_ADD": "Create my profile",
"BTN_EDIT": "Edit my profile",
"BTN_DELETE": "Delete my profile",
"UID": "Pseudonym",
"TITLE": "Lastname, FirstName",
"TITLE_HELP": "Name",
......@@ -314,13 +315,18 @@
"RESIZE_HELP": "<b>Re-crop the image</b> if necessary. A click on the image allows to move it. Click on the area at the bottom left to zoom in.",
"RESULT_HELP": "<b>Here is the result</b> as seen on your profile:"
},
"CONFIRM": {
"DELETE": "Are you sure you want to <b>delete your cesium+ profile ?</b><br/><br/>This operation is irreversible."
},
"ERROR": {
"REMOVE_PROFILE_FAILED": "Deleting profile failed",
"LOAD_PROFILE_FAILED": "Could not load user profile.",
"SAVE_PROFILE_FAILED": "Saving profile failed",
"INVALID_SOCIAL_NETWORK_FORMAT": "Invalid format: please fill a valid Internet address.<br/><br/>Examples :<ul><li>- A Facebook page (https://www.facebook.com/user)</li><li>- A web page (http://www.domain.com)</li><li>- An email address (joe@dalton.com)</li></ul>",
"IMAGE_RESIZE_FAILED": "Error while resizing picture"
},
"INFO": {
"PROFILE_REMOVED": "Profile deleted",
"PROFILE_SAVED": "Profile saved"
},
"HELP": {
......
......@@ -298,6 +298,7 @@
"NO_PROFILE_DEFINED": "No Cesium+ profile",
"BTN_ADD": "Create my profile",
"BTN_EDIT": "Edit my profile",
"BTN_DELETE": "Delete my profile",
"UID": "Pseudonym",
"TITLE": "Lastname, FirstName",
"TITLE_HELP": "Name",
......@@ -314,13 +315,18 @@
"RESIZE_HELP": "<b>Re-crop the image</b> if necessary. A click on the image allows to move it. Click on the area at the bottom left to zoom in.",
"RESULT_HELP": "<b>Here is the result</b> as seen on your profile:"
},
"CONFIRM": {
"DELETE": "Are you sure you want to <b>delete your cesium+ profile ?</b><br/><br/>This operation is irreversible."
},
"ERROR": {
"REMOVE_PROFILE_FAILED": "Deleting profile failed",
"LOAD_PROFILE_FAILED": "Could not load user profile.",
"SAVE_PROFILE_FAILED": "Saving profile failed",
"INVALID_SOCIAL_NETWORK_FORMAT": "Invalid format: please fill a valid Internet address.<br/><br/>Examples :<ul><li>- A Facebook page (https://www.facebook.com/user)</li><li>- A web page (http://www.domain.com)</li><li>- An email address (joe@dalton.com)</li></ul>",
"IMAGE_RESIZE_FAILED": "Error while resizing picture"
},
"INFO": {
"PROFILE_REMOVED": "Profile deleted",
"PROFILE_SAVED": "Profile saved"
},
"HELP": {
......
......@@ -349,6 +349,7 @@
"NO_PROFILE_DEFINED": "Aucun profil saisi",
"BTN_ADD": "Saisir mon profil",
"BTN_EDIT": "Editer mon profil",
"BTN_DELETE": "Supprimer mon profil",
"UID": "Pseudonyme",
"TITLE": "Nom, Prénom",
"TITLE_HELP": "Nom, Prénom",
......@@ -365,13 +366,18 @@
"RESIZE_HELP": "<b>Recadrez l'image</b>, si besoin. Un clic maintenu sur l'image permet de la déplacer. Cliquez sur la zone en bas à gauche pour zoomer.",
"RESULT_HELP": "<b>Voici le résultat</b> tel que visible sur votre profil :"
},
"CONFIRM": {
"DELETE": "Etes-vous sur de vouloir <b>supprimer votre profif cesium+ ?</b><br/><br/>Cette opération est irréversible."
},
"ERROR": {
"REMOVE_PROFILE_FAILED": "Erreur de suppression du profil",
"LOAD_PROFILE_FAILED": "Erreur de chargement du profil utilisateur.",
"SAVE_PROFILE_FAILED": "Erreur lors de la sauvegarde",
"INVALID_SOCIAL_NETWORK_FORMAT": "Format non pris en compte : veuillez indiquer une adresse valide.<br/><br/>Exemples :<ul><li>- Une page Facebook (https://www.facebook.com/user)</li><li>- Une page web (http://www.monsite.fr)</li><li>- Une adresse email (joe@dalton.com)</li></ul>",
"IMAGE_RESIZE_FAILED": "Erreur lors du redimensionnement de l'image"
},
"INFO": {
"PROFILE_REMOVED": "Profil supprimé",
"PROFILE_SAVED": "Profil sauvegardé"
},
"HELP": {
......
......@@ -23,7 +23,7 @@ angular.module('cesium.es.wallet.controllers', ['cesium.es.services'])
;
function ESWalletController($scope, $controller, esModals) {
function ESWalletController($scope, $controller, esModals,csWallet,UIUtils,esProfile) {
'ngInject';
// Initialize the super class and extend it.
......@@ -34,5 +34,24 @@ function ESWalletController($scope, $controller, esModals) {
$scope.showNewPageModal = function() {
return esModals.showNewPage();
};
$scope.deleteProfile = function(){
return csWallet && csWallet.auth({minData: true})
.then(function(walletData) {
UIUtils.loading.hide();
UIUtils.alert.confirm('PROFILE.CONFIRM.DELETE')
.then(function(confirm) {
if (confirm){
esProfile.remove(walletData.pubkey)
.then(function () {
$scope.formData.name=null;
$scope.formData.profile = null;
$scope.doUpdate(true);
UIUtils.toast.show('PROFILE.INFO.PROFILE_REMOVED');
}).catch(UIUtils.onError('PROFILE.ERROR.REMOVE_PROFILE_FAILED'));
}
});
});
};
}
......@@ -390,7 +390,8 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http
add: esHttp.record.post('/user/profile', {tagFields: ['title', 'description']}),
update: esHttp.record.post('/user/profile/:id/_update', {tagFields: ['title', 'description']}),
avatar: esHttp.get('/user/profile/:id?_source=avatar'),
fillAvatars: fillAvatars
fillAvatars: fillAvatars,
remove: esHttp.record.remove("user","profile")
};
})
;
......@@ -16,6 +16,14 @@
</a>
</div>
<div class="item item-right">
<a class="badge button button-text button-small button-small-padding "
ng-click="deleteProfile()">
<i ng-if="formData.profile" class="icon ion-trash-a assertive"></i>
<span class="assertive" ng-if="formData.profile" translate>PROFILE.BTN_DELETE</span>
</a>
</div>
<div class="item item-text-wrap positive item-small-height" ng-show="showProfileHelp">
<small translate>PROFILE.PROFILE_DIVIDER_HELP</small>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment