From 2e013f2dc0365222e480da09aefc571f95fd06f0 Mon Sep 17 00:00:00 2001 From: Lova Andriarimalala <43842786+Xpirix@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:37:58 +0300 Subject: [PATCH] Use bulma for notification --- .../templates/plugins/form_snippet.html | 10 +++--- .../templates/plugins/plugin_detail.html | 6 ++-- .../templates/plugins/plugin_feedback.html | 12 +++---- .../templates/plugins/plugin_form.html | 12 +++---- .../plugins/plugin_token_delete_confirm.html | 2 +- .../templates/plugins/plugin_token_form.html | 12 +++---- .../templates/plugins/plugin_upload.html | 36 +++++++++---------- .../plugins/version_delete_confirm.html | 2 +- .../templates/plugins/version_detail.html | 2 +- .../templates/plugins/version_form.html | 6 ++-- qgis-app/static/js/bulma.js | 11 ++++++ qgis-app/static/style/scss/_variables.scss | 2 +- qgis-app/templates/base.html | 1 + qgis-app/templates/layouts/header.html | 2 +- qgis-app/templates/registration/login.html | 8 ++--- 15 files changed, 67 insertions(+), 57 deletions(-) create mode 100644 qgis-app/static/js/bulma.js diff --git a/qgis-app/plugins/templates/plugins/form_snippet.html b/qgis-app/plugins/templates/plugins/form_snippet.html index a75c544b..5371cede 100755 --- a/qgis-app/plugins/templates/plugins/form_snippet.html +++ b/qgis-app/plugins/templates/plugins/form_snippet.html @@ -45,12 +45,12 @@ Choose a fileā€¦ - {% if field.errors %} - {% for error in field.errors %} -

{{ error }}

- {% endfor %} - {% endif %} + {% if field.errors %} + {% for error in field.errors %} +

{{ error }}

+ {% endfor %} + {% endif %} {% elif field.field.widget|klass == 'Textarea' %}
diff --git a/qgis-app/plugins/templates/plugins/plugin_detail.html b/qgis-app/plugins/templates/plugins/plugin_detail.html index eae28fab..c74e49cf 100644 --- a/qgis-app/plugins/templates/plugins/plugin_detail.html +++ b/qgis-app/plugins/templates/plugins/plugin_detail.html @@ -185,19 +185,19 @@

{% if not object.experimental and not object.stable %}
-

{% trans "This plugin has no public version yet." %}

+ {% trans "This plugin has no public version yet." %}
{% endif %} {% if not object.created_by.is_active %}
-

{% trans "The plugin maintainer has been blocked." %}

+ {% trans "The plugin maintainer has been blocked." %}
{% endif %} {% if object.deprecated %}
-

{% trans "This plugin is deprecated!" %}

+ {% trans "This plugin is deprecated!" %}
{% endif %} diff --git a/qgis-app/plugins/templates/plugins/plugin_feedback.html b/qgis-app/plugins/templates/plugins/plugin_feedback.html index 4a4c8424..ff68c435 100644 --- a/qgis-app/plugins/templates/plugins/plugin_feedback.html +++ b/qgis-app/plugins/templates/plugins/plugin_feedback.html @@ -1,16 +1,16 @@ {% extends 'plugins/plugin_base.html' %}{% load i18n %} {% block content %} {% if form.errors %} -
- -

{% trans "The form contains errors and cannot be submitted, please check the fields highlighted in red." %}

+
+ + {% trans "The form contains errors and cannot be submitted, please check the fields highlighted in red." %}
{% endif %} {% if form.non_field_errors %} -
- +
+ {% for error in form.non_field_errors %} -

{{ error }}

+ {{ error }}
{% endfor %}
{% endif %} diff --git a/qgis-app/plugins/templates/plugins/plugin_form.html b/qgis-app/plugins/templates/plugins/plugin_form.html index 0626f4c2..25a51374 100644 --- a/qgis-app/plugins/templates/plugins/plugin_form.html +++ b/qgis-app/plugins/templates/plugins/plugin_form.html @@ -38,16 +38,16 @@ {% block content %}

{{ form_title }} {{ plugin }}

{% if form.errors %} -
- -

{% trans "The form contains errors and cannot be submitted, please check the fields highlighted in red." %}

+
+ + {% trans "The form contains errors and cannot be submitted, please check the fields highlighted in red." %}
{% endif %} {% if form.non_field_errors %} -
- +
+ {% for error in form.non_field_errors %} -

{{ error }}

+ {{ error }}
{% endfor %}
{% endif %} diff --git a/qgis-app/plugins/templates/plugins/plugin_token_delete_confirm.html b/qgis-app/plugins/templates/plugins/plugin_token_delete_confirm.html index 10a34a60..036c204d 100644 --- a/qgis-app/plugins/templates/plugins/plugin_token_delete_confirm.html +++ b/qgis-app/plugins/templates/plugins/plugin_token_delete_confirm.html @@ -2,7 +2,7 @@ {% block content %}

Delete token of "{{ username }}"

{% csrf_token %} -

