]> git.ipfire.org Git - ipfire.org.git/commitdiff
dbl: Move reports to the list page
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 8 Feb 2026 16:35:43 +0000 (16:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 8 Feb 2026 16:35:43 +0000 (16:35 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/dbl/lists/reports.html [deleted file]
src/templates/dbl/lists/show.html
src/templates/dbl/modules/reports.html [new file with mode: 0644]
src/web/__init__.py
src/web/dbl.py

index b4954ae19554508b16e8e89fcd1b2f54402e06db..60273ecfe8b7b17ae2bbdeff790ace7b47d2406b 100644 (file)
@@ -201,13 +201,13 @@ templates_dbldir = $(templatesdir)/dbl
 templates_dbl_lists_DATA = \
        src/templates/dbl/lists/domain.html \
        src/templates/dbl/lists/history.html \
-       src/templates/dbl/lists/reports.html \
        src/templates/dbl/lists/show.html
 
 templates_dbl_listsdir = $(templates_dbldir)/lists
 
 templates_dbl_modules_DATA = \
        src/templates/dbl/modules/lists.html \
+       src/templates/dbl/modules/reports.html \
        src/templates/dbl/modules/sources.html \
        src/templates/dbl/modules/submit-report.html
 
diff --git a/src/templates/dbl/lists/reports.html b/src/templates/dbl/lists/reports.html
deleted file mode 100644 (file)
index 457498d..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-{% extends "../../base.html" %}
-
-{% block head %}
-       {% module OpenGraph(
-               title=_("IPFire DBL - %s - Reports") % list,
-               description=list.description,
-       ) %}
-{% end block %}
-
-{% block title %}{{ _("IPFire DBL") }} - {{ list }} - {{ _("Reports") }}{% end block %}
-
-{% block container %}
-       <section class="hero is-dark">
-               <div class="hero-body">
-                       <div class="container">
-                               <nav class="breadcrumb" aria-label="breadcrumbs">
-                                       <ul>
-                                               <li>
-                                                       <a href="/dbl">
-                                                               {{ _("IPFire DBL") }}
-                                                       </a>
-                                               </li>
-
-                                               <li>
-                                                       <a href="/dbl/lists">
-                                                               {{ _("Lists") }}
-                                                       </a>
-                                               </li>
-
-                                               <li>
-                                                       <a href="/dbl/lists/{{ list.slug }}">
-                                                               {{ list }}
-                                                       </a>
-                                               </li>
-
-                                               <li class="is-active">
-                                                       <a href="#" aria-current="page">{{ _("Reports") }}</a>
-                                               </li>
-                                       </ul>
-                               </nav>
-
-                               <h1 class="title">
-                                       {{ _("Reports: %s") % list }}
-                               </h1>
-                       </div>
-               </div>
-       </section>
-
-       <section class="section">
-               <div class="container">
-                       <h5 class="title is-5">
-                               {{ _("Pending Reports") }}
-                       </h5>
-
-                       {# Show any pending reports #}
-                       {% if reports %}
-                               {% for report in reports %}
-                                       <div class="block">
-                                               <div class="card">
-                                                       <div class="card-content">
-                                                               <div class="columns">
-                                                                       <div class="column">
-                                                                               <p class="title is-5">
-                                                                                       <a href="/dbl/reports/{{ report.id }}">
-                                                                                               {{ report }}
-                                                                                       </a>
-                                                                               </p>
-
-                                                                               <p class="subtitle is-6">
-                                                                                       {{ _("Submitted %(when)s by %(who)s") % {
-                                                                                               "when" : locale.format_date(report.reported_at),
-                                                                                               "who"  : report.reported_by,
-                                                                                       } }}
-                                                                               </p>
-                                                                       </div>
-
-                                                                       {# Comment #}
-                                                                       {% if report.comment %}
-                                                                               <div class="column">
-                                                                                       <pre>{{ report.comment }}</pre>
-                                                                               </div>
-                                                                       {% end %}
-                                                               </div>
-                                                       </div>
-                                               </div>
-                                       </div>
-                               {% end %}
-
-                       {# Show a note if we don't have any pending reports #}
-                       {% else %}
-                               <div class="notification has-text-centered">
-                                       {{ _("There are currently no pending reports for this list") }}
-                               </div>
-                       {% end %}
-               </div>
-       </section>
-
-       <section class="section">
-               <div class="container">
-                       <h5 class="title is-5">
-                               {{ _("See Something? Say Something") }}
-                       </h5>
-
-                       <div class="content">
-                               Spot something that should be listed? Send it our way.
-                       </div>
-
-                       <a class="button is-primary" href="/dbl/report">
-                               {{ _("Submit a Report") }}
-                       </a>
-               </div>
-       </section>
-{% end block %}
index 4d0151c96a5ad88fca75b19d094036b2832c7f51..a6d5cfcd36b76c85e1862b222a539c9c88e5bdf0 100644 (file)
                </div>
        </section>
 
-       {# Information #}
        <section class="section">
                <div class="container">
-                       {# Navigation #}
                        <div class="buttons are-small is-centered">
-                               <a class="button" href="/dbl/lists/{{ list.slug }}/reports">
-                                       <span class="icon is-small">
-                                               <i class="fa-solid fa-flag" aria-hidden="true"></i>
-                                       </span>
-
-                                       <span>
-                                               {{ _("Reports") }}
-
-                                               {% if list.pending_reports %}
-                                                       ({{ list.pending_reports }})
-                                               {% end %}
-                                       </span>
-                               </a>
-
                                <a class="button" href="/dbl/lists/{{ list.slug }}/history">
                                        <span class="icon is-small">
                                                <i class="fas fa-list-check" aria-hidden="true"></i>
                </div>
        </section>
 
+       {# Reports #}
+       {% if reports %}
+               <section class="section" id="reports">
+                       <div class="container">
+                               <h4 class="title is-4">
+                                       {{ _("Open Reports") }}
+                               </h4>
+
+                               {% module DBLReports(reports) %}
+                       </div>
+               </section>
+       {% end %}
+
        {# Sources #}
        {% if sources %}
                <section class="section" id="sources">
diff --git a/src/templates/dbl/modules/reports.html b/src/templates/dbl/modules/reports.html
new file mode 100644 (file)
index 0000000..f1d9603
--- /dev/null
@@ -0,0 +1,31 @@
+{% for report in reports %}
+       <div class="block">
+               <div class="card">
+                       <div class="card-content">
+                               <div class="columns">
+                                       <div class="column">
+                                               <p class="title is-5">
+                                                       <a href="/dbl/reports/{{ report.id }}">
+                                                               {{ report }}
+                                                       </a>
+                                               </p>
+
+                                               <p class="subtitle is-6">
+                                                       {{ _("Submitted %(when)s by %(who)s") % {
+                                                               "when" : locale.format_date(report.reported_at),
+                                                               "who"  : report.reported_by,
+                                                       } }}
+                                               </p>
+                                       </div>
+
+                                       {# Comment #}
+                                       {% if report.comment %}
+                                               <div class="column">
+                                                       <pre>{{ report.comment }}</pre>
+                                               </div>
+                                       {% end %}
+                               </div>
+                       </div>
+               </div>
+       </div>
+{% end %}
index 064b12a65f7d1871488e7124cac2a6e4852882e2..45e13f0bc48ae93a9c8b7777ec62d84853e8bf26 100644 (file)
@@ -86,6 +86,7 @@ class Application(tornado.web.Application):
 
                                # DBL
                                "DBLLists"             : dbl.ListsModule,
+                               "DBLReports"           : dbl.ReportsModule,
                                "DBLSources"           : dbl.SourcesModule,
                                "DBLSubmitReport"      : dbl.SubmitReportModule,
 
@@ -224,7 +225,6 @@ class Application(tornado.web.Application):
                        (r"/dbl/lists/([\w\-]+)", dbl.ListHandler),
                        (r"/dbl/lists/([\w\-]+)/domains/(.*)", dbl.ListDomainHandler),
                        (r"/dbl/lists/([\w\-]+)/history", dbl.ListHistoryHandler),
-                       (r"/dbl/lists/([\w\-]+)/reports", dbl.ListReportsHandler),
                        (r"/dbl/report", dbl.SubmitReportHandler),
                        (r"/dbl/reports/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})", dbl.ReportHandler),
                        (r"/dbl/search", dbl.SearchHandler),
index 122f152212d83c9f12ecc52c9c4bd4b9cb0fae70..1e2c7583b057092f6da294a9ea54fc83ff6daa55 100644 (file)
@@ -45,8 +45,11 @@ class ListHandler(base.AnalyticsMixin, BaseHandler):
                # Fetch the sources
                sources = await list.get_sources()
 
+               # Fetch any open reports
+               reports = await list.get_reports(open=True)
+
                # Render the page
-               self.render("dbl/lists/show.html", list=list, sources=sources)
+               self.render("dbl/lists/show.html", list=list, sources=sources, reports=reports)
 
 
 class ListHistoryHandler(base.AnalyticsMixin, BaseHandler):
@@ -66,20 +69,6 @@ class ListHistoryHandler(base.AnalyticsMixin, BaseHandler):
                self.render("dbl/lists/history.html", list=list, history=history)
 
 
-class ListReportsHandler(base.AnalyticsMixin, BaseHandler):
-       async def get(self, slug):
-               # Fetch the list
-               list = await self.backend.dbl.get_list(slug)
-               if not list:
-                       raise tornado.web.HTTPError(404, "Could not find list '%s'" % slug)
-
-               # Fetch any open reports
-               reports = await list.get_reports(open=True)
-
-               # Render the page
-               self.render("dbl/lists/reports.html", list=list, reports=reports)
-
-
 class ListDomainHandler(base.AnalyticsMixin, BaseHandler):
        async def get(self, slug, name):
                # Fetch the list
@@ -198,6 +187,11 @@ class ListsModule(ui_modules.UIModule):
                return self.render_string("dbl/modules/lists.html", lists=lists)
 
 
+class ReportsModule(ui_modules.UIModule):
+       def render(self, reports):
+               return self.render_string("dbl/modules/reports.html", reports=reports)
+
+
 class SourcesModule(ui_modules.UIModule):
        def render(self, sources):
                return self.render_string("dbl/modules/sources.html", sources=sources)