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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
*.sublime-workspace
*settings.json
.idea/*
README-private.md

npm-debug.log
node_modules

.DS_Store
/**/.DS_Store
.demeteorized/
.demeteorized/
4 changes: 4 additions & 0 deletions both/collections/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ UserSchema = new SimpleSchema({
optional: true,
blackbox: true
},
interestedInJobIds:{
type:[String],
optional:true
},
roles: {
type: Array,
optional: true
Expand Down
30 changes: 30 additions & 0 deletions both/lib/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,36 @@ Meteor.methods({
}
});
},
registerJobInterest: function(jobId) {
check(jobId, String);

var job = Jobs.findOne({
_id: jobId
});

if (!job)
throw new Meteor.Error("Could not find job.");

if (job.status !== "active")
throw new Meteor.Error("You can only show interest in an active job.");

var userProfile = Profiles.findOne({
userId: this.userId
});

if ( !userProfile )
throw new Meteor.Error("You must have a developer profile to register interest in a job.");

Meteor.call("sendJobInterestEmail", job);

Users.update({
_id: this.userId
}, {
$addToSet: {
interestedInJobIds: jobId
}
});
},
adminSetJobStatus: function(jobId, status) {
check(jobId, String);
check(status, String);
Expand Down
10 changes: 10 additions & 0 deletions client/views/jobs/job.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ <h2>
<hr>
<i class="fa fa-trophy fa-fw"></i> Featured Until {{formatDate featuredThrough}}
{{/if}}
{{#if currentUser }}
{{#if $eq status "active" }}
<hr>
{{#if interestedIn }}
The owner of this post has been notified of your interest.
{{else}}
<a id="im-interested" class="btn btn-primary">I'm interested in this</a>
{{/if}}
{{/if}}
{{/if}}
</div>
<div class="col-sm-9">
{{#if htmlDescription}}
Expand Down
16 changes: 16 additions & 0 deletions client/views/jobs/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,27 @@ Template.job.events({
'click #job-deactivate': function(event, template) {
event.preventDefault();
Modal.show('jobDeactivate', template.data);
},

'click #im-interested': function(event, template) {
event.preventDefault();

Meteor.call("registerJobInterest", template.data._id, function(error, result) {
//Modal.hide("jobDeactivate");
});
}
});

Template.job.helpers({
'hasLabel': function() {
return this.jobType || this.remote || this.featured;
},

'interestedIn': function () {
if ( Meteor.user().interestedInJobIds ) {
return Meteor.user().interestedInJobIds.includes(this._id)
} else {
return false;
}
}
});
24 changes: 24 additions & 0 deletions server/lib/methods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Meteor.methods({
sendJobInterestEmail: function(job) {
var userName = getUserName(Users.findOne({
_id: this.userId
}));

var jobOwnerEmail = getUserEmail(Users.findOne({
_id: job.userId
}));

var profile = Profiles.findOne({
userId: this.userId
});

Email.send({
to: jobOwnerEmail,
from: FROM_EMAIL,
subject: userName + " is interested in your job posting!",
text: userName + " is interested in your job posting at:\n\n" + Meteor.absoluteUrl("jobs/" + job._id) +
"\n\nCheck out their profile at:\n\n" + Meteor.absoluteUrl("profiles/" + profile._id)
});
}

})