diff --git a/www/plugins/es/i18n/locale-en-GB.json b/www/plugins/es/i18n/locale-en-GB.json index 64a78d0dafc1c34c17235537a5a103b5e5a52989..d205bc18d2ef32bbd98de5a1f7008065e79a577b 100644 --- a/www/plugins/es/i18n/locale-en-GB.json +++ b/www/plugins/es/i18n/locale-en-GB.json @@ -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": { diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json index 64a78d0dafc1c34c17235537a5a103b5e5a52989..d205bc18d2ef32bbd98de5a1f7008065e79a577b 100644 --- a/www/plugins/es/i18n/locale-en.json +++ b/www/plugins/es/i18n/locale-en.json @@ -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": { diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index 932ab12e56fc51b2e71d0f82a79469185a97a0d6..b4730b970812dcbd9f94ddb400f209591ef96142 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -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": { diff --git a/www/plugins/es/js/controllers/wallet-controllers.js b/www/plugins/es/js/controllers/wallet-controllers.js index 6f1693c3bcc9d969c15f25fe314e592a02944dfe..e6f330b89852ab27bc2e368bd7cfb3580549ed5e 100644 --- a/www/plugins/es/js/controllers/wallet-controllers.js +++ b/www/plugins/es/js/controllers/wallet-controllers.js @@ -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')); + } + }); + }); + }; } diff --git a/www/plugins/es/js/services/profile-services.js b/www/plugins/es/js/services/profile-services.js index ab9ce3cfa66bae8790f2014a4e8913f89387c781..39ab95e81b8998527189c1c92da029571b246a29 100644 --- a/www/plugins/es/js/services/profile-services.js +++ b/www/plugins/es/js/services/profile-services.js @@ -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") }; }) ; diff --git a/www/plugins/es/templates/wallet/view_wallet_extend.html b/www/plugins/es/templates/wallet/view_wallet_extend.html index 404fe6469aac60cb5c77ed9476886c844c79d722..ded69764e967322e7d447df582cc103400b09480 100644 --- a/www/plugins/es/templates/wallet/view_wallet_extend.html +++ b/www/plugins/es/templates/wallet/view_wallet_extend.html @@ -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>