This commit is contained in:
Tomas Dvorak
2025-05-28 11:39:23 +02:00
parent a7da5ef25b
commit 44c53f4f76
2 changed files with 28 additions and 20 deletions
+24 -16
View File
@@ -1303,16 +1303,15 @@ function updateBannerPreview() {
const imageX = currentImageX || '0'; const imageX = currentImageX || '0';
const imageY = currentImageY || '0'; const imageY = currentImageY || '0';
// Update banner container styles to match index.html // Update banner container styles to exactly match index.html
bannerPreview.style.display = 'block'; bannerPreview.style.display = 'block';
bannerPreview.style.width = '100%'; bannerPreview.style.width = '100%';
bannerPreview.style.transition = 'all 0.3s ease'; bannerPreview.style.transition = 'all 0.3s ease';
bannerPreview.style.margin = '0 auto'; bannerPreview.style.margin = '0 auto';
bannerPreview.style.maxWidth = '100%'; bannerPreview.style.maxWidth = '1200px';
bannerPreview.style.padding = '0'; bannerPreview.style.padding = '0 1rem';
bannerPreview.style.borderRadius = `${bannerBorderRadius}px`;
// Update banner content styles to match index.html // Update banner content styles to exactly match index.html
Object.assign(bannerPreviewContent.style, { Object.assign(bannerPreviewContent.style, {
backgroundColor: bannerBgColor, backgroundColor: bannerBgColor,
color: bannerTextColor, color: bannerTextColor,
@@ -1322,9 +1321,7 @@ function updateBannerPreview() {
margin: `${bannerMargin}px 0`, margin: `${bannerMargin}px 0`,
borderRadius: `${bannerBorderRadius}px`, borderRadius: `${bannerBorderRadius}px`,
boxShadow: '0 2px 4px rgba(0,0,0,0.1)', boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
display: 'block', display: 'block'
position: 'relative',
zIndex: '2'
}); });
// Handle content and image like in index.html // Handle content and image like in index.html
@@ -1344,8 +1341,11 @@ function updateBannerPreview() {
}); });
} }
// Determine image style based on position // Apply the same border radius to the image as to the container
let imageStyle = ''; const imageRadius = Math.max(bannerBorderRadius, 0);
// Determine image style based on position - exactly match index.html
let imageStyle = `max-width: 100%; max-height: 200px; border-radius: ${imageRadius}px;`;
let containerStyle = 'margin-bottom: 15px;'; let containerStyle = 'margin-bottom: 15px;';
switch(imagePosition) { switch(imagePosition) {
@@ -1356,18 +1356,20 @@ function updateBannerPreview() {
containerStyle += 'text-align: right; float: right; margin-left: 15px;'; containerStyle += 'text-align: right; float: right; margin-left: 15px;';
break; break;
case 'custom': case 'custom':
containerStyle += `position: relative;`; containerStyle += 'position: relative;';
imageStyle = `position: relative; left: ${imageX}px; top: ${imageY}px;`; // For custom position, use absolute positioning to ensure exact placement
imageStyle += `position: absolute; left: ${imageX}px; top: ${imageY}px;`;
break; break;
default: // center default: // center
containerStyle += `text-align: ${bannerTextAlign};`; containerStyle += 'text-align: center; display: block;';
break;
} }
// Format content with image like in index.html // Format content with image exactly like in index.html
content = ` content = `
<div style="${containerStyle}" class="banner-image-container"> <div style="${containerStyle}" class="banner-image-container">
<img src="${currentImage}" <img src="${currentImage}"
style="max-width: 100%; max-height: 200px; border-radius: 4px; ${imageStyle}" style="${imageStyle}"
class="${imagePosition === 'custom' ? 'draggable-image' : ''}" class="${imagePosition === 'custom' ? 'draggable-image' : ''}"
data-position="${imagePosition}" data-position="${imagePosition}"
data-x="${imageX}" data-x="${imageX}"
@@ -1381,6 +1383,9 @@ function updateBannerPreview() {
imagePreview.src = currentImage; imagePreview.src = currentImage;
imagePreviewContainer.style.display = 'block'; imagePreviewContainer.style.display = 'block';
} }
// Add the with-image class to the banner preview for proper spacing
bannerPreview.classList.add('with-image');
} else { } else {
// Hide the image preview container if no image // Hide the image preview container if no image
if (imagePreviewContainer) { if (imagePreviewContainer) {
@@ -1391,9 +1396,12 @@ function updateBannerPreview() {
if (imagePositionControls) { if (imagePositionControls) {
imagePositionControls.style.display = 'none'; imagePositionControls.style.display = 'none';
} }
// Remove the with-image class from the banner preview
bannerPreview.classList.remove('with-image');
} }
// Wrap in link if provided // Wrap in link if provided - exactly match index.html
if (bannerLink) { if (bannerLink) {
content = `<a href="${bannerLink}" style="color: inherit; text-decoration: none; display: block;">${content}</a>`; content = `<a href="${bannerLink}" style="color: inherit; text-decoration: none; display: block;">${content}</a>`;
} }
+4 -4
View File
@@ -248,11 +248,11 @@ func handleSubmit(w http.ResponseWriter, r *http.Request) {
} }
func sendEmail(entry TripEntry, parsedDateStart, parsedDateEnd time.Time, czechMonths []string) error { func sendEmail(entry TripEntry, parsedDateStart, parsedDateEnd time.Time, czechMonths []string) error {
smtpHost := "smtp.gmail.com" smtpHost := "mail.pp-kunovice.cz"
smtpPort := 465 smtpPort := 465
sender := "contact.dvorak@gmail.com" sender := "sluzebnicek@pp-kunovice.cz"
password := "mbos uxwh dhlo ezrj" password := "7g}qznB5bj"
recipient := "contact.dvorak@gmail.com" recipient := "sluzebnicek@pp-kunovice.cz"
m := gomail.NewMessage() m := gomail.NewMessage()
m.SetHeader("From", sender) m.SetHeader("From", sender)