From 2a60a9cbe6a06189e17bc1ec0045d966bb5b0b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt?= <b.charpentier@webu.coop> Date: Mon, 12 Dec 2016 18:15:30 +0100 Subject: [PATCH] newsbox plugin refactoring --- newsbox/templates/newsbox/inc/detail.html | 8 ++-- newsbox/templates/newsbox/inc/list-item.html | 17 ++++---- newsbox/templates/newsbox/inc/list.html | 43 +++++++++---------- .../templates/newsbox_cms/inc/list.html | 6 +-- 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/newsbox/templates/newsbox/inc/detail.html b/newsbox/templates/newsbox/inc/detail.html index 285d630..849a790 100644 --- a/newsbox/templates/newsbox/inc/detail.html +++ b/newsbox/templates/newsbox/inc/detail.html @@ -1,6 +1,6 @@ {% load i18n %} -<article class="newsbox_detail {{ model_opts.app_label }}_{{ model_opts.model_name }} {{ object.is_published|yesno:',draft' }}"> +<article class="mod__content-detail newsbox {{ model_opts.app_label }}-{{ model_opts.model_name }} {{ object.is_published|yesno:',draft' }}"> {% if newsbox_seo %} {% block extrahead %} {{ block.super }} @@ -21,13 +21,13 @@ {% block newsbox_detail_header %} <h1>{{ object.newsbox_title }}</h1> {% if object.newsbox_date and object.newsbox_date != object.newsbox_publication_start_date %} - <time class="event_date" datetime="{{ object.newsbox_date }}">{{ object.newsbox_date|date:'DATE_FORMAT' }}</time> + <time datetime="{{ object.newsbox_date }}">{{ object.newsbox_date|date:'DATE_FORMAT' }}</time> {% endif %} - <time class="publication_date" datetime="{{ object.newsbox_publication_start_date }}" pubdate="pubdate">{% blocktrans with date=object.newsbox_publication_start_date|date:'SHORT_DATE_FORMAT' %}published on {{ date }}{% endblocktrans %}</time> + <time datetime="{{ object.newsbox_publication_start_date }}" pubdate="pubdate">{% blocktrans with date=object.newsbox_publication_start_date|date:'SHORT_DATE_FORMAT' %}published on {{ date }}{% endblocktrans %}</time> {% endblock %} </header> - <div class="content"> + <div> {% block newsbox_detail_content %} {% if object.newsbox_body %} {{ object.newsbox_body|linebreaks }} diff --git a/newsbox/templates/newsbox/inc/list-item.html b/newsbox/templates/newsbox/inc/list-item.html index dcbbe23..c781534 100644 --- a/newsbox/templates/newsbox/inc/list-item.html +++ b/newsbox/templates/newsbox/inc/list-item.html @@ -1,25 +1,24 @@ {% load i18n %} -<article class="{{ object.is_published|yesno:',draft' }}"> +<article class="comp__content-item {{ object.is_published|yesno:',draft' }}"> <header> {% block newsbox_list_item_header %} <h2> <a href="{{ object.get_absolute_url }}"> - - {% if object.newsbox_date and object.newsbox_date != object.newsbox_publication_start_date %} - <time class="event_date" datetime="{{ object.newsbox_date }}">{{ object.newsbox_date|date:'SHORT_DATE_FORMAT' }}</time> - - {% endif %} {{ object.newsbox_title }} </a> + {% if object.newsbox_date and object.newsbox_date != object.newsbox_publication_start_date %} + <time datetime="{{ object.newsbox_date }}">{{ object.newsbox_date|date:'SHORT_DATE_FORMAT' }}</time> + {% endif %} </h2> - <time class="publication_date" datetime="{{ object.newsbox_publication_start_date }}" pubdate="pubdate">{% blocktrans with date=object.newsbox_publication_start_date|date:'SHORT_DATE_FORMAT' %}published on {{ date }}{% endblocktrans %}</time> + <time datetime="{{ object.newsbox_publication_start_date }}" pubdate="pubdate">{% blocktrans with date=object.newsbox_publication_start_date|date:'SHORT_DATE_FORMAT' %}published on {{ date }}{% endblocktrans %}</time> {% endblock %} </header> - <div class="content"> + <div> {% block newsbox_list_item_content %} {% if object.newsbox_summary %} {{ object.newsbox_summary|linebreaks }} - + {% if object.newsbox_body %} <a class="readmore" href="{{ object.get_absolute_url }}">{% trans "Read more" %}</a> {% endif %} @@ -27,4 +26,4 @@ {% endblock %} </div> -</article> \ No newline at end of file +</article> diff --git a/newsbox/templates/newsbox/inc/list.html b/newsbox/templates/newsbox/inc/list.html index e07dcc7..35c662c 100644 --- a/newsbox/templates/newsbox/inc/list.html +++ b/newsbox/templates/newsbox/inc/list.html @@ -1,6 +1,6 @@ {% if object_list|length > 0 %} {% load i18n %} - <section class="newsbox_list {{ model_opts.app_label }}_{{ model_opts.model_name }}"> + <section class="mod__content-list newsbox {{ model_opts.app_label }}-{{ model_opts.model_name }}"> {% block newsbox_list_header %} {% if title %} @@ -18,7 +18,7 @@ {% block newsbox_list_filters %} {% if date_list_period and date_list_period != 'year' or date_list|length > 1 %} - <ul class="date_list {{ date_list_period }}s_list"> + <ul class="comp__date-filter {{ date_list_period }}s-list"> {% if date_list_period == 'year' %} <li>{% trans "All dates" %}</li> {% else %} @@ -55,7 +55,7 @@ {% endblock newsbox_list_filters %} {% block newsbox_list %} - <div class="list"> + <div class="comp__content-list"> {% for object in object_list %} {% block newsbox_list_item %} @@ -63,28 +63,27 @@ {% endblock %} {% endfor %} + </div> - {% block newsbox_pager %} - {% if is_paginated and page_obj %} - <div class="pager"> - {% if page_obj.has_previous %} - <a class="prev" href="?page={{ page_obj.previous_page_number }}">{% trans "Previous news" %}</a> - {% endif %} - - <span class="current"> - {% blocktrans with page_obj.number as number and paginator.num_pages as total %}Page {{ number }} on {{ total }}{% endblocktrans %} - </span> + {% block newsbox_pager %} + {% if is_paginated and page_obj %} + <div class="comp__pager"> + {% if page_obj.has_previous %} + <a class="prev" href="?page={{ page_obj.previous_page_number }}">{% trans "Previous news" %}</a> + {% endif %} - {% if page_obj.has_next %} - <a class="next" href="?page={{ page_obj.next_page_number }}">{% trans "Next news" %}</a> - {% endif %} - </div> - {% elif all_news_url %} - <a class="readmore" href="{{ all_news_url }}">{% trans "See all news" %}</a> - {% endif %} - {% endblock %} + <span class="current"> + {% blocktrans with page_obj.number as number and paginator.num_pages as total %}Page {{ number }} on {{ total }}{% endblocktrans %} + </span> - </div> + {% if page_obj.has_next %} + <a class="next" href="?page={{ page_obj.next_page_number }}">{% trans "Next news" %}</a> + {% endif %} + </div> + {% elif all_news_url %} + <a class="readmore" href="{{ all_news_url }}">{% trans "See all news" %}</a> + {% endif %} + {% endblock %} {% endblock %} </section> {% else %} diff --git a/newsbox_cms/templates/newsbox_cms/inc/list.html b/newsbox_cms/templates/newsbox_cms/inc/list.html index 4db3661..d8966ff 100644 --- a/newsbox_cms/templates/newsbox_cms/inc/list.html +++ b/newsbox_cms/templates/newsbox_cms/inc/list.html @@ -16,8 +16,8 @@ <div class="summary"> {{ object.newsbox_summary|safe }} {% render_placeholder object.newsbox_body as body %} - {% if body %} - <a class="readmore" href="{{ object.get_absolute_url }}">{% trans "Read more" %}</a> - {% endif %} </div> + {% if body %} + <a class="readmore" href="{{ object.get_absolute_url }}">{% trans "Read more" %}</a> + {% endif %} {% endblock %} -- GitLab