Remove .html extensions from all links and URLs
- Updated all navigation links in HTML files - Updated all hrefs and window.location redirects in JavaScript - All links now use clean URLs without .html extensions - Improves SEO and provides cleaner user experience
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Admin JavaScript for Ryans Recruit Firm
|
||||
|
||||
// Check authentication on all admin pages except login
|
||||
if (!window.location.pathname.includes('login.html')) {
|
||||
if (!window.location.pathname.includes('login')) {
|
||||
checkAuth();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ async function checkAuth() {
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.loggedIn) {
|
||||
window.location.href = '/admin/login.html';
|
||||
window.location.href = '/admin/login';
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ async function checkAuth() {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Auth check failed:', err);
|
||||
window.location.href = '/admin/login.html';
|
||||
window.location.href = '/admin/login';
|
||||
}
|
||||
}
|
||||
|
||||
// Login page handlers
|
||||
if (window.location.pathname.includes('login.html')) {
|
||||
if (window.location.pathname.includes('login')) {
|
||||
checkFirstAdmin();
|
||||
document.getElementById('login-form')?.addEventListener('submit', handleLogin);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ async function handleLogin(e) {
|
||||
|
||||
if (response.ok) {
|
||||
showAlert('Login successful!', 'success');
|
||||
setTimeout(() => window.location.href = '/admin/dashboard.html', 500);
|
||||
setTimeout(() => window.location.href = '/admin/dashboard', 500);
|
||||
} else {
|
||||
showAlert(result.error || 'Login failed', 'error');
|
||||
}
|
||||
@@ -85,7 +85,7 @@ async function handleLogin(e) {
|
||||
}
|
||||
|
||||
// Dashboard page
|
||||
if (window.location.pathname.includes('dashboard.html')) {
|
||||
if (window.location.pathname.includes('dashboard')) {
|
||||
loadDashboardStats();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ async function loadDashboardStats() {
|
||||
}
|
||||
|
||||
// Applications page
|
||||
if (window.location.pathname.includes('applicants.html')) {
|
||||
if (window.location.pathname.includes('applicants')) {
|
||||
loadApplications();
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ async function loadApplications(filters = {}) {
|
||||
<td>${new Date(app.applied_at).toLocaleDateString()}</td>
|
||||
<td><span class="tag tag-${getStatusColor(app.status)}">${escapeHtml(app.status)}</span></td>
|
||||
<td>
|
||||
<a href="/admin/applicants.html?id=${app.id}" class="btn btn-sm btn-primary">View</a>
|
||||
<a href="/admin/applicants?id=${app.id}" class="btn btn-sm btn-primary">View</a>
|
||||
<a href="/api/admin/applications/${app.id}/cv" class="btn btn-sm btn-secondary" target="_blank">CV</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -169,7 +169,7 @@ async function loadApplications(filters = {}) {
|
||||
}
|
||||
|
||||
// Jobs management page
|
||||
if (window.location.pathname.includes('jobs.html') && window.location.pathname.includes('admin')) {
|
||||
if (window.location.pathname.includes('jobs') && window.location.pathname.includes('admin')) {
|
||||
loadAdminJobs();
|
||||
}
|
||||
|
||||
@@ -246,10 +246,10 @@ async function toggleJobStatus(jobId, isActive) {
|
||||
async function logout() {
|
||||
try {
|
||||
await fetch('/api/admin/logout', { method: 'POST' });
|
||||
window.location.href = '/admin/login.html';
|
||||
window.location.href = '/admin/login';
|
||||
} catch (err) {
|
||||
console.error('Logout error:', err);
|
||||
window.location.href = '/admin/login.html';
|
||||
window.location.href = '/admin/login';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Main JavaScript for Ryans Recruit Firm
|
||||
|
||||
// Load jobs on jobs.html page
|
||||
if (window.location.pathname.includes('jobs.html')) {
|
||||
if (window.location.pathname.includes('jobs')) {
|
||||
loadJobs();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ async function loadJobs() {
|
||||
</div>
|
||||
</div>
|
||||
<p class="job-description">${escapeHtml(job.description.substring(0, 200))}...</p>
|
||||
<a href="/apply.html?job=${job.id}" class="btn btn-primary">Apply Now</a>
|
||||
<a href="/apply?job=${job.id}" class="btn btn-primary">Apply Now</a>
|
||||
</div>
|
||||
`).join('');
|
||||
} catch (err) {
|
||||
@@ -45,7 +45,7 @@ async function loadJobs() {
|
||||
}
|
||||
|
||||
// Handle application form on apply.html
|
||||
if (window.location.pathname.includes('apply.html')) {
|
||||
if (window.location.pathname.includes('apply')) {
|
||||
loadJobDetails();
|
||||
document.getElementById('application-form')?.addEventListener('submit', handleApplicationSubmit);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ async function handleApplicationSubmit(e) {
|
||||
if (response.ok) {
|
||||
showAlert('Application submitted successfully! We\'ll be in touch soon.', 'success');
|
||||
form.reset();
|
||||
setTimeout(() => window.location.href = '/jobs.html', 2000);
|
||||
setTimeout(() => window.location.href = '/jobs', 2000);
|
||||
} else {
|
||||
showAlert(result.error || 'Failed to submit application', 'error');
|
||||
}
|
||||
@@ -110,7 +110,7 @@ async function handleApplicationSubmit(e) {
|
||||
}
|
||||
|
||||
// Handle contact form on contact.html
|
||||
if (window.location.pathname.includes('contact.html')) {
|
||||
if (window.location.pathname.includes('contact')) {
|
||||
document.getElementById('contact-form')?.addEventListener('submit', handleContactSubmit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user