summaryrefslogtreecommitdiffstats
path: root/client/components/users/userProfile.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/users/userProfile.js')
-rw-r--r--client/components/users/userProfile.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/client/components/users/userProfile.js b/client/components/users/userProfile.js
new file mode 100644
index 00000000..040abed0
--- /dev/null
+++ b/client/components/users/userProfile.js
@@ -0,0 +1,31 @@
+Template.profileEditForm.events({
+ 'click .js-edit-profile': function() {
+ Session.set('ProfileEditForm', true);
+ },
+ 'click .js-cancel-edit-profile': function() {
+ Session.set('ProfileEditForm', false);
+ },
+ 'submit #ProfileEditForm': function(evt, t) {
+ var name = t.find('#name').value;
+ var bio = t.find('#bio').value;
+
+ // trim and update
+ if ($.trim(name)) {
+ Users.update(this.profile()._id, {
+ $set: {
+ 'profile.name': name,
+ 'profile.bio': bio
+ }
+ }, function() {
+
+ // update complete close profileEditForm
+ Session.set('ProfileEditForm', false);
+ });
+ }
+ evt.preventDefault();
+ }
+});
+
+Template.memberName.events({
+ 'click .js-show-mem-menu': Popup.open('user')
+});