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
<section class="section">
<div class="container">
- <div class="notification">
- {% set blocked = False %}
-
- {# Is this domain blocked? #}
- {% for event in events %}
- {% if event.blocks %}
- {% set blocked = True %}
- {% end %}
- {% break %}
- {% end %}
-
- <div class="columns is-vcentered">
- <div class="column">
- {% if blocked %}
- <strong>
- {{ _("Do you think this domain should not be blocked?") }}
- </strong>
- {% else %}
- <strong>
- {{ _("Do you think this domain should be blocked?") }}
- </strong>
- {% end %}
+ {% set blocked = False %}
- {{ _("Send a report and help us to improve IPFire DBL.") }}
- </div>
+ {# Is this domain blocked? #}
+ {% for event in events %}
+ {% if event.blocks %}
+ {% set blocked = True %}
+ {% end %}
+ {% break %}
+ {% end %}
- <div class="column is-narrow">
- <a class="button is-primary is-small" href="/dbl/report?list={{ list.slug }}&name={{ name }}">
- {{ _("Report %s") % name }}
- </a>
- </div>
- </div>
- </div>
+ {% module DBLSubmitReport(name, list=list, blocked=blocked) %}
</div>
</section>
--- /dev/null
+{% import urllib.parse %}
+
+<div class="notification">
+ <div class="columns is-vcentered">
+ <div class="column">
+ {% if blocked %}
+ <strong>
+ {{ _("Do you think this domain should not be blocked?") }}
+ </strong>
+ {% else %}
+ <strong>
+ {{ _("Do you think this domain should be blocked?") }}
+ </strong>
+ {% end %}
+
+ {{ _("Send a report and help us to improve IPFire DBL.") }}
+ </div>
+
+ <div class="column is-narrow">
+ <a class="button is-primary is-small" href="/dbl/report?{{ urllib.parse.urlencode(args) }}">
+ {{ _("Report %s") % name }}
+ </a>
+ </div>
+ </div>
+</div>
# DBL
"DBLLists" : dbl.ListsModule,
+ "DBLSubmitReport" : dbl.SubmitReportModule,
# Docs
"DocsDiff" : docs.DiffModule,
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)