diff --git a/newsbox/templates/newsbox/inc/list-item.html b/newsbox/templates/newsbox/inc/list-item.html index b9021ec1b5840379f287e802e4d2a8a483d4fad7..f11f1026f5fb7caf8c7e63f8c6a3725ebf01560f 100644 --- a/newsbox/templates/newsbox/inc/list-item.html +++ b/newsbox/templates/newsbox/inc/list-item.html @@ -16,11 +16,13 @@ <div> {% block newsbox_list_item_content %} <div class="summary"> - {% if object.newsbox_summary %} - {{ object.newsbox_summary|linebreaks }} - {% else %} - {{ object.newsbox_body|truncatewords:50 }} - {% endif %} + {% with summary_max_words=summary_max_words|default:50 summary=summary|default:object.newsbox_summary|default:object.newsbox_body %} + {% if summary_max_words and summary_max_words != '0' %} + {{ summary_max_words }}{{ summary|truncatewords_html:summary_max_words }} + {% else %} + {{ summary }} + {% endif %} + {% endwith %} </div> {% block newsbox_list_item_content_extra %} diff --git a/newsbox_cms/templates/newsbox_cms/inc/list-item.html b/newsbox_cms/templates/newsbox_cms/inc/list-item.html index bcfe70504b8199224f8a8fb6947d208d39f3d424..a370a5b16db8d4405c239f42608a3a9927d9beb2 100644 --- a/newsbox_cms/templates/newsbox_cms/inc/list-item.html +++ b/newsbox_cms/templates/newsbox_cms/inc/list-item.html @@ -6,23 +6,22 @@ {{ block.super }} {% endblock %} -{% block newsbox_list_item_content %} - <div class="summary"> - {% if object.newsbox_summary %} - {{ object.newsbox_summary }} - {% render_placeholder object.newsbox_body as body %} - {% else %} - {{ body|truncatewords_html:50 }} + +{% block newsbox_list_item_content_extra %} + {% render_placeholder object.newsbox_body as body %} + {% with readmore=body %} + {% if not instance.placeholder %} + {{ block.super }} + {% elif readmore %} + <div class="extra"><a class="readmore" href="{{ object.get_absolute_url }}">{% trans "Read more" %}</a></div> {% endif %} - </div> + {% endwith %} +{% endblock newsbox_list_item_content_extra %} - {% block newsbox_list_item_content_extra %} - {% with readmore=body %} - {% if not instance.placeholder %} - {{ block.super }} - {% elif readmore %} - <div class="extra"><a class="readmore" href="{{ object.get_absolute_url }}">{% trans "Read more" %}</a></div> - {% endif %} - {% endwith %} - {% endblock newsbox_list_item_content_extra %} +{% block newsbox_list_item_content %} + {% render_placeholder object.newsbox_body as body %} + {% with summary=object.newsbox_summary|default:body summary_max_words=instance.placeholder|yesno:'50,0'%} + {{ block.super }} + {% endwith %} {% endblock %} +