2021-12-21 13:31:39 +01:00
|
|
|
{% macro escapeText(text, dangerouslyDisableAutoEscaping=false) %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{% if dangerouslyDisableAutoEscaping -%}
|
|
|
|
{{ text | safe }}
|
|
|
|
{%- else -%}
|
|
|
|
{{ text }}
|
|
|
|
{%- endif %}
|
2021-12-21 13:31:39 +01:00
|
|
|
{% endmacro %}
|
2022-01-22 23:34:57 +01:00
|
|
|
{% macro escapeTitle(title, url, dangerouslyDisableAutoEscaping=false, showTitleAsUrl=false) %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{% if dangerouslyDisableAutoEscaping %}
|
|
|
|
{% if showTitleAsUrl %}
|
|
|
|
<a href="{{ url }}"
|
|
|
|
style="text-decoration:none;
|
|
|
|
color:#ffffff"
|
|
|
|
target="_blank">{{ title | safe }}</a>
|
|
|
|
{% else %}
|
|
|
|
{{ title | safe }}
|
|
|
|
{% endif %}
|
2022-01-22 23:34:57 +01:00
|
|
|
{% else %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{% if showTitleAsUrl %}
|
|
|
|
<a href="{{ url }}"
|
|
|
|
style="text-decoration:none;
|
|
|
|
color:#ffffff"
|
|
|
|
target="_blank">{{ title }}</a>
|
|
|
|
{% else %}
|
|
|
|
{{ title }}
|
|
|
|
{% endif %}
|
2022-01-22 23:34:57 +01:00
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
2021-01-16 13:37:18 +01:00
|
|
|
{% if loaded %}
|
2021-06-03 11:40:18 +02:00
|
|
|
{% if config.showAsList %}
|
|
|
|
<ul class="newsfeed-list">
|
|
|
|
{% for item in items %}
|
|
|
|
<li>
|
2021-06-03 12:38:54 +02:00
|
|
|
{% if (config.showSourceTitle and item.sourceTitle) or config.showPublishDate %}
|
|
|
|
<div class="newsfeed-source light small dimmed">
|
|
|
|
{% if item.sourceTitle and config.showSourceTitle %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{{ item.sourceTitle }}{% if config.showPublishDate %}, {% else %}:{% endif %}
|
2021-06-03 12:38:54 +02:00
|
|
|
{% endif %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{% if config.showPublishDate %}{{ item.publishDate }}:{% endif %}
|
2021-06-03 12:38:54 +02:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
2022-01-22 23:34:57 +01:00
|
|
|
{{ escapeTitle(item.title, item.url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}
|
2021-06-03 12:38:54 +02:00
|
|
|
</div>
|
|
|
|
{% if config.showDescription %}
|
|
|
|
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
|
|
|
{% if config.truncDescription %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{{ escapeText(item.description | truncate(config.lengthDescription) , config.dangerouslyDisableAutoEscaping) }}
|
2021-06-03 12:38:54 +02:00
|
|
|
{% else %}
|
2021-12-21 13:31:39 +01:00
|
|
|
{{ escapeText(item.description, config.dangerouslyDisableAutoEscaping) }}
|
2021-06-03 12:38:54 +02:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-06-03 12:27:26 +02:00
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% else %}
|
2021-06-03 12:38:54 +02:00
|
|
|
<div>
|
|
|
|
{% if (config.showSourceTitle and sourceTitle) or config.showPublishDate %}
|
|
|
|
<div class="newsfeed-source light small dimmed">
|
|
|
|
{% if sourceTitle and config.showSourceTitle %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{{ escapeText(sourceTitle, config.dangerouslyDisableAutoEscaping) }}{% if config.showPublishDate %}, {% else %}:{% endif %}
|
2021-06-03 12:38:54 +02:00
|
|
|
{% endif %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{% if config.showPublishDate %}{{ publishDate }}:{% endif %}
|
2021-06-03 12:38:54 +02:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
2022-01-22 23:34:57 +01:00
|
|
|
{{ escapeTitle(title, url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}
|
2021-06-03 11:40:18 +02:00
|
|
|
</div>
|
2021-06-03 12:38:54 +02:00
|
|
|
{% if config.showDescription %}
|
|
|
|
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
|
|
|
{% if config.truncDescription %}
|
2023-09-02 22:18:57 +02:00
|
|
|
{{ escapeText(description | truncate(config.lengthDescription) , config.dangerouslyDisableAutoEscaping) }}
|
2021-06-03 12:38:54 +02:00
|
|
|
{% else %}
|
2021-12-21 13:31:39 +01:00
|
|
|
{{ escapeText(description, config.dangerouslyDisableAutoEscaping) }}
|
2021-06-03 12:38:54 +02:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-01-16 13:37:18 +01:00
|
|
|
</div>
|
2021-06-03 11:40:18 +02:00
|
|
|
{% endif %}
|
2021-12-20 13:29:56 +01:00
|
|
|
{% elseif empty %}
|
2023-09-02 22:18:57 +02:00
|
|
|
<div class="small dimmed">{{ "NEWSFEED_NO_ITEMS" | translate | safe }}</div>
|
2021-03-16 13:47:48 +01:00
|
|
|
{% elseif error %}
|
|
|
|
<div class="small dimmed">
|
2021-03-16 19:16:07 +01:00
|
|
|
{{ "MODULE_CONFIG_ERROR" | translate({MODULE_NAME: "Newsfeed", ERROR: error}) | safe }}
|
2021-03-16 13:47:48 +01:00
|
|
|
</div>
|
2021-01-16 13:37:18 +01:00
|
|
|
{% else %}
|
2023-09-02 22:18:57 +02:00
|
|
|
<div class="small dimmed">{{ "LOADING" | translate | safe }}</div>
|
2021-03-16 13:47:48 +01:00
|
|
|
{% endif %}
|