mirror of
https://github.com/umap-project/umap.git
synced 2025-05-04 21:51:50 +02:00
Fix annoying exception thrown on home page
This commit is contained in:
parent
00d42c5b03
commit
b30725d987
5 changed files with 13 additions and 5 deletions
|
@ -9,7 +9,7 @@
|
|||
<div class="wrapper">
|
||||
<div class="map_list row">
|
||||
{% if maps %}
|
||||
{% include "umap/map_list.html" %}
|
||||
{% include "umap/map_list.html" with prefix='user_detail' %}
|
||||
{% else %}
|
||||
<div>
|
||||
{% blocktrans %}{{ current_user }} has no maps.{% endblocktrans %}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<div class="wrapper">
|
||||
<h2 class="section">{% blocktrans %}Get inspired, browse maps{% endblocktrans %}</h2>
|
||||
<div class="map_list row">
|
||||
{% include "umap/map_list.html" %}
|
||||
{% include "umap/map_list.html" with prefix='home' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% for map_inst in maps %}
|
||||
<hr />
|
||||
<div class="col wide">
|
||||
{% map_fragment map_inst prefix=prefix page=request.GET.p %}
|
||||
{% map_fragment map_inst prefix=prefix params=request.GET %}
|
||||
<div class="legend"><a href="{{ map_inst.get_absolute_url }}">{{ map_inst.name }}</a>{% if map_inst.owner %} <em>{% trans "by" %} <a href="{% url 'user_maps' map_inst.owner.username %}">{{ map_inst.owner }}</a></em>{% endif %}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
<div class="row">
|
||||
<form action="{% url 'search' %}" method="GET">
|
||||
<div class="col two-third mwide">
|
||||
<input name="q" type="search" placeholder="{% trans 'Search maps' %}" value="{{ q|default:"" }}" />
|
||||
{% if q %}
|
||||
<input name="q" type="search" placeholder="{% trans 'Search maps' %}" value="{{ q }}" />
|
||||
{% else %}
|
||||
<input name="q" type="search" placeholder="{% trans 'Search maps' %}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col third mwide">
|
||||
<input type="submit" value="{% trans 'Search' %}" class="neutral" />
|
||||
|
|
|
@ -51,7 +51,11 @@ def map_fragment(map_instance, **kwargs):
|
|||
})
|
||||
map_settings['properties'].update(kwargs)
|
||||
prefix = kwargs.pop('prefix', None) or 'map'
|
||||
page = kwargs.pop('page', None) or ''
|
||||
params = kwargs.pop('params', None)
|
||||
if params is not None and params.__contains__('p'):
|
||||
page = params.p
|
||||
else:
|
||||
page = ''
|
||||
unique_id = prefix + str(page) + "_" + str(map_instance.pk)
|
||||
return {
|
||||
"map_settings": json.dumps(map_settings),
|
||||
|
|
Loading…
Reference in a new issue