nineskeletor/templates/Pagewidget/viewitem.html.twig

264 lines
13 KiB
Twig
Raw Normal View History

2023-01-12 16:14:31 +01:00
<style>
.widget{
margin-bottom:30px;
}
.widget-bordered {
border:1px solid;
}
.widget-menu {
float: right;
color: #fff;
margin: 10px 5px 0px 0px;
display:none;
}
.widget-menu i {
cursor:pointer;
}
.widget-header {
padding:10px;
font-family: var(--fonttitle);
}
.widget-logo {
height:30px;
margin-right:5px;
}
.widget-body {
padding: 5px 0px 0px 0px;
}
.widget-bordered .widget-body {
padding: 5px;
}
.cat-list {
color: var(--colorfttitledark);
background-color: var(--colorbgbodydark);
padding: 5px 10px;
display: inline-block;
cursor: pointer;
}
</style>
{% set widgethaveheader=entity.viewheader %}
{% set widgetname="item" %}
{%if widgethaveheader %}
{% set widgetstyle=(entity.colorheaderback ? "border-color:"~entity.colorheaderback~";" : "border-color:var(--colorbgbodydark);") %}
{% set widgetstylemenu=(entity.colorheaderback ? "background-color:"~entity.colorheaderback~";" : "background-color:var(--colorbgbodydark);")~(entity.colorheaderfont ? "color:"~entity.colorheaderfont~";" : "color:var(--colorfttitledark);") %}
{%else%}
{% set widgetstyle=(entity.colorbodyback ? "border-color:"~entity.colorbodyback~";" : "border-color:var(--colorbgbodydark);") %}
{% set widgetstylemenu="background-color:var(--colorbgbodydark); color: var(--colorfttitledark); padding:10px; border-radius: 5px;" %}
{%endif%}
{% set widgetstyleheader=(entity.colorheaderback ? "background-color:"~entity.colorheaderback~";" : "background-color:var(--colorbgbodydark);")~(entity.colorheaderfont ? "color:"~entity.colorheaderfont~";" : "color:var(--colorfttitledark);") %}
{% set widgetstylebody=(entity.colorbodyback ? "background-color:"~entity.colorbodyback~";" : "background-color:var(--colorbgbodylight);")~(entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);") %}
{% set widgeicon= entity.icon ? path('app_minio_image',{file:entity.icon.label}) : path('app_minio_image',{file:"icon/icon_pin.png"}) %}
{% if modedesktop==0 %}
{% set itemsize="item-verysmall" %}
{% elseif modedesktop==1 %}
{% set itemsize="item-small" %}
{% elseif modedesktop==2 %}
{% set itemsize="item-medium" %}
{% elseif modedesktop==3 %}
{% set itemsize="item-large" %}
{% elseif modedesktop==4 %}
{% set itemsize="item-list" %}
{% endif %}
{% if app.user %}
{% set username = app.user.username %}
{% else %}
{% set username = "" %}
{% endif %}
{% set colorbodyfont = "" %}
{% if entity.colorbodyfont is not null %}
{% set colorbodyfont = "color: #" ~ entity.colorbodyfont %}
{% endif %}
<div class="widget widget-{{widgetname}} {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} " data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ widgetstyle }}" height="{{ entity.height }}px">
<div class="widget-menu" style="{{ widgetstylemenu }}">
{% if canadd %}
<i class="fas fa-text-height" title="Changer taille des items" onClick="changeWidget({{ entity.id }},'modedesktop',{{modedesktop}})"></i>
{% endif %}
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" ></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})"></i>
{% endif %}
{% if canadd and access!="admin"%}
<i class="fa fa-plus fa-fw" title="Ajouter un Favori" onClick="addBookmark({{ entity.id }},true)" ></i>
{% endif %}
</div>
{%if widgethaveheader %}
<div class="widget-header" style="{{ widgetstyleheader }}">
<img class="widget-logo" src="{{widgeicon}}" />
<span class="widget-title">{{ entity.name }}</span>
</div>
{%endif%}
<div class="widget-body" style="{{ widgetstylebody }};">
{% set havemenu=false %}
{% set havebookmark=false %}
{% if menu and withbookmark!= 2 and bookmarks is not empty and itemcategorys|length > 1 %}
{% set havemenu=true %}
<div style="margin-bottom: 5px;">
{% if menuall %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},'all')">Tout</div>
{% endif %}
{% if bookmarks is not empty %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},'fav')"><i class="fa fa-heart"></i></div>
{% endif %}
{% for itemcategory in itemcategorys %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},{{itemcategory.id}})">{{itemcategory.label}}</div>
{% endfor %}
</div>
{% endif %}
{% if search %}
{% set havemenu=true %}
<div class="input-group" style="margin-bottom: 5px;">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-search"></i>&nbsp;</span>
</div>
<input id="itemsearch" onKeyup="searchItem({{ entity.id}},$(this).val());" type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
</div>
{% endif %}
{% if (bookmarks is not empty or canadd ) and (withbookmark==0 or withbookmark==2) %}
{% if withbookmark==0 and itemcategorys|length > 1 %}
<h3 class="itemcategory-title {{not havemenu ? "mt-1" : "mt-3"}} mb-0" style="{{ entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);"}}" data-idcategory="bookmark">Favoris</h3>
{% endif %}
<div class="items-list" style="margin-top:-5px">
{% 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 = bookmark.content %}
{% 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 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 }},true)">
<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 Favoris</div>
</div>
</a>
<div class="item-action">
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}
{% for itemcategory in itemcategorys %}
{% if itemcategorys|length > 1 or havebookmark %} <h3 class="itemcategory-title {{loop.first and not havemenu ? "mt-1" : "mt-3"}} mb-0" style="{{ entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);"}}" data-idcategory="{{itemcategory.id}}">{{itemcategory.label}}</h3> {% endif %}
<div class="items-list" style="margin-top:-5px">
{% for item in items %}
{% if item.itemcategory==itemcategory %}
<div class="item {{itemsize}}" style="background-color: {{ item.color ? item.color : "var(--colorbgbodydark)" }};" data-idcategory="{{item.itemcategory.id}}" data-title="{{item.title|lower}}">
<div class="item-container">
<div class="item-content">
{% set url=item.url|replace({'#login#': username}) %}
{% if item.protected and not app.user %}
{% set url=path('app_login') %}
{% endif %}
{% if item.target == 'frame' %}
<a class="item-link" onClick="showItemframe({{ item.id }},'{{ url }}')">
{% else %}
<a class="item-link" href="{{ url }}" target="{{ item.target }}">
{% endif %}
{% if item.icon %}
<img height="35" src="{{ path('app_minio_image',{file:item.icon.label}) }}">
{% else %}
<img height="35" src="{{ path('app_minio_image',{file:"icon/icon_pin.png"}) }}">
{% endif %}
<div class="item-title">
<h3 >{{ item.title }}</h3>
<div class="item-subtitle">{{ item.subtitle|nl2br }}</div>
</div>
</a>
<div class="item-action">
{% if canadd %}
<a style="display:none" onClick="heartBookmark({{ item.id }})"><i class="item-heart fa fa-heart"></i></a></a>
{% endif %}
{% if item.content %}
<a style="display:none"><i class="item-info fas fa-circle-info"></i></a>
{% endif %}
</div>
</div>
<div class="item-description hide">{{ item.content|raw }}</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</div>