Skip to content

Commit 2fcda7f

Browse files
committed
Enable Profile editing
1 parent 3a9b0ac commit 2fcda7f

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

client/app/modules/users/controllers/users.ctrl.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
2-
angular.module ('com.module.users')
3-
.controller ('UsersCtrl', function ($scope, User, SweetAlert, gettextCatalog) {
2+
angular.module('com.module.users')
3+
.controller('UsersCtrl', function ($scope, User, toasty, gettextCatalog) {
44

5-
$scope.user = User.getCurrent (function (user) {
6-
console.log (user);
5+
$scope.user = User.getCurrent(function (user) {
6+
console.log(user);
77
}, function (err) {
8-
console.log (err);
8+
console.log(err);
99
});
1010

1111
$scope.formFields = [
@@ -32,7 +32,7 @@ angular.module ('com.module.users')
3232
type: 'text',
3333
label: 'Last name',
3434
required: true
35-
},
35+
}
3636
];
3737

3838
$scope.formOptions = {
@@ -42,19 +42,18 @@ angular.module ('com.module.users')
4242
};
4343

4444
$scope.onSubmit = function () {
45-
SweetAlert.swal ({
46-
title: gettextCatalog.getString('Sorry!'),
47-
text: gettextCatalog.getString('Updating your profile is not yet implemented :('),
48-
type: 'warning',
49-
showCancelButton: false,
50-
confirmButtonColor: '#DD6B55'
45+
User.upsert($scope.user, function () {
46+
toasty.pop.success({
47+
title: gettextCatalog.getString('Profile saved'),
48+
msg: gettextCatalog.getString('Enjoy the new you!'),
49+
sound: false
50+
});
51+
}, function (err) {
52+
toasty.pop.error({
53+
title: gettextCatalog.getString('Error deleting note'),
54+
msg: gettextCatalog.getString('Your note is not deleted: ') + err,
55+
sound: false
56+
});
5157
});
52-
53-
// User.upsert($scope.user, function () {
54-
// toasty.pop.success({title: 'Profile saved', msg: 'Enjoy the new you!', sound: false});
55-
//// $state.go('^.list');
56-
// }, function (err) {
57-
// console.log(err);
58-
// });
5958
};
6059
});

0 commit comments

Comments
 (0)