Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# bowfolios
Portfolios and networking for the University of Hawaii commnity.
Portfolios and networking for the University of Hawaii community.
13 changes: 8 additions & 5 deletions app/imports/api/profile/ProfileCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ProfileCollection extends BaseCollection {
interests: { type: Array, optional: true },
'interests.$': { type: String },
title: { type: String, optional: true },
location: { type: String, optional: true },
picture: { type: SimpleSchema.RegEx.Url, optional: true },
github: { type: SimpleSchema.RegEx.Url, optional: true },
facebook: { type: SimpleSchema.RegEx.Url, optional: true },
Expand All @@ -43,6 +44,7 @@ class ProfileCollection extends BaseCollection {
* bio: 'I have been a professor of computer science at UH since 1990.',
* interests: ['Application Development', 'Software Engineering', 'Databases'],
* title: 'Professor of Information and Computer Sciences',
* location: 'Honolulu',
* picture: 'http://philipmjohnson.org/headshot.jpg',
* github: 'https://github.com/philipmjohnson',
* facebook: 'https://facebook.com/philipmjohnson',
Expand All @@ -56,11 +58,11 @@ class ProfileCollection extends BaseCollection {
* @returns The newly created docID.
*/
define({ firstName = '', lastName = '', username, bio = '', interests = [], picture = '', title = '', github = '',
facebook = '', instagram = '' }) {
facebook = '', instagram = '', location }) {
// make sure required fields are OK.
const checkPattern = { firstName: String, lastName: String, username: String, bio: String, picture: String,
title: String };
check({ firstName, lastName, username, bio, picture, title }, checkPattern);
title: String, location: String };
check({ firstName, lastName, username, bio, picture, title, location }, checkPattern);

if (this.find({ username }).count() > 0) {
throw new Meteor.Error(`${username} is previously defined in another Profile`);
Expand All @@ -75,7 +77,7 @@ class ProfileCollection extends BaseCollection {
}

return this._collection.insert({ firstName, lastName, username, bio, interests, picture, title, github,
facebook, instagram });
facebook, instagram, location });
}

/**
Expand All @@ -95,7 +97,8 @@ class ProfileCollection extends BaseCollection {
const github = doc.github;
const facebook = doc.facebook;
const instagram = doc.instagram;
return { firstName, lastName, username, bio, interests, picture, title, github, facebook, instagram };
const location = doc.location;
return { firstName, lastName, username, bio, interests, picture, title, github, facebook, instagram, location };
}
}

Expand Down
5 changes: 4 additions & 1 deletion app/imports/api/profile/ProfileCollection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ if (Meteor.isServer) {
const interests = [interestName];
const picture = 'http://philipmjohnson.org/headshot.jpg';
const title = 'Professor Computer Science';
const location = 'Honolulu, HI';
const github = 'http://github.com/philipjohnson';
const facebook = 'http://github.com/philipjohnson';
const instagram = 'http://github.com/philipjohnson';
const defineObject = { firstName, lastName, username, bio, interests, picture, title, github, facebook, instagram };
const defineObject = { firstName, lastName, username, bio, interests, picture, title, github, facebook, instagram,
location };

before(function setup() {
removeAllEntities();
Expand All @@ -48,6 +50,7 @@ if (Meteor.isServer) {
expect(doc.github).to.equal(github);
expect(doc.facebook).to.equal(facebook);
expect(doc.instagram).to.equal(instagram);
expect(doc.location).to.equal(location);
// Check that multiple definitions with the same email address fail
expect(function foo() { Profiles.define(defineObject); }).to.throw(Error);
// Check that we can dump and restore a Profile.
Expand Down
3 changes: 3 additions & 0 deletions app/imports/ui/components/directory/directory-profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<div class="meta">
{{ profile.title}}
</div>
<div class="meta">
{{ profile.location}}
</div>
<div class="description">
{{ profile.bio }}
</div>
Expand Down
1 change: 1 addition & 0 deletions app/imports/ui/pages/user/profile-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<div class="field">
{{> Text_Form_Control label="Title" placeholder="Student" value=profile.title errorMessage=(fieldError "title")}}
{{> Text_Form_Control label="Location" placeholder="Location" value=profile.location errorMessage=(fieldError "location")}}
{{> Text_Form_Control label="Picture" placeholder="http://foo.com/shot.jpg" value=profile.picture errorMessage=(fieldError "picture")}}
</div>

Expand Down
3 changes: 2 additions & 1 deletion app/imports/ui/pages/user/profile-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Template.Profile_Page.events({
const firstName = event.target.First.value;
const lastName = event.target.Last.value;
const title = event.target.Title.value;
const location = event.target.Location.value;
const username = FlowRouter.getParam('username'); // schema requires username.
const picture = event.target.Picture.value;
const github = event.target.Github.value;
Expand All @@ -57,7 +58,7 @@ Template.Profile_Page.events({
const interests = _.map(selectedInterests, (option) => option.value);

const updatedProfileData = { firstName, lastName, title, picture, github, facebook, instagram, bio, interests,
username };
username, location };

// Clear out any old validation errors.
instance.context.reset();
Expand Down
5 changes: 5 additions & 0 deletions app/private/database/initial-collection-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"Evolutionary Computation"
],
"title": "Associate Professor, Information and Computer Sciences",
"location": "Honolulu, HI",
"picture": "/images/altenberg.jpg"
},
{
Expand All @@ -105,6 +106,7 @@
"Computer Vision"
],
"title": "Associate Professor, Information and Computer Sciences",
"location": "Honolulu, HI",
"picture": "/images/baek.jpg"
},
{
Expand All @@ -117,6 +119,7 @@
"Sailing"
],
"title": "Associate Professor, Information and Computer Sciences",
"location": "Honolulu, HI",
"picture": "/images/biagioni.jpg"
},
{
Expand All @@ -129,6 +132,7 @@
"Imu Cooking"
],
"title": "Associate Professor, Information and Computer Sciences",
"location": "Honolulu, HI",
"picture": "/images/binsted.jpg"
},
{
Expand All @@ -142,6 +146,7 @@
"Photography"
],
"title": "Professor, Information and Computer Sciences",
"location": "Honolulu, HI",
"picture": "/images/casanova.jpg"
}
]
Expand Down