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
5 changes: 5 additions & 0 deletions public/styles/jobListing.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions routes/jobRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ const router = express.Router();
const Job = require('../models/Job');
const { requireAuth, alreadyLoggedIn } = require('./middleware/authMiddleware');

// Route to display the job application form
router.get('/jobpost', (req, res) => {
res.render('apply.ejs');
});

// Route to handle job application submissions
router.post('/apply', requireAuth, async (req, res) => {
try {
const { companyName, role, domain, location, skillsRequired, natureOfWork, jobPostingLink } = req.body;
Expand All @@ -21,15 +19,16 @@ router.post('/apply', requireAuth, async (req, res) => {
}
});

// New route to handle GET requests for '/jobs'
router.get('/jobs', async (req, res) => {
try {
const jobs = await Job.find({});
res.render('jobListing.ejs', { jobs });
const isEmpty = jobs.length === 0;
res.render('jobListing.ejs', { jobs, isEmpty });
} catch (error) {
console.error(`Failed to fetch jobs: ${error}`);
res.status(500).json({ message: 'Failed to fetch jobs', error: error.message });
}
});

module.exports = router;
module.exports = router;
```
21 changes: 19 additions & 2 deletions styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,36 @@ button:focus {
outline: 3px solid #007bff;
}


@media (max-width: 768px) {
.container {
width: 95%;
}
header h1 {
font-size: 20px;
}
.job-card h2 {
font-size: 18px;
}
.job-card p, .form-group label, .input-field, textarea {
font-size: 14px;
}
}

footer {
background-color: #000;
color: #000; /* Corrected color to white for visibility */
color: #fff;
padding: 20px;
text-align: center;
text-shadow: none;
z-index: 1000;
position: relative;
}

/* Updated global style with increased specificity */
div.job-card {
background: #ffffff;
padding: 24px;
margin-bottom: 24px;
border-radius: 10px;
box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
}
15 changes: 9 additions & 6 deletions views/jobListing.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Job Listings</title>
<link rel="stylesheet" href="/css/styles.css">
<link rel="stylesheet" href="/css/jobListing.css">
</head>
<body>
<div class="container">
<div class="container" id="job-listings-container">
<% if(jobs && jobs.length > 0) { %>
<% jobs.forEach(function(job) { %>
<div class="job-listing">
<% jobs.forEach(function(job, index) { %>
<div class="job-listing" id="job-listing-<%= index %>">
<h2><%= job.companyName %></h2>
<p>Role: <%= job.role %></p>
<p>Domain: <%= job.domain %></p>
<p>Location: <%= job.location %></p>
<p>Skills Required: <%= job.skillsRequired.join(', ') %></p>
<p>Nature of Work: <%= job.natureOfWork %></p>
<a href="<%= job.jobPostingLink %>" class="apply-button">Apply</a>
<a href="<%= job.jobPostingLink %>" class="apply-button" id="apply-button-<%= index %>">Apply</a>
</div>
<% }); %>
<% } else { %>
<p>No job listings available at the moment.</p>
<p id="no-jobs-message">No job listings available at the moment.</p>
<% } %>
</div>
</body>
<script src="/js/interactivity.js"></script>
</body>
</html>