Merge pull request #444 from gabrielbazan7/fix/disableEmail

disable email notifications
This commit is contained in:
Matias Alejo Garcia 2016-10-14 08:43:40 -03:00 committed by GitHub
commit bfc48d5640
3 changed files with 15 additions and 8 deletions

View file

@ -2,23 +2,25 @@
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, gettextCatalog, profileService, walletService, configService) {
var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.credentials.walletId;
$scope.wallet = profileService.getWallet($stateParams.walletId);
var walletId = $scope.wallet.credentials.walletId;
var config = configService.getSync();
config.emailFor = config.emailFor || {};
$scope.emailForExist = config.emailFor && config.emailFor[walletId];
$scope.email = {
value: config.emailFor && config.emailFor[walletId]
};
$scope.save = function() {
$scope.save = function(val) {
var opts = {
emailFor: {}
};
opts.emailFor[walletId] = $scope.email.value;
opts.emailFor[walletId] = val;
walletService.updateRemotePreferences(wallet, {
email: $scope.email.value,
walletService.updateRemotePreferences($scope.wallet, {
email: val,
}, function(err) {
if (err) $log.warn(err);
configService.set(opts, function(err) {

View file

@ -17,6 +17,10 @@
color: $mid-gray;
margin: 1rem 0;
}
&-description-disabled {
color: cadetblue;
text-decoration: none;
}
.setting-title, .setting-value {
display: block;
overflow: hidden;

View file

@ -9,10 +9,11 @@
<ion-content>
<div class="settings-explaination">
<div class="settings-description" translate>
You'll receive email notifications about payments sent and received from this wallet.
You'll receive email notifications about payments sent and received from {{wallet.name}}.
</div>
<a href ng-if="emailForExist" class="settings-description-disabled" ng-click="save(null)" translate>Remove email notifications</a>
</div>
<form name="emailForm" ng-submit="save(emailForm)" novalidate>
<form name="emailForm" ng-submit="save(email.value)" novalidate>
<div class="list settings-input-group">
<label class="item item-input item-stacked-label">
<span class="input-label" translate>Email Address</span>