summaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/templates/rules
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-09-29 10:43:45 +0200
committerWojtek Kosior <koszko@koszko.org>2022-09-29 12:53:40 +0200
commitb0fcc865599cfdc87e2ca8a637df8f5b336bb459 (patch)
tree6d5e98a4834d3cbacc05be2c8163d21faf0cebd6 /src/hydrilla/proxy/web_ui/templates/rules
parentffe6e681b281eef2c1e62bbc6feefb0b85d040ca (diff)
downloadhaketilo-hydrilla-b0fcc865599cfdc87e2ca8a637df8f5b336bb459.tar.gz
haketilo-hydrilla-b0fcc865599cfdc87e2ca8a637df8f5b336bb459.zip
[proxy] make uniform use of section labels in the web UI
Diffstat (limited to 'src/hydrilla/proxy/web_ui/templates/rules')
-rw-r--r--src/hydrilla/proxy/web_ui/templates/rules/add.html.jinja16
-rw-r--r--src/hydrilla/proxy/web_ui/templates/rules/show_single.html.jinja36
2 files changed, 22 insertions, 30 deletions
diff --git a/src/hydrilla/proxy/web_ui/templates/rules/add.html.jinja b/src/hydrilla/proxy/web_ui/templates/rules/add.html.jinja
index 3f7e2a7..430c5ca 100644
--- a/src/hydrilla/proxy/web_ui/templates/rules/add.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/rules/add.html.jinja
@@ -25,23 +25,15 @@ code in a proprietary work, I am not going to enforce this in court.
{% block main %}
<h3>{{ _('web_ui.rules.add.heading') }}</h3>
<form method="POST">
+ {{ label(_('web_ui.rules.add.pattern_field_label'), 'pattern') }}
+
{% if rule_pattern_invalid is defined %}
{{ error_note(_('web_ui.err.rule_pattern_invalid')) }}
{% endif %}
- <label for="pattern_field" class="block-with-bottom-margin">
- {{ _('web_ui.rules.add.pattern_field_label') }}
- </label>
-
- <div class="flex-row">
- <input id="pattern_field" name="pattern" required="">
- </div>
-
- <div class="horizontal-separator"></div>
+ {{ form_field('pattern') }}
- <label class="block-with-bottom-margin">
- {{ _('web_ui.rules.add.block_or_allow_label') }}
- </label>
+ {{ label(_('web_ui.rules.add.block_or_allow_label'), 'allow') }}
<div class="block-with-bottom-margin">
<input id="block_box" name="allow" type="radio" value="false" checked="">
diff --git a/src/hydrilla/proxy/web_ui/templates/rules/show_single.html.jinja b/src/hydrilla/proxy/web_ui/templates/rules/show_single.html.jinja
index 1fda236..9bf2c75 100644
--- a/src/hydrilla/proxy/web_ui/templates/rules/show_single.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/rules/show_single.html.jinja
@@ -28,6 +28,8 @@ code in a proprietary work, I am not going to enforce this in court.
{% include 'include/checkbox_tricks_style.css.jinja' %}
{% endblock %}
+{% import 'import/checkbox_tricks.html.jinja' as tricks %}
+
{% block main %}
<h3>
{% if display_info.allow_scripts %}
@@ -37,21 +39,15 @@ code in a proprietary work, I am not going to enforce this in court.
{% endif %}
</h3>
+ {{ label(_('web_ui.rules.single.pattern_label')) }}
+
<p>
- {{ _('web_ui.rules.single.pattern_is_{}').format(display_info.pattern) }}
+ {{ display_info.pattern }}
</p>
- {% if rule_pattern_invalid is defined %}
- {% set checked_attr = '' %}
- {% else %}
- {% set checked_attr = 'checked=""' %}
- {% endif %}
- <input id="hide_pattern_edit_form" type="checkbox"
- class="chbx-tricks-show-hide" {{ checked_attr }}>
- <label for="hide_pattern_edit_form"
- class="green-button block-with-bottom-margin">
- {{ _('web_ui.rules.single.update_pattern_button') }}
- </label>
+ {% set button_text = _('web_ui.rules.single.update_pattern_button') %}
+ {% set initial_show = rule_pattern_invalid is defined %}
+ {{ tricks.sibling_hider(button_text, 'edit_pattern', initial_show) }}
<form method="POST">
<input type="hidden" name="action" value="update_rule_data">
@@ -65,19 +61,21 @@ code in a proprietary work, I am not going to enforce this in court.
</div>
<div class="flex-row">
- <button class="green-button button-bordering-right">
+ <label for="{{ tricks.hider_id('edit_pattern') }}"
+ class="red-button button-bordering-right">
+ {{ _('web_ui.rules.single.no_update_pattern_button') }}
+ </label>
+ <div class="button-row-separator"></div>
+ <button class="green-button button-bordering-left">
{{ _('web_ui.rules.single.commit_update_pattern_button') }}
</button>
- <div class="button-row-separator"></div>
- <label for="hide_pattern_edit_form"
- class="green-button button-bordering-left">
- {{ _('web_ui.rules.single.abort_update_pattern_button') }}
- </label>
</div>
</form>
<div class="horizontal-separator"></div>
+ {{ label(_('web_ui.rules.single.block_or_allow_label')) }}
+
{% set allow_but_classes = ['red-button'] %}
{% set block_but_classes = ['blue-button'] %}
@@ -100,6 +98,8 @@ code in a proprietary work, I am not going to enforce this in court.
<div class="horizontal-separator"></div>
+ {{ label(_('web_ui.rules.single.actions_label')) }}
+
{% set button_text = _('web_ui.rules.single.remove_button') %}
{% set extra_fields = {'action': 'remove_rule'} %}
{{ button_row([(['green-button'], button_text, extra_fields)]) }}