summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-03-22 16:49:12 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-03-22 16:49:12 +0100
commit74cf0226a3690c521b6275faa73e8fe33b6f5dba (patch)
tree2f13333d7850176cbe0cf1dfd9e465ecd2696710
parentbbc7db0dedfcc00cb633c501e3a94d4577011085 (diff)
downloadChimère-74cf0226a3690c521b6275faa73e8fe33b6f5dba.tar.bz2
Chimère-74cf0226a3690c521b6275faa73e8fe33b6f5dba.zip
Fix property decoration of the marker on the directory view
-rw-r--r--chimere/templates/chimere/category_item_detail.html40
-rw-r--r--chimere/templates/chimere/detail_description.html2
-rw-r--r--chimere/views.py6
3 files changed, 6 insertions, 42 deletions
diff --git a/chimere/templates/chimere/category_item_detail.html b/chimere/templates/chimere/category_item_detail.html
index 87cc7f3..4232d46 100644
--- a/chimere/templates/chimere/category_item_detail.html
+++ b/chimere/templates/chimere/category_item_detail.html
@@ -3,44 +3,4 @@
{% with marker=current_marker %}
{% include "chimere/detail.html" %}
{% endwith %}
-
- {% comment %}
-<h2>{{ current_marker.name }}</h2>
-<div class='detail_content'>
- {% if current_marker.default_pictures or current_marker.default_pictures or current_marker.default_multimedia_items%}
- <div class='small-gallery'>
- {% for picture in current_marker.default_pictures %}
- {% multimedia_render picture %}
- {%endfor%}
- {% for multimedia_item in current_marker.default_multimedia_items %}
- {% multimedia_render multimedia_item %}
- {%endfor%}
- </div>
- {%endif%}
- <div>
- {% if dated %}
- <p class='detail_start_date'><label>{% trans "Date:" %}</label> <span>{{current_marker.start_date|date:"D d M Y"}}
- {% if current_marker.end_date %} - {{current_marker.end_date|date:"D d M Y"}}</span>{% endif %}</p>
- {% endif %}
- {% if current_marker.description %}
- <p class='description'>{{ current_marker.description|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p>
- {% endif %}
- {% for property in current_marker.getProperties %}
- <p class='{{property.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p>
- {% endfor %}
- {% if current_marker.origin %}<p class='detail_source'><strong>{% trans "Source:" %}</strong> <span>{{current_marker.origin}}</span></p>{% endif %}
- {% if current_marker.license %}<p class='detail_license'><strong>{% trans "License:" %}</strong> <span>{{current_marker.license}}</span></p>{% endif %}
- {% share_bar current_marker %}
- <a href="{% get_tinyfied_url current_marker area_name %}">{% trans "See on the map" %}</a>
- <p class='detail_amendment'><a href='{% if current_marker.route %}{% url 'chimere:editroute-item' area_name_slash|default_if_none:"" current_marker.route.pk "" %}{%else%}{% url 'chimere:editmarker-item' area_name_slash|default_if_none:"" current_marker.pk "" %}{%endif%}'>
- {% trans "Submit an amendment" %}
- </a>
- </p>
- {% if moderator_emails %}
- <a href="mailto:?from={{moderator_emails}}&subject={% trans "Propose amendment" %}&body={% trans "I would like to propose an amendment for this item:"%} {{share_url}}">
- {% trans "Propose amendment" %}
- </a>{%endif%}
- </div>
-</div>
- {% endcomment %}
</div> \ No newline at end of file
diff --git a/chimere/templates/chimere/detail_description.html b/chimere/templates/chimere/detail_description.html
index 3487962..5cd0891 100644
--- a/chimere/templates/chimere/detail_description.html
+++ b/chimere/templates/chimere/detail_description.html
@@ -6,6 +6,6 @@
{% if marker.description %}
<div id='description_long_{{marker.pk}}'>{{ marker.description|sanitize:"p b i br hr strong em span:style a:href:target ul li ol h1 h2 h3 h4 h5 table td tr th"|safe}}</div>
{% endif %}
-{% for property in marker.getProperties %}{% if property.value %}
+{% for property in properties %}{% if property.value %}
<div class='properties' id='{{property.propertymodel.getAttrName}}'><strong>{{property.propertymodel.name}}</strong> : {% if 'http://' in property.value or 'https://' in property.value %}<a href='{{ property.value|sanitize:""}}'>{%endif%}{{ property.value|sanitize:"p b i br hr strong em span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}{% if 'http://' in property.value or 'https://' in property.value %}</a>{%endif%}</div>
{%endif%}{% endfor %}
diff --git a/chimere/views.py b/chimere/views.py
index 50afd87..f6014b2 100644
--- a/chimere/views.py
+++ b/chimere/views.py
@@ -1108,8 +1108,12 @@ class CategoryItemView(CategoryView):
context = super(CategoryItemView, self).get_context_data(
*args, **kwargs)
try:
- context['current_marker'] = models.Marker.objects.get(
+ marker = models.Marker.objects.get(
pk=self.kwargs['item_id'], status='A')
+ marker.set_properties_attributes(area_name=self.area_name)
+ context['current_marker'] = marker
+ context['properties'] = marker.getProperties(
+ area_name=self.area_name)
except models.Marker.DoesNotExists:
pass
return context