Skip to content

Commit

Permalink
Add profile edit ability. Refs #11
Browse files Browse the repository at this point in the history
  • Loading branch information
queso committed Jan 30, 2015
1 parent 91617a0 commit d40256a
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ matb33:collection-hooks
dburles:collection-helpers
momentjs:moment
mizzao:autocomplete
joshowens:simple-form
pfafman:coffee-alerts
2 changes: 2 additions & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ mrt:[email protected]
[email protected]
[email protected]
[email protected]
pfafman:[email protected]_1
pfafman:[email protected]
[email protected]
[email protected]
[email protected]
Expand Down
1 change: 1 addition & 0 deletions client/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Meteor.startup(function () {
AccountsEntry.config({
homeRoute: '/',
dashboardRoute: '/',
profileRoute: '/profile/edit',
passwordSignupFields: 'USERNAME_AND_EMAIL',
extraSignUpFields: [{
field: 'name',
Expand Down
1 change: 1 addition & 0 deletions client/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
{{> header}}
</header>

{{> coffeeAlerts}}
{{> yield}}
</template>
5 changes: 5 additions & 0 deletions client/header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Template.header.helpers({
user: function() {
return Meteor.user();
}
});
25 changes: 25 additions & 0 deletions client/profileEdit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template name="profileEdit">
<div class="entry">
{{#with profile}}
<form>
<div class='form-group'>
{{text_field 'name' required=true}}
</div>

<div class="form-group">
{{text_area 'description'}}
</div>

<div class="form-group">
{{text_field 'url' type="url"}}
</div>

<div class="form-group">
<p> file upload</p>
</div>

{{submit_button 'Update profile'}}
</form>
{{/with}}
</div>
</template>
14 changes: 14 additions & 0 deletions client/profileEdit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Template.profileEdit.events({
'submit form': function(event, template) {
event.preventDefault();
data = SimpleForm.processForm(event.target);
Users.update(Meteor.userId(), {$set: {profile: data}}, function(err) {
if (err) {
CoffeeAlerts.warning("There was an error saving your profile.");
} else {
CoffeeAlerts.success("Your profile has been updated.");
Router.go("/");
}
});
}
});
7 changes: 7 additions & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,11 @@ Router.map(function() {
};
}
});

this.route('profileEdit', {
path: '/profile/edit',
data: function() {
return Meteor.user();
}
});
});

0 comments on commit d40256a

Please sign in to comment.