userProfile.js 767 B

12345678910111213141516171819202122232425262728293031
  1. Template.profileEditForm.events({
  2. 'click .js-edit-profile': function() {
  3. Session.set('ProfileEditForm', true);
  4. },
  5. 'click .js-cancel-edit-profile': function() {
  6. Session.set('ProfileEditForm', false);
  7. },
  8. 'submit #ProfileEditForm': function(evt, t) {
  9. var name = t.find('#name').value;
  10. var bio = t.find('#bio').value;
  11. // trim and update
  12. if ($.trim(name)) {
  13. Users.update(this.profile()._id, {
  14. $set: {
  15. 'profile.name': name,
  16. 'profile.bio': bio
  17. }
  18. }, function() {
  19. // update complete close profileEditForm
  20. Session.set('ProfileEditForm', false);
  21. });
  22. }
  23. evt.preventDefault();
  24. }
  25. });
  26. Template.memberName.events({
  27. 'click .js-show-mem-menu': Popup.open('user')
  28. });