næste side fix
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 43s

This commit is contained in:
2024-12-21 02:02:35 +01:00
parent a1c2233358
commit 9a3039b011
3 changed files with 18 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ from app.services.markdown_processor import MarkdownProcessor
from app.services.metadata_processor import MetadataProcessor from app.services.metadata_processor import MetadataProcessor
from app.controllers.dynamic_controller import DynamicController from app.controllers.dynamic_controller import DynamicController
from app.controllers.category_controller import CategoryController from app.controllers.category_controller import CategoryController
from fastapi.middleware.gzip import GZipMiddleware
class Application: class Application:
@@ -15,6 +16,7 @@ class Application:
self.app = FastAPI(lifespan=self._lifespan_event) self.app = FastAPI(lifespan=self._lifespan_event)
self._setup_static_files() self._setup_static_files()
self._include_routers() self._include_routers()
self._include_middelware()
@asynccontextmanager @asynccontextmanager
async def _lifespan_event(self, app: FastAPI): async def _lifespan_event(self, app: FastAPI):
@@ -49,6 +51,8 @@ class Application:
self.app.include_router(route_to_web.router) self.app.include_router(route_to_web.router)
def _include_middelware(self):
self.app.add_middleware( GZipMiddleware, minimum_size = 500 )
def get_app(self): def get_app(self):
"""Return the FastAPI app instance.""" """Return the FastAPI app instance."""

View File

@@ -6,7 +6,7 @@ def img_left_overlay(src):
"""Render an image with overlay.""" """Render an image with overlay."""
return f''' return f'''
<div class="img-left-overlay"> <div class="img-left-overlay">
<img src="{src}" alt="Overlay Image"> <img src="{src}" alt="Overlay Image" loading="lazy">
<div class="overlay-text">Overlay Text</div> <div class="overlay-text">Overlay Text</div>
</div> </div>
''' '''
@@ -59,13 +59,13 @@ def slider(options, images):
if int(len(images))<=int(i+1): if int(len(images))<=int(i+1):
modal_id_next = f"{modal_id}_0" modal_id_next = f"{modal_id}_0"
if i % 2 == 0: if i % 2 == 0:
html_content.append(f"""<button onclick="openModal('modal{modal_id}')" class="stacked-button"> <img src="{val}" alt="Lets do better" class="thumbnail"></button>""".strip()) html_content.append(f"""<button onclick="openModal('modal{modal_id}')" class="stacked-button"> <img src="{val}" alt="Lets do better" class="thumbnail" loading="lazy"></button>""".strip())
else: else:
html_content.append(f"""<button onclick="openModal('modal{modal_id}')" class="stacked-button"> <img src="{val}" alt="Lets do better" class="thumbnail" ></button>""".strip()) html_content.append(f"""<button onclick="openModal('modal{modal_id}')" class="stacked-button"> <img src="{val}" alt="Lets do better" class="thumbnail" loading="lazy"></button>""".strip())
html_content.append(f"""<div class="modal" id="modal{modal_id}"> html_content.append(f"""<div class="modal" id="modal{modal_id}">
<div class="modal-content"> <div class="modal-content">
<h2>Modal {i}</h2> <h2>Modal {i}</h2>
<img src="{val}" alt="Lets do better"> <img src="{val}" alt="Lets do better" loading="lazy">
<div class="modal-buttons"> <div class="modal-buttons">
<button onclick="closeModal('modal{modal_id}')">Close</button> <button onclick="closeModal('modal{modal_id}')">Close</button>
<button class="next-btn" onclick="nextModal('modal{modal_id}', 'modal{modal_id_next}')">Next</button> <button class="next-btn" onclick="nextModal('modal{modal_id}', 'modal{modal_id_next}')">Next</button>

View File

@@ -13,7 +13,10 @@
<meta name="keywords" content="{{ meta_keywords | default('Portugal, FAQ, Rejser, Henrik, Erika, Flytte til Portugal, Livskvalitet') }}"> <meta name="keywords" content="{{ meta_keywords | default('Portugal, FAQ, Rejser, Henrik, Erika, Flytte til Portugal, Livskvalitet') }}">
<!-- Forfatter --> <!-- Forfatter -->
<meta name="author" content="Henrik og Erika"> <meta name="author" content="Henrik og Erika">
<link rel="stylesheet" href="/static/css/main.css?v={{ timestamp }}"> <!-- Defer non-critical CSS -->
<link rel="stylesheet" href="/static/css/main.css?v={{ timestamp }}" media="print" onload="this.media='all';">
<noscript><link rel="stylesheet" href="/static/css/main.css?v={{ timestamp }}"></noscript>
</head> </head>
<body class="is-preload"> <body class="is-preload">
<!-- Wrapper --> <!-- Wrapper -->
@@ -59,12 +62,12 @@
</div> <!-- Closing wrapper div --> </div> <!-- Closing wrapper div -->
<!-- Scripts --> <!-- Scripts -->
<script src="/static/js/jquery.min.js"></script> <script src="/static/js/jquery.min.js" defer></script>
<script src="/static/js/browser.min.js"></script> <script src="/static/js/browser.min.js" defer></script>
<script src="/static/js/breakpoints.min.js"></script> <script src="/static/js/breakpoints.min.js" defer></script>
<script src="/static/js/util.js"></script> <script src="/static/js/util.js" defer></script>
<script src="/static/js/main.js"></script> <script src="/static/js/main.js" defer></script>
<script src="/static/js/modal_handler.js?v={{ timestamp }}"></script> <script src="/static/js/modal_handler.js?v={{ timestamp }}" defer></script>
</body> </body>
</html> </html>