summaryrefslogtreecommitdiffstats
path: root/client/components/users/userProfile.js
blob: 040abed07320d651ddba2ef082c10edb6ba3e409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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')
});