forked from UKSOURCE/cms.hailearning.edu.vn
refactor: remove camp location functionality
This commit is contained in:
@@ -3,7 +3,7 @@ const BlogCategory = require('../models/blogCategory');
|
||||
const BlogTag = require('../models/blogTag');
|
||||
const BlogComment = require('../models/blogComment');
|
||||
const RecentPost = require('../models/recentPost');
|
||||
const { addBaseUrlToImages } = require('../utils/imageHelper');
|
||||
const { addBaseUrlToImages, getFullImageUrl } = require('../utils/imageHelper');
|
||||
const slugify = require('slugify');
|
||||
|
||||
// -------------------- Helper Functions --------------------
|
||||
@@ -71,6 +71,7 @@ exports.index = async (req, res) => {
|
||||
const categories = await BlogCategory.getActive();
|
||||
|
||||
const frontendUrl = process.env.FRONTEND_URL || 'http://localhost:3000';
|
||||
const backendUrl = process.env.BACKEND_URL || 'http://localhost:3001';
|
||||
|
||||
res.render('admin/blog/index', {
|
||||
layout: 'layouts/main',
|
||||
@@ -78,6 +79,8 @@ exports.index = async (req, res) => {
|
||||
blogs,
|
||||
categories,
|
||||
frontendUrl,
|
||||
backendUrl,
|
||||
getFullImageUrl, // Truyền helper function vào template
|
||||
pagination: {
|
||||
current: page,
|
||||
total: totalPages,
|
||||
@@ -102,6 +105,7 @@ exports.create = async (req, res) => {
|
||||
const tags = await BlogTag.getActive();
|
||||
|
||||
const frontendUrl = process.env.FRONTEND_URL || 'http://localhost:3000';
|
||||
const backendUrl = process.env.BACKEND_URL || 'http://localhost:3001';
|
||||
|
||||
res.render('admin/blog/create', {
|
||||
layout: 'layouts/main',
|
||||
@@ -110,7 +114,9 @@ exports.create = async (req, res) => {
|
||||
tags,
|
||||
currentPath: req.path,
|
||||
user: req.session.user,
|
||||
frontendUrl
|
||||
frontendUrl,
|
||||
backendUrl,
|
||||
getFullImageUrl // Truyền helper function vào template
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Blog create form error:', err);
|
||||
@@ -214,6 +220,7 @@ exports.edit = async (req, res) => {
|
||||
});
|
||||
|
||||
const frontendUrl = process.env.FRONTEND_URL || 'http://localhost:3000';
|
||||
const backendUrl = process.env.BACKEND_URL || 'http://localhost:3001';
|
||||
|
||||
res.render('admin/blog/edit', {
|
||||
layout: 'layouts/main',
|
||||
@@ -225,7 +232,9 @@ exports.edit = async (req, res) => {
|
||||
commentsCount: allComments.length,
|
||||
currentPath: req.path,
|
||||
user: req.session.user,
|
||||
frontendUrl
|
||||
frontendUrl,
|
||||
backendUrl,
|
||||
getFullImageUrl // Truyền helper function vào template
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Blog edit form error:', err);
|
||||
|
||||
Reference in New Issue
Block a user