aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/templates/prompts
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-09-09 11:44:59 +0200
committerWojtek Kosior <koszko@koszko.org>2022-09-12 13:59:10 +0200
commit6036bad4c167633d41f01e030ec1ae919dbfab0a (patch)
tree02e164e6b7860dc69af1820fb1a53334aff1332f /src/hydrilla/proxy/web_ui/templates/prompts
parentd6e8e36e04fc36d42f9b985c47e2cd3b35907cc8 (diff)
downloadhaketilo-hydrilla-6036bad4c167633d41f01e030ec1ae919dbfab0a.tar.gz
haketilo-hydrilla-6036bad4c167633d41f01e030ec1ae919dbfab0a.zip
[proxy] allow prompting the user when a package suitable for current site is found; add proxy's options page
This commit also causes uncached responses to be forced on all HTTP request to external servers. This is needed to make sure that changes Haketilo makes to HTTP response headers are always picked up by the browser. The drawback is that this increases network traffic causing a performance hit. We might optimize this in the future.
Diffstat (limited to 'src/hydrilla/proxy/web_ui/templates/prompts')
-rw-r--r--src/hydrilla/proxy/web_ui/templates/prompts/auto_install_error.html.jinja37
-rw-r--r--src/hydrilla/proxy/web_ui/templates/prompts/package_suggestion.html.jinja58
2 files changed, 75 insertions, 20 deletions
diff --git a/src/hydrilla/proxy/web_ui/templates/prompts/auto_install_error.html.jinja b/src/hydrilla/proxy/web_ui/templates/prompts/auto_install_error.html.jinja
index 01f5c19..82a12e5 100644
--- a/src/hydrilla/proxy/web_ui/templates/prompts/auto_install_error.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/prompts/auto_install_error.html.jinja
@@ -24,19 +24,15 @@ in a proprietary work, I am not going to enforce this in court.
{{ _('web_ui.prompts.auto_install_error.title') }}
{% endblock %}
-{% macro button_form(action, button_class, button_text) %}
- <form class="flex-row" method="POST">
- <input name="next_url" value="{{ next_url }}" type="hidden">
- <input name="payload_id" value="{{ display_info.ref.id }}" type="hidden">
- {% set mapping_ver_id = display_info.mapping_info.ref.id %}
- <input name="mapping_ver_id" value="{{ mapping_ver_id }}" type="hidden">
-
- <input name="action" value="{{ action }}" type="hidden">
- <button class="{{ button_class }}">{{ button_text }}</button>
- </form>
-{% endmacro %}
-
{% block main %}
+ {% if file_installation_error is defined %}
+ {{ error_note(_('web_ui.err.retry_install.file_installation_error')) }}
+ {% endif %}
+
+ {% if repo_communication_error is defined %}
+ {{ error_note(_('web_ui.err.retry_install.repo_communication_error')) }}
+ {% endif %}
+
<h3>
{{ _('web_ui.prompts.auto_install_error.heading') }}
</h3>
@@ -48,13 +44,14 @@ in a proprietary work, I am not going to enforce this in court.
}}
</p>
- <div class="flex-row">
- {% set but_text = _('web_ui.prompts.auto_install_error.disable_button') %}
- {{ button_form('disable_mapping', 'red-button', but_text) }}
-
- <div class="button-row-separator"></div>
+ {% set disable_text = _('web_ui.prompts.auto_install_error.disable_button') %}
+ {% set retry_text = _('web_ui.prompts.auto_install_error.retry_button') %}
- {% set but_text = _('web_ui.prompts.auto_install_error.retry_button') %}
- {{ button_form('retry_install', 'green-button', but_text) }}
- </div>
+ {{
+ button_row([
+ (['red-button'], disable_text, {'action': 'disable_mapping'}),
+ (['green-button'], retry_text, {'action': 'retry_install'})
+ ], {'mapping_ver_id': display_info.mapping_info.ref.id}
+ )
+ }}
{% endblock %}
diff --git a/src/hydrilla/proxy/web_ui/templates/prompts/package_suggestion.html.jinja b/src/hydrilla/proxy/web_ui/templates/prompts/package_suggestion.html.jinja
new file mode 100644
index 0000000..ea906bb
--- /dev/null
+++ b/src/hydrilla/proxy/web_ui/templates/prompts/package_suggestion.html.jinja
@@ -0,0 +1,58 @@
+{#
+SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0
+
+Proxy web UI page that asks whether to enable a package that can be used with
+current site.
+
+This file is part of Hydrilla&Haketilo.
+
+Copyright (C) 2022 Wojtek Kosior
+
+Dual licensed under
+* GNU General Public License v3.0 or later and
+* Creative Commons Attribution Share Alike 4.0 International.
+
+You can choose to use either of these licenses or both.
+
+
+I, Wojtek Kosior, thereby promise not to sue for violation of this
+file's licenses. Although I request that you do not make use this code
+in a proprietary work, I am not going to enforce this in court.
+#}
+{% extends "base.html.jinja" %}
+
+{% block title %}
+ {{ _('web_ui.prompts.package_suggestion.title') }}
+{% endblock %}
+
+{% block main %}
+ {% if file_installation_error is defined %}
+ {{ error_note(_('web_ui.err.file_installation_error')) }}
+ {% endif %}
+
+ {% if repo_communication_error is defined %}
+ {{ error_note(_('web_ui.err.repo_communication_error')) }}
+ {% endif %}
+
+ <h3>
+ {{ _('web_ui.prompts.package_suggestion.heading') }}
+ </h3>
+
+ <p>
+ {{
+ _('web_ui.prompts.package_suggestion.do_you_want_to_enable_package_{}')
+ .format(display_info.mapping_info.info.long_name)
+ }}
+ </p>
+
+ {% set disable_text = _('web_ui.prompts.package_suggestion.disable_button') %}
+ {% set enable_text = _('web_ui.prompts.package_suggestion.enable_button') %}
+
+ {{
+ button_row([
+ (['red-button'], disable_text, {'action': 'disable_mapping'}),
+ (['blue-button'], enable_text, {'action': 'enable_mapping'})
+ ], {'mapping_ver_id': display_info.mapping_info.ref.id}
+ )
+ }}
+{% endblock %}