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
+++ /dev/null
-{% 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 %}
</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">
--- /dev/null
+{% 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 %}
# DBL
"DBLLists" : dbl.ListsModule,
+ "DBLReports" : dbl.ReportsModule,
"DBLSources" : dbl.SourcesModule,
"DBLSubmitReport" : dbl.SubmitReportModule,
(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),
# 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):
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
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)