Skip to content
Snippets Groups Projects
Commit 2f9248da authored by jm's avatar jm
Browse files

#684 delete cesium profile

parent 174d88ea
No related branches found
No related tags found
No related merge requests found
...@@ -297,6 +297,7 @@ ...@@ -297,6 +297,7 @@
"NO_PROFILE_DEFINED": "No Cesium+ profile", "NO_PROFILE_DEFINED": "No Cesium+ profile",
"BTN_ADD": "Create my profile", "BTN_ADD": "Create my profile",
"BTN_EDIT": "Edit my profile", "BTN_EDIT": "Edit my profile",
"BTN_DELETE": "Delete my profile",
"UID": "Pseudonym", "UID": "Pseudonym",
"TITLE": "Lastname, FirstName", "TITLE": "Lastname, FirstName",
"TITLE_HELP": "Name", "TITLE_HELP": "Name",
...@@ -313,13 +314,18 @@ ...@@ -313,13 +314,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.", "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:" "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": { "ERROR": {
"REMOVE_PROFILE_FAILED": "deleting profile failed",
"LOAD_PROFILE_FAILED": "Could not load user profile.", "LOAD_PROFILE_FAILED": "Could not load user profile.",
"SAVE_PROFILE_FAILED": "Saving profile failed", "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>", "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" "IMAGE_RESIZE_FAILED": "Error while resizing picture"
}, },
"INFO": { "INFO": {
"PROFILE_REMOVED": "Profile deleted",
"PROFILE_SAVED": "Profile saved" "PROFILE_SAVED": "Profile saved"
}, },
"HELP": { "HELP": {
......
...@@ -297,6 +297,7 @@ ...@@ -297,6 +297,7 @@
"NO_PROFILE_DEFINED": "No Cesium+ profile", "NO_PROFILE_DEFINED": "No Cesium+ profile",
"BTN_ADD": "Create my profile", "BTN_ADD": "Create my profile",
"BTN_EDIT": "Edit my profile", "BTN_EDIT": "Edit my profile",
"BTN_DELETE": "Delete my profile",
"UID": "Pseudonym", "UID": "Pseudonym",
"TITLE": "Lastname, FirstName", "TITLE": "Lastname, FirstName",
"TITLE_HELP": "Name", "TITLE_HELP": "Name",
...@@ -313,13 +314,18 @@ ...@@ -313,13 +314,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.", "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:" "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": { "ERROR": {
"REMOVE_PROFILE_FAILED": "deleting profile failed",
"LOAD_PROFILE_FAILED": "Could not load user profile.", "LOAD_PROFILE_FAILED": "Could not load user profile.",
"SAVE_PROFILE_FAILED": "Saving profile failed", "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>", "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" "IMAGE_RESIZE_FAILED": "Error while resizing picture"
}, },
"INFO": { "INFO": {
"PROFILE_REMOVED": "Profile deleted",
"PROFILE_SAVED": "Profile saved" "PROFILE_SAVED": "Profile saved"
}, },
"HELP": { "HELP": {
......
...@@ -349,6 +349,7 @@ ...@@ -349,6 +349,7 @@
"NO_PROFILE_DEFINED": "Aucun profil Cesium+", "NO_PROFILE_DEFINED": "Aucun profil Cesium+",
"BTN_ADD": "Saisir mon profil", "BTN_ADD": "Saisir mon profil",
"BTN_EDIT": "Editer mon profil", "BTN_EDIT": "Editer mon profil",
"BTN_DELETE": "Supprimer mon profil",
"UID": "Pseudonyme", "UID": "Pseudonyme",
"TITLE": "Nom, Prénom", "TITLE": "Nom, Prénom",
"TITLE_HELP": "Nom, Prénom", "TITLE_HELP": "Nom, Prénom",
...@@ -365,13 +366,18 @@ ...@@ -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.", "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 :" "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": { "ERROR": {
"REMOVE_PROFILE_FAILED": "Erreur de suppression du profil",
"LOAD_PROFILE_FAILED": "Erreur de chargement du profil utilisateur.", "LOAD_PROFILE_FAILED": "Erreur de chargement du profil utilisateur.",
"SAVE_PROFILE_FAILED": "Erreur lors de la sauvegarde", "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>", "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" "IMAGE_RESIZE_FAILED": "Erreur lors du redimensionnement de l'image"
}, },
"INFO": { "INFO": {
"PROFILE_REMOVED": "Profil supprimé",
"PROFILE_SAVED": "Profil sauvegardé" "PROFILE_SAVED": "Profil sauvegardé"
}, },
"HELP": { "HELP": {
......
...@@ -23,7 +23,7 @@ angular.module('cesium.es.wallet.controllers', ['cesium.es.services']) ...@@ -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'; 'ngInject';
// Initialize the super class and extend it. // Initialize the super class and extend it.
...@@ -34,5 +34,24 @@ function ESWalletController($scope, $controller, esModals) { ...@@ -34,5 +34,24 @@ function ESWalletController($scope, $controller, esModals) {
$scope.showNewPageModal = function() { $scope.showNewPageModal = function() {
return esModals.showNewPage(); 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.delete(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'));
}
});
});
};
} }
angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http.services']) angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http.services', 'cesium.crypto.services'])
.config(function(PluginServiceProvider, csConfig) { .config(function(PluginServiceProvider, csConfig) {
'ngInject'; 'ngInject';
...@@ -22,7 +22,8 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http ...@@ -22,7 +22,8 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http
get: esHttp.get('/user/profile/:id?&_source_exclude=avatar._content'), get: esHttp.get('/user/profile/:id?&_source_exclude=avatar._content'),
getAll: esHttp.get('/user/profile/:id'), getAll: esHttp.get('/user/profile/:id'),
search: esHttp.post('/user/profile/_search'), search: esHttp.post('/user/profile/_search'),
mixedSearch: esHttp.post('/user,page,group/profile,record/_search') mixedSearch: esHttp.post('/user,page,group/profile,record/_search'),
delete: esHttp.post('/user/profile/_delete/:id')
}; };
function getAvatarAndName(pubkey) { function getAvatarAndName(pubkey) {
...@@ -48,6 +49,13 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http ...@@ -48,6 +49,13 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http
}); });
} }
function deleteProfile(pubkey) {
var id = pubkey;
return esHttp.record.remove("user","profile")(id).then(function(res) {
return res;
});
}
function getProfile(pubkey, options) { function getProfile(pubkey, options) {
options = options || {}; options = options || {};
...@@ -390,7 +398,8 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http ...@@ -390,7 +398,8 @@ angular.module('cesium.es.profile.services', ['cesium.services', 'cesium.es.http
add: esHttp.record.post('/user/profile', {tagFields: ['title', 'description']}), add: esHttp.record.post('/user/profile', {tagFields: ['title', 'description']}),
update: esHttp.record.post('/user/profile/:id/_update', {tagFields: ['title', 'description']}), update: esHttp.record.post('/user/profile/:id/_update', {tagFields: ['title', 'description']}),
avatar: esHttp.get('/user/profile/:id?_source=avatar'), avatar: esHttp.get('/user/profile/:id?_source=avatar'),
fillAvatars: fillAvatars fillAvatars: fillAvatars,
delete: deleteProfile
}; };
}) })
; ;
...@@ -16,6 +16,14 @@ ...@@ -16,6 +16,14 @@
</a> </a>
</div> </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"> <div class="item item-text-wrap positive item-small-height" ng-show="showProfileHelp">
<small translate>PROFILE.PROFILE_DIVIDER_HELP</small> <small translate>PROFILE.PROFILE_DIVIDER_HELP</small>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment