From 0718b06711ade7cbe9e31ee03d0e94c522ce6a58 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sun, 29 Oct 2017 19:53:06 -1000 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f5bd45..c94a5ec 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # bowfolios -Portfolios and networking for the University of Hawaii commnity. +Portfolios and networking for the University of Hawaii community. From 2b7e2daec73d78778b39847304d8e4cc56558d18 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Mon, 30 Oct 2017 18:26:41 -1000 Subject: [PATCH 2/2] :eggplant: --- app/imports/api/profile/ProfileCollection.js | 13 ++++++++----- app/imports/api/profile/ProfileCollection.test.js | 5 ++++- .../ui/components/directory/directory-profile.html | 3 +++ app/imports/ui/pages/user/profile-page.html | 1 + app/imports/ui/pages/user/profile-page.js | 3 ++- app/private/database/initial-collection-data.json | 5 +++++ 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/imports/api/profile/ProfileCollection.js b/app/imports/api/profile/ProfileCollection.js index 5b40f1a..6888af0 100644 --- a/app/imports/api/profile/ProfileCollection.js +++ b/app/imports/api/profile/ProfileCollection.js @@ -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 }, @@ -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', @@ -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`); @@ -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 }); } /** @@ -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 }; } } diff --git a/app/imports/api/profile/ProfileCollection.test.js b/app/imports/api/profile/ProfileCollection.test.js index 5db7356..cc93db2 100644 --- a/app/imports/api/profile/ProfileCollection.test.js +++ b/app/imports/api/profile/ProfileCollection.test.js @@ -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(); @@ -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. diff --git a/app/imports/ui/components/directory/directory-profile.html b/app/imports/ui/components/directory/directory-profile.html index 94cae71..5c88eb4 100644 --- a/app/imports/ui/components/directory/directory-profile.html +++ b/app/imports/ui/components/directory/directory-profile.html @@ -9,6 +9,9 @@
{{ profile.title}}
+
+ {{ profile.location}} +
{{ profile.bio }}
diff --git a/app/imports/ui/pages/user/profile-page.html b/app/imports/ui/pages/user/profile-page.html index 14a2d48..0fb6fd5 100644 --- a/app/imports/ui/pages/user/profile-page.html +++ b/app/imports/ui/pages/user/profile-page.html @@ -16,6 +16,7 @@
{{> 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")}}
diff --git a/app/imports/ui/pages/user/profile-page.js b/app/imports/ui/pages/user/profile-page.js index bffc538..a707ea0 100644 --- a/app/imports/ui/pages/user/profile-page.js +++ b/app/imports/ui/pages/user/profile-page.js @@ -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; @@ -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(); diff --git a/app/private/database/initial-collection-data.json b/app/private/database/initial-collection-data.json index ca78006..207fbb5 100644 --- a/app/private/database/initial-collection-data.json +++ b/app/private/database/initial-collection-data.json @@ -94,6 +94,7 @@ "Evolutionary Computation" ], "title": "Associate Professor, Information and Computer Sciences", + "location": "Honolulu, HI", "picture": "/images/altenberg.jpg" }, { @@ -105,6 +106,7 @@ "Computer Vision" ], "title": "Associate Professor, Information and Computer Sciences", + "location": "Honolulu, HI", "picture": "/images/baek.jpg" }, { @@ -117,6 +119,7 @@ "Sailing" ], "title": "Associate Professor, Information and Computer Sciences", + "location": "Honolulu, HI", "picture": "/images/biagioni.jpg" }, { @@ -129,6 +132,7 @@ "Imu Cooking" ], "title": "Associate Professor, Information and Computer Sciences", + "location": "Honolulu, HI", "picture": "/images/binsted.jpg" }, { @@ -142,6 +146,7 @@ "Photography" ], "title": "Professor, Information and Computer Sciences", + "location": "Honolulu, HI", "picture": "/images/casanova.jpg" } ]