Skip to content

Commit

Permalink
Fix tags modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpirix committed Oct 16, 2024
1 parent 3f80406 commit 8b5b29e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
22 changes: 16 additions & 6 deletions qgis-app/models/templatetags/resources_tagcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,27 @@ def get_resources_tagcloud(context, app_label, model):

return queryset

@register.inclusion_tag("base/includes/resources_tagcloud_modal_include.html", takes_context=True)
def include_resources_tagcloud_modal(context, app_label, model):
tags = get_resources_tagcloud(context, app_label, model)
def get_tags_title(model):
tags_title = model[0].upper() + model[1:]
if str(model).lower() == "wavefront":
if model.lower() == "wavefront":
tags_title = "3D Model"
elif str(model).lower() == "layerdefinition":
elif model.lower() == "layerdefinition":
tags_title = "Layer Definition"
return tags_title + " Tags"

@register.inclusion_tag("base/includes/resources_tagcloud_modal_include.html", takes_context=True)
def include_resources_tagcloud_modal(context, app_label, model):
tags_title = get_tags_title(model)
return {
'tags_title': tags_title
}

@register.inclusion_tag("base/includes/resources_tags_modal.html", takes_context=True)
def include_resources_tags_modal(context, app_label, model):
tags = get_resources_tagcloud(context, app_label, model)
tags_title = get_tags_title(model)
return {
'tags': tags,
'tags_title': tags_title + " Tags",
'tags_title': tags_title,
'tags_list_url': model + "_tag"
}
2 changes: 2 additions & 0 deletions qgis-app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
{% get_sustaining_members_section as sustaining_members_section %}
{{ sustaining_members_section|safe }}
{% include 'layouts/footer.html' %}

{% include 'base/includes/resources_tags_modal.html' %}

<script type="text/javascript" src="{% static 'js/moment.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/local_timezone-1.0.js' %}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
</span>
{{ tags_title }}
</a>


{% include 'base/includes/resources_tags_modal.html' %}
3 changes: 2 additions & 1 deletion qgis-app/templates/base/list_galery.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'base/base.html' %}{% load i18n bootstrap_pagination humanize static thumbnail resources_custom_tags %}
{% extends 'base/base.html' %}{% load i18n bootstrap_pagination humanize static thumbnail resources_custom_tags resources_tagcloud %}

{% block extrajs %}
{{ block.super }}
Expand Down Expand Up @@ -52,6 +52,7 @@
{% endblock %}

{% block content %}
{% include_resources_tags_modal app_label=app_label model=model_name %}
<h2 class="title is-4">{% if title %}{{title}}{% else %}{% trans "All" %} {{ resource_name }}s{% endif %}</h2>

<div class="container rich tips mb-3">
Expand Down

0 comments on commit 8b5b29e

Please sign in to comment.