Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Settings(BaseSettings):

# Session management
session_secret: str = "development-session-secret-placeholder"
static_asset_version: str = "2024051901"

@field_validator("session_secret")
@classmethod
Expand Down
11 changes: 11 additions & 0 deletions src/app/web/templates/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
"""Template utilities for Jinja2 rendering."""

from pathlib import Path

from fastapi.templating import Jinja2Templates

from app.core.config import get_settings

TEMPLATES_DIR = Path(__file__).parent

template_engine = Jinja2Templates(directory=str(TEMPLATES_DIR))

settings = get_settings()

template_engine.env.globals.update(
app_name=settings.app_name,
static_asset_version=settings.static_asset_version,
static_asset_query=f"v={settings.static_asset_version}",
)
2 changes: 1 addition & 1 deletion src/app/web/templates/auth.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/auth.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/auth.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down
4 changes: 2 additions & 2 deletions src/app/web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
rel="stylesheet"
/>
<link rel="stylesheet" href="https://unpkg.com/modern-css-reset/dist/reset.min.css" />
<link rel="stylesheet" href="{{ url_for('static', path='css/base.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/base.css') }}?{{ static_asset_query }}" />
{% block head_extra %}{% endblock %}
<script src="https://unpkg.com/htmx.org@1.9.10" integrity="sha384-9gCsk+S4iigFsMghvYDn8ApX2HFqRSbuuSSMzdg3NofM8JrIoYNewc19hXtF87dj" crossorigin="anonymous"></script>
</head>
Expand All @@ -24,7 +24,7 @@
</main>
{% include 'partials/footer.html' %}
</div>
<script src="{{ url_for('static', path='js/session.js') }}" defer></script>
<script src="{{ url_for('static', path='js/session.js') }}?{{ static_asset_query }}" defer></script>
{% block body_scripts %}{% endblock %}
</body>
</html>
2 changes: 1 addition & 1 deletion src/app/web/templates/pages/brand/detail.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/brand.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/brand.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion src/app/web/templates/pages/brand/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/brand.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/brand.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down
4 changes: 2 additions & 2 deletions src/app/web/templates/pages/dashboard/brand_owner.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/dashboard.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/dashboard.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down Expand Up @@ -508,5 +508,5 @@ <h3>Log Aktivitas Tim</h3>

{% block body_scripts %}
{{ super() }}
<script src="{{ url_for('static', path='js/dashboard-brand-owner.js') }}" defer></script>
<script src="{{ url_for('static', path='js/dashboard-brand-owner.js') }}?{{ static_asset_query }}" defer></script>
{% endblock %}
2 changes: 1 addition & 1 deletion src/app/web/templates/pages/dashboard/moderation.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/moderation-dashboard.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/moderation-dashboard.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion src/app/web/templates/pages/nusantarum/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/nusantarum.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/nusantarum.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion src/app/web/templates/pages/profile/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block head_extra %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', path='css/profile.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/profile.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block body_scripts %}
Expand Down
2 changes: 1 addition & 1 deletion src/app/web/templates/purchase_workflow.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/purchase-workflow.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/purchase-workflow.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion src/app/web/templates/ui_ux_tracker.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}

{% block head_extra %}
<link rel="stylesheet" href="{{ url_for('static', path='css/ui-ux-tracker.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='css/ui-ux-tracker.css') }}?{{ static_asset_query }}" />
{% endblock %}

{% block content %}
Expand Down