{% trans "You asked to delete a token.
The token will be permanently deleted and this action cannot be undone.
Please confirm." %}

+
{% trans "You asked to delete a token.
The token will be permanently deleted and this action cannot be undone.
Please confirm." %}

{% trans "Cancel" %}

diff --git a/qgis-app/plugins/templates/plugins/plugin_token_form.html b/qgis-app/plugins/templates/plugins/plugin_token_form.html index 11b44f5e..5781295a 100644 --- a/qgis-app/plugins/templates/plugins/plugin_token_form.html +++ b/qgis-app/plugins/templates/plugins/plugin_token_form.html @@ -4,16 +4,16 @@

{% trans "Edit token description " %} {{ token.jti }}

{% if form.errors %} -
- -

{% trans "The form contains errors and cannot be submitted, please check the fields highlighted in red." %}

+
+ + {% trans "The form contains errors and cannot be submitted, please check the fields highlighted in red." %}
{% endif %} {% if form.non_field_errors %} -
- +
+ {% for error in form.non_field_errors %} -

{{ error }}

+ {{ error }}
{% endfor %}
{% endif %} diff --git a/qgis-app/plugins/templates/plugins/plugin_upload.html b/qgis-app/plugins/templates/plugins/plugin_upload.html index 49f30f1f..4921a0af 100644 --- a/qgis-app/plugins/templates/plugins/plugin_upload.html +++ b/qgis-app/plugins/templates/plugins/plugin_upload.html @@ -9,30 +9,28 @@

{% trans "Upload a plugin" %}

{% if form.non_field_errors %} -
- +
+ {% for error in form.non_field_errors %} -

{{ error }}

+ {{ error }}
{% endfor %}
{% endif %} -
-
-
{% csrf_token %} - {% include "plugins/form_snippet.html" %} -
- -
-
-
+
+
{% csrf_token %} + {% include "plugins/form_snippet.html" %} +
+ +
+
diff --git a/qgis-app/plugins/templates/plugins/version_delete_confirm.html b/qgis-app/plugins/templates/plugins/version_delete_confirm.html index 19030c1a..ceb36e58 100644 --- a/qgis-app/plugins/templates/plugins/version_delete_confirm.html +++ b/qgis-app/plugins/templates/plugins/version_delete_confirm.html @@ -2,7 +2,7 @@ {% block content %}

{% blocktrans with version.version as version and plugin.name as plugin_name %}Delete version "{{ version }}" of "{{ plugin_name }}"{% endblocktrans %}

{% csrf_token %} -

{% trans "You asked to delete one version.
The version will be permanently deleted and this action cannot be undone.
Please confirm." %}

+
{% trans "You asked to delete one version.
The version will be permanently deleted and this action cannot be undone.
Please confirm." %}

{% trans "Cancel" %}

diff --git a/qgis-app/plugins/templates/plugins/version_detail.html b/qgis-app/plugins/templates/plugins/version_detail.html index a6bd7a60..b418da5e 100644 --- a/qgis-app/plugins/templates/plugins/version_detail.html +++ b/qgis-app/plugins/templates/plugins/version_detail.html @@ -5,7 +5,7 @@

{% trans "Version" %}: {{ version }}

{% if not version.created_by.is_active and not version.is_from_token %} -
+
{% trans "The plugin author has been blocked." %}
{% endif %} diff --git a/qgis-app/plugins/templates/plugins/version_form.html b/qgis-app/plugins/templates/plugins/version_form.html index 78ab4cd7..d82898be 100644 --- a/qgis-app/plugins/templates/plugins/version_form.html +++ b/qgis-app/plugins/templates/plugins/version_form.html @@ -2,10 +2,10 @@ {% block content %}

{{ form_title }} {{ version }}

{% if form.non_field_errors %} -
- +
+ {% for error in form.non_field_errors %} -

{{ error }}

+ {{ error }}
{% endfor %}
{% endif %} diff --git a/qgis-app/static/js/bulma.js b/qgis-app/static/js/bulma.js new file mode 100644 index 00000000..b015a775 --- /dev/null +++ b/qgis-app/static/js/bulma.js @@ -0,0 +1,11 @@ +document.addEventListener("DOMContentLoaded", () => { + (document.querySelectorAll(".notification .delete") || []).forEach( + ($delete) => { + const $notification = $delete.parentNode; + + $delete.addEventListener("click", () => { + $notification.parentNode.removeChild($notification); + }); + } + ); +}); diff --git a/qgis-app/static/style/scss/_variables.scss b/qgis-app/static/style/scss/_variables.scss index 73d3a766..db8ee0d2 100644 --- a/qgis-app/static/style/scss/_variables.scss +++ b/qgis-app/static/style/scss/_variables.scss @@ -36,7 +36,7 @@ $grey-dark: #444444; $grey-darker: #363636; $grey-light: #d4d4d4; $primary: #a7cecb; -$danger: #ee7913; +$danger: hsl(348, 100%, 61%); $info: #93b023; $success: #589632; $warning: #EEE766; diff --git a/qgis-app/templates/base.html b/qgis-app/templates/base.html index eaff059f..5dbad7ac 100644 --- a/qgis-app/templates/base.html +++ b/qgis-app/templates/base.html @@ -25,6 +25,7 @@ +