diff options
-rw-r--r-- | chimere/static/chimere/css/styles.css | 91 | ||||
-rw-r--r-- | chimere/templates/chimere/blocks/actions.html | 2 | ||||
-rw-r--r-- | chimere/templates/chimere/category_directory.html | 96 | ||||
-rw-r--r-- | chimere/templates/chimere/category_directory_detail.html | 25 | ||||
-rw-r--r-- | chimere/templates/chimere/category_item_detail.html | 38 | ||||
-rw-r--r-- | chimere/templates/chimere/detail.html | 7 | ||||
-rw-r--r-- | chimere/templates/chimere/detail_popup.html | 2 | ||||
-rw-r--r-- | chimere/urls_chimere.py | 6 | ||||
-rw-r--r-- | chimere/views.py | 21 |
9 files changed, 220 insertions, 68 deletions
diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 65a5b0e..97b5e6e 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -1682,6 +1682,95 @@ div.pp_default .pp_expand{ padding:0; } +#directory #sidebar, +#directory .close-img { + display: none; +} + +#directory #detail-header, #directory #detail-content, #directory #detail_footer { + width: 100%; +} + +#directory #detail-header{ + position: relative; + top: 0; + padding: 0 1em; +} + +#directory #detail-content{ + max-height: none; +} + +#directory .detail-icon{ + margin-top: 10px; +} + +#directory .share-icon{ + margin-top: 20px; + display: none; +} + +#directory-category-list{ + list-style: none; + padding: 1em; + font-family: 'Open Sans Condensed', sans-serif; + text-transform: uppercase; +} + +#directory-category-list img{ + height: 18px; +} + +#directory-category-list ul{ + list-style: none; + padding: 0; +} + +ul#category-directory{ + list-style: none; + padding: 1em; + font-family: 'Open Sans Condensed', sans-serif; +} + +.category-icon-on{ + display: none; +} + +.selected .category-icon-on{ + display: block; +} + +.selected .category-icon-off{ + display: none; +} + +#category-directory-content{ + padding: 1em; + font-size: 1.2em; + background-color: #555; + position: absolute; + width: 100%; + margin: 0; + bottom: 0; + top: 40px; +} + +#category-directory-content > div { + height: 100%; + padding: 0 0 0 1em; + overflow-x: hidden; + overflow-y: auto; +} + +#category-directory-content .subcat a{ + font-weight: normal; +} + +#category-directory-content > div > div, +#category-directory-content > div > ul { + background-color: #fff; +} + .category-directory-category{ font-variant: small-caps; font-weight: bold; @@ -1951,7 +2040,7 @@ label.labelSpan.olButton{ @media (min-height: 500px) { #category-directory{ - width:50%; + width:100%; } } diff --git a/chimere/templates/chimere/blocks/actions.html b/chimere/templates/chimere/blocks/actions.html index 3ec9829..2b098c8 100644 --- a/chimere/templates/chimere/blocks/actions.html +++ b/chimere/templates/chimere/blocks/actions.html @@ -7,7 +7,7 @@ </a> </div> <div class="col-md-2 action"> - <a href="{% url 'index' area_name %}"> + <a href="{% url 'chimere:category-directory' area_name %}"> {% trans "Directory" %} </a> </div> diff --git a/chimere/templates/chimere/category_directory.html b/chimere/templates/chimere/category_directory.html index 7031c83..3975ae1 100644 --- a/chimere/templates/chimere/category_directory.html +++ b/chimere/templates/chimere/category_directory.html @@ -1,6 +1,5 @@ {% extends "chimere/base.html" %} {% load i18n chimere_tags %} -{% load url from future %} {% block extra_head %} {{ block.super }} {{ form.media }} @@ -8,28 +7,87 @@ {% endblock %} {% block message_map %}{% endblock %} {% block message_edit%}{% endblock %} +{% block body_id %} id='directory'{% endblock %} {% block content %} {{ block.super }} - <div id="category-directory-content"> - {% if not object_list.count %} - <p>{% trans "No category defined!" %}</p> - {% else %} - <ul id="category-directory" class="list-group">{% for object in object_list %} - {% ifchanged object.category %} - {% if forloop.counter0 %} - </ul> - </li> +<style> +{% for object in object_list %} +{% ifchanged object.category %} +.category-{{object.category.pk}} label, +.category-{{object.category.pk}} .selected a{ + color: {{object.category.color}}; +} +{% endifchanged %} +{% endfor %} +{% if category %} +#detail_footer a, .current-detail-bg{ + background-color: {{category.category.color}}; +} +{% endif %} +</style> +<div class="row" id="category-directory-content"> + <div class="col-md-4"> + {% if not object_list.count %} + <p>{% trans "No category defined!" %}</p> + {% else %} + <ul id="directory-category-list"> + {% for object in object_list %} + {% ifchanged object.category %} + {% if forloop.counter0 %} + </li> + </ul> + {% endif %} + <li class="category-{{object.category.pk}}"> + <span> + <label> + {% trans object.category.name %} + </label> + </span> + <ul> + {% endifchanged %} + <li class='subcat row{% if object.id == category.pk %} selected{% endif %}'> + <span class="col-xs-10"> + <a href="{% url 'chimere:category-directory-detail' area_name object.slug %}"> + {{object.name}} + </a> + </span> + <span class="col-xs-2"> + {% if object.menu_icon.image and object.menu_icon_off.image%} + <img src="{{object.menu_icon_off.image.url}}" + class="category-icon-off"> + <img src="{{object.menu_icon.image.url}}" + class="category-icon-on"> + {% else %} + <img src="{{object.icon.image.url}}" + class="category-icon-on"> + {% endif %} + </span> + </li> + {% endfor %} + </ul> + </li> + </ul> {% endif %} - <li class='list-group-item' id='{{object.category|slugify}}'><p class='category-directory-category'>{{object.category}}</p> - <ul> - {% endifchanged %} - <li class='list-group-item'><span class='icon'><img src='{{MEDIA_URL}}{{object.icon.image}}'/></span><a href="{% url 'chimere:category-directory-detail' area_name object.slug %}">{{object.name}}</a></li> - {% endfor %} - </ul> - </li> - </ul> + </div> + {% if items %} + <div class="col-md-3"> + <ul id="category-directory">{% for marker in items %} + <li class='{% if marker.pk == current_marker.pk %} selected{% endif %}'> + <a {% if marker.pk == current_marker.pk %}style="color: {{category.category.color}}"{% endif %} + href="{% url 'chimere:category-directory-item-detail' area_name category.slug marker.pk %}"> + {{marker.name}} + </a> + </li> + {% endfor %} + </ul> + </div> {% endif %} - </div> + {% if current_marker %} + <div class="col-md-5"> + {% include "chimere/category_item_detail.html" %} + </div> + {% endif %} +</div> {% endblock %} diff --git a/chimere/templates/chimere/category_directory_detail.html b/chimere/templates/chimere/category_directory_detail.html deleted file mode 100644 index 1b23b7e..0000000 --- a/chimere/templates/chimere/category_directory_detail.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "chimere/base.html" %} -{% load i18n chimere_tags %} -{% load url from future %} -{% block extra_head %} - {{ block.super }} - {{ form.media }} - {% head_jquery %} -{% endblock %} -{% block message_map %}{% endblock %} -{% block message_edit%}{% endblock %} -{% block content %} - {{ block.super }} - <ol class="breadcrumb"> - <li><a href="{% url 'chimere:category-directory' area_name %}#{{category.category.name|slugify}}">{{category.category.name}}</a></li> - <li class="active">{{category.name}}</li> - </ol> - <ul id="category-directory" class="list-group">{% for marker in items %} - <li class='list-group-item' id='{{item.name|slugify}}'> - {% include "chimere/category_item_detail.html" %} - </li> - {% endfor %} - </ul> -{% endblock %} - - diff --git a/chimere/templates/chimere/category_item_detail.html b/chimere/templates/chimere/category_item_detail.html index 2984a47..87cc7f3 100644 --- a/chimere/templates/chimere/category_item_detail.html +++ b/chimere/templates/chimere/category_item_detail.html @@ -1,38 +1,46 @@ {% load i18n sanitize chimere_tags %} +<div> + {% with marker=current_marker %} + {% include "chimere/detail.html" %} + {% endwith %} -<h2>{{ marker.name }}</h2> + {% comment %} +<h2>{{ current_marker.name }}</h2> <div class='detail_content'> - {% if marker.default_pictures or marker.default_pictures or marker.default_multimedia_items%} + {% if current_marker.default_pictures or current_marker.default_pictures or current_marker.default_multimedia_items%} <div class='small-gallery'> - {% for picture in marker.default_pictures %} + {% for picture in current_marker.default_pictures %} {% multimedia_render picture %} {%endfor%} - {% for multimedia_item in marker.default_multimedia_items %} + {% 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>{{marker.start_date|date:"D d M Y"}} - {% if marker.end_date %} - {{marker.end_date|date:"D d M Y"}}</p>{% endif %}</span> + <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 marker.description %} - <p class='description'>{{ 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> + {% 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 marker.getProperties %} + {% 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 marker.origin %}<p class='detail_source'><strong>{% trans "Source:" %}</strong> <span>{{marker.origin}}</span></p>{% endif %} - {% if marker.license %}<p class='detail_license'><strong>{% trans "License:" %}</strong> <span>{{marker.license}}</span></p>{% endif %} - {% share_bar marker.name %} - <a href="{% get_tinyfied_url marker area_name %}">{% trans "See on the map" %}</a> - <p class='detail_amendment'><a href='{% if marker.route %}{% url 'chimere:editroute-item' area_name_slash|default_if_none:"" marker.route.pk "" %}{%else%}{% url 'chimere:editmarker-item' area_name_slash|default_if_none:"" marker.pk "" %}{%endif%}'> + {% 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> + </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.html b/chimere/templates/chimere/detail.html index abb5243..3f2acf2 100644 --- a/chimere/templates/chimere/detail.html +++ b/chimere/templates/chimere/detail.html @@ -69,9 +69,16 @@ | <a class='detail_to' href='#'>{% trans "To" context "routing" %}</a> {% endif %} </div> + {% comment %} + <a href="{% get_tinyfied_url current_marker area_name %}"> + {% trans "See on the map" %} + </a> + {% endcomment %} + {% if not is_directory %} <a class="propose-modif current-detail-bg" href='#'> {% trans "Submit a modification" %} </a> + {% endif %} </div> </div> diff --git a/chimere/templates/chimere/detail_popup.html b/chimere/templates/chimere/detail_popup.html index 64e261b..dc48fb4 100644 --- a/chimere/templates/chimere/detail_popup.html +++ b/chimere/templates/chimere/detail_popup.html @@ -39,7 +39,7 @@ <li><a href="{{modif_by_email}}">{% trans "Propose a modification" %}</a></li> <li class='sep'>–</li> </ul> - {% share_bar marker.name '' '' %} + {% share_bar marker '' '' %} {% comment %} <a href='{% if marker.route %}{% url "chimere:editroute-item" area_name_slash|default_if_none:"" marker.route.pk "" %}{%else%}{% url 'chimere:edit-item' area_name_slash|default_if_none:"" marker.pk "" %}{%endif%}'> {% trans "Submit a modification" %} diff --git a/chimere/urls_chimere.py b/chimere/urls_chimere.py index 96de01a..c888efa 100644 --- a/chimere/urls_chimere.py +++ b/chimere/urls_chimere.py @@ -24,7 +24,8 @@ from django.core.exceptions import ImproperlyConfigured from chimere import views from chimere.forms import SearchForm -from chimere.views import CategoryDirectoryView, CategoryView, SearchView +from chimere.views import CategoryDirectoryView, CategoryView, SearchView, \ + CategoryItemView from chimere.feeds import LatestPOIsByCategory, LatestPOIsBySubCategory, \ LatestPOIs, LatestPOIsByZone, LatestPOIsByZoneID @@ -152,6 +153,9 @@ urlpatterns += [ url(r'^(?:(?P<area_name>[a-zA-Z0-9_-]*)/)?categories/' r'(?P<category_slug>[a-zA-Z0-9_-]+)$', CategoryView.as_view(), name='category-directory-detail'), + url(r'^(?:(?P<area_name>[a-zA-Z0-9_-]*)/)?categories/' + r'(?P<category_slug>[a-zA-Z0-9_-]+)/(?P<item_id>[0-9]+)/$', + CategoryItemView.as_view(), name='category-directory-item-detail'), url(r'^(?:(?P<area_name>[a-zA-Z0-9_-]*)/)?property-choices/' r'(?P<property_slug>[a-zA-Z0-9_-]+)/$', views.property_choice_list, name='property-choices'), diff --git a/chimere/views.py b/chimere/views.py index ab07a07..87c5b26 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -1035,15 +1035,14 @@ class CategoryDirectoryView(ListView): new_context, redirect = get_base_response(self.request, self.area_name) context.update(new_context) context.update({ + 'is_directory': True, 'actions': actions(self.area_name), 'action_selected': ('categories',), }) return context -class CategoryView(TemplateView): - template_name = "chimere/category_directory_detail.html" - +class CategoryView(CategoryDirectoryView): def get_geo_items(self): # TODO: simplify on v2.3 when slug are available category_slug = self.kwargs.get('category_slug') @@ -1088,11 +1087,23 @@ class CategoryView(TemplateView): return context +class CategoryItemView(CategoryView): + def get_context_data(self, *args, **kwargs): + context = super(CategoryItemView, self).get_context_data( + *args, **kwargs) + try: + context['current_marker'] = models.Marker.objects.get( + pk=self.kwargs['item_id'], status='A') + except models.Marker.DoesNotExists: + pass + return context + + def route(request, area_name, lon1, lat1, lonlat_steps, lon2, lat2, transport='foot', speed=''): - ''' + """ Get the JSON for a route - ''' + """ try: lon1, lat1 = float(lon1), float(lat1) lon2, lat2 = float(lon2), float(lat2) |