From 630be8d0488284aa5f9c30f63708d0d151b86e44 Mon Sep 17 00:00:00 2001 From: Lova Andriarimalala <43842786+Xpirix@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:11:36 +0300 Subject: [PATCH] Improve UI of search page --- .../templates/plugins/plugin_list.html | 114 +---------------- .../plugins/plugin_list_grid_card.html | 114 +++++++++++++++++ qgis-app/templates/search/search.html | 120 +++++++----------- 3 files changed, 162 insertions(+), 186 deletions(-) create mode 100644 qgis-app/plugins/templates/plugins/plugin_list_grid_card.html diff --git a/qgis-app/plugins/templates/plugins/plugin_list.html b/qgis-app/plugins/templates/plugins/plugin_list.html index 97fb32fd..7ccaa15b 100644 --- a/qgis-app/plugins/templates/plugins/plugin_list.html +++ b/qgis-app/plugins/templates/plugins/plugin_list.html @@ -1,4 +1,4 @@ -{% extends 'plugins/plugin_base.html' %}{% load i18n bootstrap_pagination humanize static sort_anchor range_filter thumbnail %} +{% extends 'plugins/plugin_base.html' %}{% load i18n humanize static sort_anchor range_filter thumbnail %} {% load local_timezone %} {% load plugin_utils %} {% block extrajs %} @@ -77,117 +77,7 @@

{% if title %}{{title}}{% else %}{% trans "All plugins" %}{% endif %}

{% for object in object_list %} -
-
- - {% if object|is_new and not object.featured and not object.deprecated %} -
- - New - -
- {% endif %} - {% if object.featured and not object.deprecated %} -
- - Featured - -
- {% endif %} - {% if object.deprecated %} -
- - Deprecated - -
- {% endif %} -
-
-
- {% if object.icon and object.icon.file and object.icon|is_image_valid %} - {% with image_extension=object.icon.name|file_extension %} - {% if image_extension == 'svg' %} -
- {% trans -
- {% else %} - {% thumbnail object.icon "256x256" format="PNG" as im %} -
- {% trans -
- {% endthumbnail %} - {% endif %} - {% endwith %} - {% else %} -
- {% trans -
- {% endif %} -
-
-

{{ object.name }}

-

{% trans "by" %} - - {{ object.author }} - -

-
-
-
-

{{ object.description|truncatewords:20 }}

- -
-

-
- -
-

- - - - - {{ object.latest_version_date|local_timezone:"SHORT_NATURAL_DAY" }} - -

-
-
- -
({{ object.rating_votes }}) -
-
-
-
- - -
-
+ {% include "plugins/plugin_list_grid_card.html" %} {% endfor %}
diff --git a/qgis-app/plugins/templates/plugins/plugin_list_grid_card.html b/qgis-app/plugins/templates/plugins/plugin_list_grid_card.html new file mode 100644 index 00000000..9809f81c --- /dev/null +++ b/qgis-app/plugins/templates/plugins/plugin_list_grid_card.html @@ -0,0 +1,114 @@ +{% load i18n plugin_utils plugins_tagcloud thumbnail static%} +{% load local_timezone humanize %} + +
+
+ + {% if object|is_new and not object.featured and not object.deprecated %} +
+ + New + +
+ {% endif %} + {% if object.featured and not object.deprecated %} +
+ + Featured + +
+ {% endif %} + {% if object.deprecated %} +
+ + Deprecated + +
+ {% endif %} +
+
+
+ {% if object.icon and object.icon.file and object.icon|is_image_valid %} + {% with image_extension=object.icon.name|file_extension %} + {% if image_extension == 'svg' %} +
+ {% trans +
+ {% else %} + {% thumbnail object.icon "256x256" format="PNG" as im %} +
+ {% trans +
+ {% endthumbnail %} + {% endif %} + {% endwith %} + {% else %} +
+ {% trans +
+ {% endif %} +
+
+

{{ object.name }}

+

{% trans "by" %} + + {{ object.author }} + +

+
+
+
+

{{ object.description|truncatewords:20 }}

+ +
+

+
+ +
+

+ + + + + {{ object.latest_version_date|local_timezone:"SHORT_NATURAL_DAY" }} + +

+
+
+ +
({{ object.rating_votes }}) +
+
+
+
+ + +
+
\ No newline at end of file diff --git a/qgis-app/templates/search/search.html b/qgis-app/templates/search/search.html index df2bf9a1..47c5ed6c 100644 --- a/qgis-app/templates/search/search.html +++ b/qgis-app/templates/search/search.html @@ -1,88 +1,60 @@ {% extends 'base.html' %} -{% load i18n plugin_utils plugins_tagcloud %} +{% load i18n plugin_utils%} {% block menu %} {{ block.super }} -
-

{% trans "Plugin tags" %}

- {% include_plugins_tagcloud 'plugins.plugin' %} -
- + {% include "plugins/plugin_sidebar.html" %} {% endblock %} {% block content %} -

Search

- -
- {% for field in form %} -
- {{ field.errors }} - {% if field.field.widget|klass == 'CheckboxSelectMultiple' %} - {% comment %} - -
- -
- {% endcomment %} - {% else %} - {{ field.label_tag }}{{ field }} - {% endif %} -
{{ field.help_text }}
-
- {% endfor %} -
- -
- - {% if query %} -

Search results for "{{query}}" ({{paginator.count}} items found)

+ {% if query %} +

Search results for "{{query}}" ({{paginator.count}} items found)

+
{% for result in page.object_list %} -

- {{ result.object }} -

+ {% with object=result.object %} + {% include "plugins/plugin_list_grid_card.html" %} + {% endwith %} {% empty %} -

No results found.

+
+ + {% trans "No results found." %} +
{% endfor %} +
- {% if page.has_previous or page.has_next %} - - {% endif %} - {% else %} - {# Show some example queries to run, maybe query syntax, something else? #} + {% if page.has_previous or page.has_next %} + {% endif %} -
+ {% else %} + {# Show some example queries to run, maybe query syntax, something else? #} + {% endif %} {% endblock %}