fix: References section link corruption and download filename issues
**Issue 1: URL corruption in "See this CV in..." links**
- Bug: replaceYearPlaceholder used fmt.Sprintf on ALL URLs
- URLs like "/?lang=es" were corrupted to "/?lang=es%!(EXTRA string=2025)"
- Fix: Changed to strings.ReplaceAll("{{YEAR}}", year)
- Result: Only replaces actual {{YEAR}} placeholders, leaves other URLs intact
**Issue 2: Download filename not respected**
- Bug: Shortcut URLs (cv-jamr-2025-en.pdf) redirected with HTTP 301
- Browsers used original URL filename instead of Content-Disposition header
- Fix: Generate PDF directly in DefaultCVShortcut handler
- Result: Returns PDF with correct filename in Content-Disposition header
Files changed:
- internal/models/cv.go: Fixed replaceYearPlaceholder function
- internal/handlers/cv.go: Changed redirect to direct PDF generation
Both fixes verified:
- "See this CV in Spanish" link: href="/?lang=es" ✓
- Download link: filename=cv-jamr-2025-en.pdf ✓
This commit is contained in:
@@ -0,0 +1,255 @@
|
||||
/* =============================================================================
|
||||
TOAST NOTIFICATIONS - Error, Success, Info Messages
|
||||
============================================================================= */
|
||||
|
||||
/* Toast Container - Positioned bottom-right */
|
||||
.error-toast,
|
||||
.success-toast,
|
||||
.toast {
|
||||
position: fixed;
|
||||
bottom: 2rem;
|
||||
right: 2rem;
|
||||
min-width: 320px;
|
||||
max-width: 420px;
|
||||
padding: 1rem 1.25rem;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
|
||||
display: none;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
z-index: 10000;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.5;
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
animation: toastSlideIn 0.3s ease;
|
||||
}
|
||||
|
||||
/* Toast Visibility */
|
||||
.error-toast.show,
|
||||
.success-toast.show,
|
||||
.toast.show {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* Auto-hide animation lifecycle */
|
||||
.error-toast.show,
|
||||
.success-toast.show,
|
||||
.toast.show {
|
||||
animation: toastLifecycle 5s ease forwards;
|
||||
}
|
||||
|
||||
/* Toast Variants */
|
||||
.error-toast {
|
||||
background: linear-gradient(135deg, rgba(220, 53, 69, 0.95) 0%, rgba(200, 35, 51, 0.95) 100%);
|
||||
color: white;
|
||||
border-left: 4px solid #fff;
|
||||
}
|
||||
|
||||
.success-toast {
|
||||
background: linear-gradient(135deg, rgba(40, 167, 69, 0.95) 0%, rgba(25, 135, 84, 0.95) 100%);
|
||||
color: white;
|
||||
border-left: 4px solid #fff;
|
||||
}
|
||||
|
||||
.info-toast {
|
||||
background: linear-gradient(135deg, rgba(13, 110, 253, 0.95) 0%, rgba(10, 88, 202, 0.95) 100%);
|
||||
color: white;
|
||||
border-left: 4px solid #fff;
|
||||
}
|
||||
|
||||
.warning-toast {
|
||||
background: linear-gradient(135deg, rgba(255, 193, 7, 0.95) 0%, rgba(255, 167, 38, 0.95) 100%);
|
||||
color: #333;
|
||||
border-left: 4px solid #333;
|
||||
}
|
||||
|
||||
/* Toast Icon */
|
||||
.toast-icon,
|
||||
.error-icon,
|
||||
.success-icon,
|
||||
.info-icon {
|
||||
font-size: 1.5rem;
|
||||
flex-shrink: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* Toast Content */
|
||||
.toast-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.toast-title {
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.toast-message {
|
||||
font-size: 0.875rem;
|
||||
opacity: 0.95;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Close Button */
|
||||
.error-close,
|
||||
.toast-close {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: none;
|
||||
color: inherit;
|
||||
font-size: 1.5rem;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s ease;
|
||||
line-height: 1;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.error-close:hover,
|
||||
.toast-close:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
/* Progress Bar (for long operations like PDF generation) */
|
||||
.toast-progress {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 3px;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-radius: 0 0 12px 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toast-progress-bar {
|
||||
height: 100%;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
border-radius: 0 0 12px 12px;
|
||||
animation: progressShrink 5s linear forwards;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes toastSlideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(100%) translateY(0);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0) translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes toastSlideOut {
|
||||
from {
|
||||
opacity: 1;
|
||||
transform: translateX(0) translateY(0);
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
transform: translateX(100%) translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes toastLifecycle {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform: translateX(0) translateY(0);
|
||||
}
|
||||
85% {
|
||||
opacity: 1;
|
||||
transform: translateX(0) translateY(0);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translateX(100%) translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes progressShrink {
|
||||
from {
|
||||
width: 100%;
|
||||
}
|
||||
to {
|
||||
width: 0%;
|
||||
}
|
||||
}
|
||||
|
||||
/* =============================================================================
|
||||
RESPONSIVE DESIGN - TOASTS
|
||||
============================================================================= */
|
||||
|
||||
/* Mobile: Full width at bottom */
|
||||
@media (max-width: 540px) {
|
||||
.error-toast,
|
||||
.success-toast,
|
||||
.toast {
|
||||
bottom: 1rem;
|
||||
right: 1rem;
|
||||
left: 1rem;
|
||||
min-width: unset;
|
||||
max-width: unset;
|
||||
padding: 0.875rem 1rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.toast-icon,
|
||||
.error-icon,
|
||||
.success-icon {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.toast-title {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.toast-message {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* =============================================================================
|
||||
ACCESSIBILITY - REDUCED MOTION
|
||||
============================================================================= */
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.error-toast,
|
||||
.success-toast,
|
||||
.toast {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.error-toast.show,
|
||||
.success-toast.show,
|
||||
.toast.show {
|
||||
animation: none;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.toast-progress-bar {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* =============================================================================
|
||||
PRINT - HIDE TOASTS
|
||||
============================================================================= */
|
||||
|
||||
@media print {
|
||||
.error-toast,
|
||||
.success-toast,
|
||||
.toast {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user