From: Michael Tremer Date: Sat, 24 Jan 2026 15:39:58 +0000 (+0000) Subject: dbl: Create a module for the box to encourage reports X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=243304aea35843a3bcd65d1dec7ea8cdee644022;p=ipfire.org.git dbl: Create a module for the box to encourage reports Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 88a42447..0760ef60 100644 --- a/Makefile.am +++ b/Makefile.am @@ -207,7 +207,8 @@ templates_dbl_lists_DATA = \ templates_dbl_listsdir = $(templates_dbldir)/lists templates_dbl_modules_DATA = \ - src/templates/dbl/modules/lists.html + src/templates/dbl/modules/lists.html \ + src/templates/dbl/modules/submit-report.html templates_dbl_modulesdir = $(templates_dbldir)/modules diff --git a/src/templates/dbl/lists/domain.html b/src/templates/dbl/lists/domain.html index eb271343..6bff7c8d 100644 --- a/src/templates/dbl/lists/domain.html +++ b/src/templates/dbl/lists/domain.html @@ -91,39 +91,17 @@
-
- {% set blocked = False %} - - {# Is this domain blocked? #} - {% for event in events %} - {% if event.blocks %} - {% set blocked = True %} - {% end %} - {% break %} - {% end %} - -
-
- {% if blocked %} - - {{ _("Do you think this domain should not be blocked?") }} - - {% else %} - - {{ _("Do you think this domain should be blocked?") }} - - {% end %} + {% set blocked = False %} - {{ _("Send a report and help us to improve IPFire DBL.") }} -
+ {# Is this domain blocked? #} + {% for event in events %} + {% if event.blocks %} + {% set blocked = True %} + {% end %} + {% break %} + {% end %} - -
-
+ {% module DBLSubmitReport(name, list=list, blocked=blocked) %}
diff --git a/src/templates/dbl/modules/submit-report.html b/src/templates/dbl/modules/submit-report.html new file mode 100644 index 00000000..0bffdc1d --- /dev/null +++ b/src/templates/dbl/modules/submit-report.html @@ -0,0 +1,25 @@ +{% import urllib.parse %} + +
+
+
+ {% if blocked %} + + {{ _("Do you think this domain should not be blocked?") }} + + {% else %} + + {{ _("Do you think this domain should be blocked?") }} + + {% end %} + + {{ _("Send a report and help us to improve IPFire DBL.") }} +
+ + +
+
diff --git a/src/web/__init__.py b/src/web/__init__.py index d41bb98a..d856235a 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -86,6 +86,7 @@ class Application(tornado.web.Application): # DBL "DBLLists" : dbl.ListsModule, + "DBLSubmitReport" : dbl.SubmitReportModule, # Docs "DocsDiff" : docs.DiffModule, diff --git a/src/web/dbl.py b/src/web/dbl.py index 15ee0cac..7c897254 100644 --- a/src/web/dbl.py +++ b/src/web/dbl.py @@ -165,3 +165,19 @@ class SearchHandler(base.AnalyticsMixin, BaseHandler): class ListsModule(ui_modules.UIModule): def render(self, lists): return self.render_string("dbl/modules/lists.html", lists=lists) + + +class SubmitReportModule(ui_modules.UIModule): + def render(self, name, blocked=False, list=None): + args = { + "name" : name, + "block" : not blocked, + } + + if list: + args |= { + "list" : list.slug, + } + + return self.render_string("dbl/modules/submit-report.html", + name=name, blocked=blocked, args=args)