nineskeletor/templates/Pagewidget/viewbookmark.html.twig

91 lines
4.8 KiB
Twig

{% set widgetname="bookmark" %}
{% extends 'Pagewidget/widget.twig' %}
{% block widgetaction %}
{% if canadd %}
<i class="fas fa-text-height" title="Changer taille des items" onClick="changeWidget({{ entity.id }},'modedesktop',{{modedesktop}})"></i>
{% endif %}
{% endblock %}
{% block widgetbody %}
<div class="items-list">
{% for bookmark in bookmarks %}
{% set havebookmark=true %}
{% if bookmark.item %}
{% set bookmarktitle = bookmark.item.title %}
{% set bookmarksubtitle = bookmark.item.subtitle %}
{% set bookmarkbackgroundcolor = bookmark.item.color ? bookmark.item.color : app.session.get('colorbgbodydark')|raw %}
{% set bookmarktarget = bookmark.item.target %}
{% set bookmarkurl = ( bookmark.item.protected and not app.user ? path("app_login") : bookmark.item.url|replace({'#login#': username}) ) %}
{% set bookmarkcontent = bookmark.item.content %}
{% set bookmarkicon = (bookmark.item.icon ? bookmark.item.icon.label : "icon/icon_pin.png") %}
{% else %}
{% set bookmarktitle = bookmark.title %}
{% set bookmarksubtitle = bookmark.subtitle %}
{% set bookmarkbackgroundcolor = bookmark.color ? bookmark.color : app.session.get('colorbgbodydark')|raw %}
{% set bookmarktarget = bookmark.target %}
{% set bookmarkurl = bookmark.url|replace({'#login#': username}) %}
{% set bookmarkcontent = null %}
{% set bookmarkicon = bookmark.icon ? bookmark.icon.label : "icon/icon_pin.png" %}
{% endif %}
<div class="item {{itemsize}}" style="background-color: {{ bookmarkbackgroundcolor }};" data-idcategory="bookmark" data-title="{{bookmarktitle|lower}}">
<div class="item-container">
<div class="item-content">
{% if bookmarktarget == 'frame' %}
<a class="item-link" onClick="showItemframe('bookmark{{ bookmark.id }}','{{ bookmarkurl }}')">
{% else %}
<a class="item-link" href="{{ bookmarkurl }}" target="{{bookmarktarget }}">
{% endif %}
<img height="35" src="{{ path('app_minio_image',{file:bookmarkicon}) }}">
<div class="item-title">
<h3 >{{ bookmarktitle }}</h3>
<div class="item-subtitle">{{ bookmarksubtitle|nl2br }}</div>
</div>
</a>
<div class="item-action">
{% if canadd %}
{% if bookmark.item %}
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},false)"><i class="item-heart fas fa-heart-crack"></i></a>
{% else %}
<a style="display:none" onClick="modBookmark({{ bookmark.id }},{{ entity.id }},false)"><i class="item-mod fas fa-file"></i></a>
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},false)"><i class="item-trash fas fa-trash"></i></a>
{% endif %}
{% endif %}
{% if bookmarkcontent %}
<a style="display:none"><i class="item-info fas fa-circle-info"></i></a>
{% endif %}
</div>
</div>
<div class="item-description hide">{{ bookmarkcontent|raw }}</div>
</div>
</div>
{% endfor %}
{% if canadd %}
<div class="item {{ itemsize }}" style="background-color: var(--colorbgbodydark);" data-idcategory="bookmark">
<div class="item-container">
<div class="item-content">
<a class="item-link" onClick="addBookmark({{ entity.id }},false)">
<img height="35" src="{{ path('app_minio_image',{file:"icon/icon_add.png"}) }}">
<div class="item-title">
<h3 >Ajouter</h3>
<div class="item-subtitle">Ajouter un Lien</div>
</div>
</a>
<div class="item-action">
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}