aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/templates
diff options
context:
space:
mode:
authorDennis Fink2026-11-12 19:57:08 +0100
committerDennis Fink2026-11-12 19:57:08 +0100
commit4bd1d9e348918b2e55db47a1ac3489d035cf55e2 (patch)
treef7ed41a374a8a4136792039a262dc62aa8cf8c59 /webmentions_ssg/templates
parent7035e9f9467684cccae2b7ff3faaa62e6a9f91aa (diff)
downloadwebmentions-ssg-4bd1d9e348918b2e55db47a1ac3489d035cf55e2.tar.gz
webmentions-ssg-4bd1d9e348918b2e55db47a1ac3489d035cf55e2.zip
refactor(core): split modules by responsibility
Break up monolithic views, task helpers, networking, CLI, and application extension setup so each module owns a focused concern. Reorganize the test suite around the new boundaries while preserving existing Webmention behavior and coverage.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/templates/received.html51
-rw-r--r--webmentions_ssg/templates/sent_source.html42
2 files changed, 50 insertions, 43 deletions
diff --git a/webmentions_ssg/templates/received.html b/webmentions_ssg/templates/received.html
index 1ff3690..3dbb896 100644
--- a/webmentions_ssg/templates/received.html
+++ b/webmentions_ssg/templates/received.html
@@ -6,6 +6,33 @@ SPDX-License-Identifier: BSD-3-Clause
{% extends "base.html" %}
{% from "bootstrap5/pagination.html" import render_pagination %}
+{% set received_status_presentation = {
+ "received": {
+ "row_class": "table-info",
+ "badge_class": "text-bg-info",
+ "label": "Pending"
+ },
+ "verifying": {
+ "row_class": "table-warning",
+ "badge_class": "text-bg-warning",
+ "label": "Verifying"
+ },
+ "verified": {
+ "row_class": "table-success",
+ "badge_class": "text-bg-success",
+ "label": "Verified"
+ },
+ "failed": {
+ "row_class": "table-danger",
+ "badge_class": "text-bg-danger",
+ "label": "Declined"
+ },
+ "deleted": {
+ "row_class": "table-danger",
+ "badge_class": "text-bg-danger",
+ "label": "Declined"
+ }
+} %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3">
@@ -27,27 +54,9 @@ SPDX-License-Identifier: BSD-3-Clause
</thead>
<tbody>
{% for webmention in webmentions %}
- {% if webmention.status == "received" %}
- {% set row_class = "table-info" %}
- {% set badge_class = "text-bg-info" %}
- {% set display_status = "Pending" %}
- {% elif webmention.status == "verifying" %}
- {% set row_class = "table-warning" %}
- {% set badge_class = "text-bg-warning" %}
- {% set display_status = "Verifying" %}
- {% elif webmention.status == "verified" %}
- {% set row_class = "table-success" %}
- {% set badge_class = "text-bg-success" %}
- {% set display_status = "Verified" %}
- {% else %}
- {% set row_class = "table-danger" %}
- {% set badge_class = "text-bg-danger" %}
- {% set display_status = "Declined" %}
- {% endif %}
- <tr class="{{ row_class }}">
- <td>
- <span class="badge {{ badge_class }}">{{ display_status }}</span>
- </td>
+ {% set style = received_status_presentation.get(webmention.status, {"row_class": "table-danger", "badge_class": "text-bg-danger", "label": "Declined"}) %}
+ <tr class="{{ style.row_class }}">
+ <td><span class="badge {{ style.badge_class }}">{{ style.label }}</span></td>
<td class="text-break">
<a href="{{ webmention.source }}">{{ webmention.source }}</a>
</td>
diff --git a/webmentions_ssg/templates/sent_source.html b/webmentions_ssg/templates/sent_source.html
index 689c651..974c7b3 100644
--- a/webmentions_ssg/templates/sent_source.html
+++ b/webmentions_ssg/templates/sent_source.html
@@ -6,6 +6,23 @@ SPDX-License-Identifier: BSD-3-Clause
{% extends "base.html" %}
{% from "bootstrap5/pagination.html" import render_pagination %}
+{% set sent_status_presentation = {
+ "sent": {
+ "row_class": "table-success",
+ "badge_class": "text-bg-success",
+ "label": "Sent"
+ },
+ "unsupported": {
+ "row_class": "table-warning",
+ "badge_class": "text-bg-warning",
+ "label": "Unsupported"
+ },
+ "failed": {
+ "row_class": "table-danger",
+ "badge_class": "text-bg-danger",
+ "label": "Failed"
+ }
+} %}
{% block content %}
<div class="mb-3">
@@ -85,32 +102,13 @@ SPDX-License-Identifier: BSD-3-Clause
</thead>
<tbody>
{% for webmention in webmentions %}
- {% if webmention.status is none %}
- {% set row_class = "table-info" %}
- {% set badge_class = "text-bg-info" %}
- {% elif webmention.status.value == "sent" %}
- {% set row_class = "table-success" %}
- {% set badge_class = "text-bg-success" %}
- {% elif webmention.status.value == "unsupported" %}
- {% set row_class = "table-warning" %}
- {% set badge_class = "text-bg-warning" %}
- {% elif webmention.status.value == "failed" %}
- {% set row_class = "table-danger" %}
- {% set badge_class = "text-bg-danger" %}
- {% else %}
- {% set row_class = "table-info" %}
- {% set badge_class = "text-bg-info" %}
- {% endif %}
- <tr class="{{ row_class }}">
+ {% set style = sent_status_presentation.get(webmention.status, {"row_class": "table-info", "badge_class": "text-bg-info", "label": "Pending" }) %}
+ <tr class="{{ style.row_class }}">
<td class="text-break">
<a href="{{ webmention.target }}">{{ webmention.target }}</a>
</td>
<td>
- {% if webmention.status is none %}
- <span class="badge {{ badge_class }}">Pending</span>
- {% else %}
- <span class="badge {{ badge_class }}">{{ webmention.status.value.title() }}</span>
- {% endif %}
+ <span class="badge {{ style.badge_class }}">{{ style.label }}</span>
{% if webmention.failure_reason is not none %}
<div class="small mt-2">{{ webmention.failure_reason }}</div>
{% endif %}