diff options
-rw-r--r-- | chimere/models.py | 12 | ||||
-rw-r--r-- | chimere/static/chimere/css/styles.css | 9 | ||||
-rw-r--r-- | chimere/templates/chimere/detail_description.html | 2 | ||||
-rw-r--r-- | chimere/templatetags/chimere_tags.py | 5 | ||||
-rw-r--r-- | chimere/views.py | 1 |
5 files changed, 20 insertions, 9 deletions
diff --git a/chimere/models.py b/chimere/models.py index c4fa9b3..8ce88ef 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -713,6 +713,15 @@ class GeographicItem(models.Model): properties.append(property) return properties + def set_properties_attributes(self, area_name=None): + """ + Decorate the object with properties has attributes + :return: + """ + for proprty in self.getProperties(area_name=area_name): + setattr(self, proprty.propertymodel.slug.replace('-', '_'), + str(proprty)) + def setProperty(self, pm, value): """ Set a property @@ -2353,6 +2362,9 @@ class Property(models.Model): return "" return str(self.value) + def render(self): + return str(self) + class Meta: verbose_name = _("Property") diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 97b5e6e..0c424b9 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -538,6 +538,7 @@ div#sidebar-container{ #detail div{ margin:auto; + margin-bottom: 5px; } #detail-header{ @@ -3838,14 +3839,6 @@ select#id_categories{ right:28px; } -.properties{ - padding: 2px 1em; -} -.properties p{ - padding: 0; - margin:0; -} - #waiting{ top:0; height:100%; diff --git a/chimere/templates/chimere/detail_description.html b/chimere/templates/chimere/detail_description.html index 6dca8f5..3487962 100644 --- a/chimere/templates/chimere/detail_description.html +++ b/chimere/templates/chimere/detail_description.html @@ -4,7 +4,7 @@ {% if marker.end_date %} - {{marker.end_date|date:"D d M Y"}}</p>{% endif %}</span> {% endif %} {% 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 table td tr th"|safe}}</div> +<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 %} <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> diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index 87a590a..29748a2 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -384,3 +384,8 @@ def ol_map(item, arg='map_id'): rendered = render_to_string('chimere/blocks/ol_map.html', {'geom': geom, 'map_id': arg}) return rendered + + +@register.filter(name='is_in') +def is_in(item, include=''): + return item in include.split(";") diff --git a/chimere/views.py b/chimere/views.py index 87c5b26..787a1d9 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -678,6 +678,7 @@ def getDetail(request, area_name, key, popup=False): and marker.start_date response_dct['routing_enabled'] = settings.CHIMERE_ENABLE_ROUTING response_dct['properties'] = marker.getProperties(area_name=area_name) + marker.set_properties_attributes(area_name=area_name) if popup: return render(request, 'chimere/detail_popup.html', response_dct) return render(request, 'chimere/detail.html', response_dct) |