refactor: remove camp location functionality

This commit is contained in:
Wini_Fy
2026-02-05 10:52:27 +07:00
parent 00f93cefab
commit 7dd52d8669
15 changed files with 291 additions and 1070 deletions

View File

@@ -540,10 +540,25 @@
// Lưu đúng relative path vào input (ví dụ: /uploads/blog/xxx.png)
input.value = result.path;
// Show preview sử dụng đúng data gốc (không gắn thêm URL)
// Helper function để tạo full URL
const backendUrl = '<%= typeof backendUrl !== "undefined" ? backendUrl : "http://localhost:3001" %>';
const getFullImageUrl = function(imagePath, baseUrl) {
if (!imagePath) return "";
if (imagePath.startsWith("http://") || imagePath.startsWith("https://")) {
return imagePath;
}
const base = (baseUrl || "http://localhost:3001").replace(/\/$/, "");
let imgSrc = imagePath;
if (!imgSrc.startsWith("/")) {
imgSrc = "/" + imgSrc;
}
return base + imgSrc;
};
// Show preview sử dụng helper function
if (targetInput === 'featuredImageUrl') {
const preview = document.getElementById('featuredImagePreview');
const previewUrl = result.path || '';
const previewUrl = getFullImageUrl(result.path, backendUrl);
preview.innerHTML = `
<img src="${previewUrl}" class="img-thumbnail"
style="max-width: 300px; max-height: 200px; object-fit: cover;"
@@ -553,7 +568,7 @@
const index = targetInput.split('_')[1];
const preview = document.getElementById(`galleryPreview_${index}`);
if (preview) {
const previewUrl = result.path || '';
const previewUrl = getFullImageUrl(result.path, backendUrl);
preview.innerHTML = `
<img src="${previewUrl}" class="img-thumbnail"
style="max-width: 200px; max-height: 150px; object-fit: cover;"

View File

@@ -72,7 +72,7 @@
</div>
<div id="featuredImagePreview" class="mt-2">
<% if (blog.featuredImage) { %>
<img src="<%= blog.featuredImage %>"
<img src="<%= getFullImageUrl(blog.featuredImage, backendUrl) %>"
class="img-thumbnail"
style="max-width: 300px; max-height: 200px; object-fit: cover;"
alt="Featured image preview">
@@ -134,7 +134,7 @@
</div>
<div id="galleryPreview_0" class="mt-2">
<% if (image1) { %>
<img src="<%= image1 %>"
<img src="<%= getFullImageUrl(image1, backendUrl) %>"
class="img-thumbnail"
style="max-width: 200px; max-height: 150px; object-fit: cover;"
alt="Gallery image 1 preview">
@@ -157,7 +157,7 @@
</div>
<div id="galleryPreview_1" class="mt-2">
<% if (image2) { %>
<img src="<%= image2 %>"
<img src="<%= getFullImageUrl(image2, backendUrl) %>"
class="img-thumbnail"
style="max-width: 200px; max-height: 150px; object-fit: cover;"
alt="Gallery image 2 preview">
@@ -958,11 +958,23 @@
input.value = result.path;
// Show preview
const backendUrl = '<%= typeof backendUrl !== "undefined" ? backendUrl : "http://localhost:3001" %>';
const getFullImageUrl = function(imagePath, baseUrl) {
if (!imagePath) return "";
if (imagePath.startsWith("http://") || imagePath.startsWith("https://")) {
return imagePath;
}
const base = (baseUrl || "http://localhost:3001").replace(/\/$/, "");
let imgSrc = imagePath;
if (!imgSrc.startsWith("/")) {
imgSrc = "/" + imgSrc;
}
return base + imgSrc;
};
if (targetInput === 'featuredImageUrl') {
const preview = document.getElementById('featuredImagePreview');
const previewUrl = (result.path && (result.path.startsWith('http://') || result.path.startsWith('https://')))
? result.path
: (window.location.origin + result.path);
const previewUrl = getFullImageUrl(result.path, backendUrl);
preview.innerHTML = `
<img src="${previewUrl}" class="img-thumbnail"
style="max-width: 300px; max-height: 200px; object-fit: cover;"
@@ -972,9 +984,7 @@
const index = targetInput.split('_')[1];
const preview = document.getElementById(`galleryPreview_${index}`);
if (preview) {
const previewUrl = (result.path && (result.path.startsWith('http://') || result.path.startsWith('https://')))
? result.path
: (window.location.origin + result.path);
const previewUrl = getFullImageUrl(result.path, backendUrl);
preview.innerHTML = `
<img src="${previewUrl}" class="img-thumbnail"
style="max-width: 200px; max-height: 150px; object-fit: cover;"

View File

@@ -84,7 +84,7 @@
<tr>
<td>
<% if (blog.featuredImage) { %>
<img src="<%= blog.featuredImage %>"
<img src="<%= getFullImageUrl(blog.featuredImage, backendUrl) %>"
alt="<%= blog.title %>" class="img-thumbnail"
style="width: 50px; height: 50px; object-fit: cover;">
<% } else { %>

View File

@@ -690,7 +690,7 @@
<div>
<div class="text-muted small">Version</div>
<div class="fw-bold" style="color: var(--primary-color)">
CMS-SIMS v1.0.0
CMS.HAILearning v1.0.0
</div>
</div>
</div>

View File

@@ -1219,7 +1219,7 @@
class="form-control"
id="faqContactInfo"
value="<%= data.faq?.contact?.info || '' %>"
placeholder="e.g., +(123) 456-789 | office@ggcamp.org"
placeholder="e.g., +(123) 456-789 | info@hailearning.edu.vn"
/>
</div>
</div>