mode liste

This commit is contained in:
afornerot 2019-08-30 11:51:18 +02:00
parent 9f7cfc6ad3
commit 82d8ee90ce
11 changed files with 185 additions and 62 deletions

View File

@ -397,8 +397,42 @@ a.item-heart {
.grid .grid-small .grid-item-title span { display: none } .grid .grid-small .grid-item-title span { display: none }
.grid .grid-list {
width:100%;
height:auto;
}
.grid .grid-list .item-link {
height:auto;
}
.grid .grid-list .grid-item-logo {
height:auto;
width:30px;
float:left;
padding: 0px;
margin: 10px
}
.grid .grid-list .grid-item-logo img {
height: 30px;
width: 30px;
margin: 0px;
}
.grid .grid-list .grid-item-title {
padding: 5px;
vertical-align: top;
font-size: 12px;
line-height: 1;
text-align:left;
width:auto;
position: absolute;
top: 0px;
}
.grid .grid-list .grid-item-title h2 { font-size:18px; border-bottom: none; line-height: 40px; height: 40px; overflow: hidden; margin:0px}
.grid .grid-list .grid-item-title span { display: none }
/* Grid Image */
.grid .grid-image { .grid .grid-image {
width:19.2%; width:19.2%;
height:auto; height:auto;
@ -425,7 +459,7 @@ a.item-heart {
.grid-gutter-sizer-image { width: 1% } .grid-gutter-sizer-image { width: 1% }
/* Preview */
.grid .grid-preview { .grid .grid-preview {
width:19.2%; width:19.2%;
min-width:220px; min-width:220px;
@ -433,20 +467,49 @@ a.item-heart {
text-align: left; text-align: left;
} }
.grid .grid-preview .caption { padding: 9px }
.grid .grid-preview-gutter-sizer { width: 1% }
.grid .grid-preview a:hover { .grid .grid-preview a:hover {
text-decoration: none; text-decoration: none;
} }
.grid .grid-preview .grid-preview-title { .grid .grid-preview .item-link {
margin:0px; height:auto;
font-size:20px;
text-align:left;
word-wrap: break-word;
} }
.grid .grid-preview .caption { padding: 9px } .grid .grid-preview .grid-item-logo {
display: block;
width:100%;
padding: 0px;
height: auto;
}
.grid .grid-preview .grid-item-logo img {
width: 100%;
margin: 0px;
}
.grid .grid-preview .grid-item-title {
margin:0px;
font-size:14px;
text-align:left;
word-wrap: break-word;
width: 100%;
display: block;
line-height: initial;
padding: 0px;
}
.grid .grid-preview .grid-item-title h2 {
border: none;
margin: 0px;
padding: 0px;
}
.grid .grid-preview .grid-item-title small {
margin-bottom: 10px;
}
.grid-gutter-sizer-preview { width: 1% }
@media (max-width: 991px) { @media (max-width: 991px) {
.grid .grid-preview { .grid .grid-preview {

View File

@ -435,7 +435,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setBorder(false); $entityWidget->setBorder(false);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]); $entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": [{"id": "modelist", "loc": "col1", "type": "modelist", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -614,7 +614,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setBorder(false); $entityWidget->setBorder(false);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]); $entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés (0 pour tout)", "value": "10", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés (0 pour tout)", "value": "10", "mandatory": "true"},{"id": "modelist", "loc": "col1", "type": "modelist", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);

View File

@ -818,7 +818,17 @@ class PagewidgetController extends Controller
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Récupération des paramétres du widget
$modelist=0;
foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) {
case "modelist":
$modelist=$parameter["value"];
break;
}
}
// Profilage // Profilage
$user=$this->getUser(); $user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); $roles=($user?$user->getRoles():["ROLE_ANONYME"]);
@ -1026,9 +1036,11 @@ class PagewidgetController extends Controller
return $this->render($this->labelentity.':viewflux.html.twig', [ return $this->render($this->labelentity.':viewflux.html.twig', [
'entity' => $entity, 'entity' => $entity,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'modelist' => $modelist,
'fluxs' => $fluxsordered, 'fluxs' => $fluxsordered,
'access' => $access, 'access' => $access,
'feeds' => $feeds, 'feeds' => $feeds,
]); ]);
} }
@ -1052,6 +1064,7 @@ class PagewidgetController extends Controller
// Récupération des paramétres du widget // Récupération des paramétres du widget
$url=""; $url="";
$nbarticle="_blank"; $nbarticle="_blank";
$modelist=0;
foreach($entity->getParameter()["fields"] as $parameter) { foreach($entity->getParameter()["fields"] as $parameter) {
switch($parameter["id"]) { switch($parameter["id"]) {
case "url": case "url":
@ -1059,9 +1072,12 @@ class PagewidgetController extends Controller
break; break;
case "nbarticle": case "nbarticle":
$nbarticle=$parameter["value"]; $nbarticle=$parameter["value"];
break; break;
case "modelist":
$modelist=$parameter["value"];
break;
} }
} }
// On regarde si le flux a été lu il y a peu // On regarde si le flux a été lu il y a peu
$toregen=true; $toregen=true;
@ -1220,6 +1236,7 @@ class PagewidgetController extends Controller
//'fluxs' => $fluxsordered, //'fluxs' => $fluxsordered,
'access' => $access, 'access' => $access,
'feeds' => $feeds, 'feeds' => $feeds,
'modelist' => $modelist,
]); ]);
} }

View File

@ -118,10 +118,23 @@ class PagewidgetType extends AbstractType
'label_attr' => ['loc' => $field->loc], 'label_attr' => ['loc' => $field->loc],
'data' => $field->value, 'data' => $field->value,
'required' => ($field->mandatory=="true"), 'required' => ($field->mandatory=="true"),
'choices' => array("Grand" => "0","Moyen" => "1", "Petit" => "2") 'choices' => array("Grand" => "0","Moyen" => "1", "Petit" => "2", "Liste" => "3")
]) ; ]) ;
} }
elseif($field->type=="modelist") {
$builder
->add($field->id, ChoiceType::class, [
'label' => $field->label,
'mapped'=> false,
'label_attr' => ['loc' => $field->loc],
'data' => $field->value,
'required' => ($field->mandatory=="true"),
'choices' => array("Pavet" => "0","Liste" => "1")
]) ;
}
elseif($field->type=="withbookmark") { elseif($field->type=="withbookmark") {
$builder $builder
->add($field->id, ChoiceType::class, [ ->add($field->id, ChoiceType::class, [

View File

@ -80,23 +80,30 @@
</ul> </ul>
</nav> </nav>
<div class="grid clearfix" style="margin-top:10px;"> <div class="grid clearfix">
{% for blogarticle in blogarticles %} {% for blogarticle in blogarticles %}
{% if loop.index==1 %} {% if loop.index==1 %}
<div class="grid-sizer grid-preview"></div> <div class="grid-sizer grid-preview"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-preview"></div> <div class="grid-gutter-sizer grid-preview-gutter-sizer"></div>
{% endif %} {% endif %}
<div class="grid-item grid-preview"> <div class="grid-item grid-preview">
<a href="{{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':blogarticle.id}) }}"> <div class="grid-item-content">
{% if blogarticle.image is not empty %} <a href="{{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':blogarticle.id}) }}">
<img src="/{{alias}}/{{blogarticle.image|replace({"/blogarticle/":"/blogarticle/thumb-"})}}" width="100%"> {% if blogarticle.image is not empty %}
{% endif %} <div class="grid-item-logo">
<div class="caption"> <img class="grid-item-img" src="/{{alias}}/{{blogarticle.image|replace({"/blogarticle/":"/blogarticle/thumb-"})}}" width="100%">
<h1 class="grid-preview-title">{{ blogarticle.name}}</h1> </div>
<small>publié par {{ blogarticle.user.username }} le {{ blogarticle.submit|date("d/m/Y à H:i") }}<br>dans le blog {{blogarticle.blog.name }}</small>
</div> {% endif %}
</a> <div class="caption">
<div class="grid-item-title">
<h2>{{blogarticle.name }}</h2>
<small>publié par {{ blogarticle.user.username }} le {{ blogarticle.submit|date("d/m/Y à H:i") }}<br>dans le blog {{blogarticle.blog.name }}</small>
</div>
</div>
</a>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -17,6 +17,8 @@
{% set stylegrid="grid-medium" %} {% set stylegrid="grid-medium" %}
{% elseif modedesktop==2 %} {% elseif modedesktop==2 %}
{% set stylegrid="grid-small" %} {% set stylegrid="grid-small" %}
{% elseif modedesktop==3 %}
{% set stylegrid="grid-list" %}
{% endif %} {% endif %}
{% set colorbodyfont = "" %} {% set colorbodyfont = "" %}

View File

@ -52,19 +52,26 @@
{% for blogarticle in blogarticles %} {% for blogarticle in blogarticles %}
{% if loop.index==1 %} {% if loop.index==1 %}
<div class="grid-sizer grid-preview"></div> <div class="grid-sizer grid-preview"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-preview"></div> <div class="grid-gutter-sizer grid-preview-gutter-sizer"></div>
{% endif %} {% endif %}
<div class="grid-item grid-preview" style="{{ stylewidgetbodyreverse }};"> <div class="grid-item grid-preview" style="{{ stylewidgetbodyreverse }};">
<a href onClick="showFrameitem('blog','{{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':blogarticle.id}) }}',true)"> <div class="grid-item-content">
{% if blogarticle.image is not empty %} <a href onClick="showFrameitem('blog','{{ path('cadoles_portal_'~access~'_blogarticle_view',{'id':blogarticle.id}) }}',true)">
<img src="/{{alias}}/{{blogarticle.image|replace({"/blogarticle/":"/blogarticle/thumb-"})}}" width="100%"> {% if blogarticle.image is not empty %}
{% endif %} <div class="grid-item-logo">
<div class="caption"> <img class="grid-item-img" src="/{{alias}}/{{blogarticle.image|replace({"/blogarticle/":"/blogarticle/thumb-"})}}" width="100%">
<h1 class="grid-preview-title" style="{{ stylewidgetbodyreverse }};">{{ blogarticle.name}}</h1> </div>
<small>publié par {{ blogarticle.user.username }} le {{ blogarticle.submit|date("d/m/Y à H:i") }}<br>dans le blog {{blogarticle.blog.name }}</small>
</div> {% endif %}
</a> <div class="caption" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-title" style="{{ stylewidgetbodyreverse }};">
<h2>{{blogarticle.name }}</h2>
<small>publié par {{ blogarticle.user.username }} le {{ blogarticle.submit|date("d/m/Y à H:i") }}<br>dans le blog {{blogarticle.blog.name }}</small>
</div>
</div>
</a>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -16,6 +16,8 @@
{% set stylegrid="grid-medium" %} {% set stylegrid="grid-medium" %}
{% elseif modedesktop==2 %} {% elseif modedesktop==2 %}
{% set stylegrid="grid-small" %} {% set stylegrid="grid-small" %}
{% elseif modedesktop==3 %}
{% set stylegrid="grid-list" %}
{% endif %} {% endif %}
{% set colorbodyfont = "" %} {% set colorbodyfont = "" %}
@ -48,7 +50,7 @@
</div> </div>
{% if bookmarks is not empty %} {% if bookmarks is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }} {% if not entity.border %} padding-top:10px; {% endif %}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="bookmark-container"> <div class="bookmark-container">
<div class="grid clearfix"> <div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div> <div class="grid-sizer {{ stylegrid }}"></div>

View File

@ -30,11 +30,11 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<style> {% if modelist==0 %}
{% set stylegrid="grid-preview" %}
{% elseif modelist==1 %}
{% set stylegrid="grid-list" %}
</style> {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
@ -56,7 +56,7 @@
{% set firstflux="" %} {% set firstflux="" %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }} ">
{% if fluxs is defined %} {% if fluxs is defined %}
{% if fluxs|length > 1 %} {% if fluxs|length > 1 %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">Tout</div> <div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">Tout</div>
@ -69,18 +69,14 @@
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }} color:#{{ color['fontcolorhover'] }};">{{ flux.title }}</div> <div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }} color:#{{ color['fontcolorhover'] }};">{{ flux.title }}</div>
{% endfor %} {% endfor %}
{% else %}
<p></p>
{% endif %} {% endif %}
{% else %}
<p></p>
{% endif %} {% endif %}
<div class="grid clearfix"> <div class="grid clearfix">
{% for feed in feeds %} {% for feed in feeds %}
{% if loop.index==1 %} {% if loop.index==1 %}
<div class="grid-sizer grid-preview"></div> <div class="grid-sizer {{stylegrid}}"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-preview"></div> <div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div>
{% endif %} {% endif %}
@ -93,18 +89,30 @@
{% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %} {% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %}
{% endif %} {% endif %}
<div class="grid-item grid-preview feed flux-{{ feed.fluxid }}"> <div class="grid-item {{ stylegrid }} feed flux-{{ feed.fluxid }}">
<a class="linktosonde" data-sonde="Flux = {{ feed.fluxtitle }}" href="{{ feed.link }}" target="_blank"> <div class="grid-item-content" style="{{ stylecolor }};">
{% if feed.image is not empty %} <a class="linktosonde" data-sonde="Flux = {{ feed.fluxtitle }}" href="{{ feed.link }}" target="_blank">
<img src="{{feed.image}}" width="100%"> <div class="item-link clearfix">
{% endif %} {% if feed.image is not empty %}
<div class="caption" style="{{ stylecolor }}"> <div class="grid-item-logo">
<h1 class="grid-preview-title" style="{{ stylecolor }};padding:0px;">{{ feed.title }}</h1> <img class="grid-item-img" src="{{feed.image}}" width="100%">
<small>le {{ feed.date|date("d/m/Y à H:i") }}</small><br> </div>
{{ feed.description | nl2br }} {% endif %}
</div>
</a> <div class="caption" style="{{ stylecolor }};">
<div class="grid-item-title">
<h2>{{ feed.title }}</h2>
{% if modelist==0 %}
<small>le {{ feed.date|date("d/m/Y à H:i") }}</small><br>
{{ feed.description | nl2br }}
{% endif %}
</div>
</div>
</div>
</a>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

View File

@ -18,6 +18,8 @@
{% set stylegrid="grid-medium" %} {% set stylegrid="grid-medium" %}
{% elseif modedesktop==2 %} {% elseif modedesktop==2 %}
{% set stylegrid="grid-small" %} {% set stylegrid="grid-small" %}
{% elseif modedesktop==3 %}
{% set stylegrid="grid-list" %}
{% endif %} {% endif %}
{% set colorbodyfont = "" %} {% set colorbodyfont = "" %}
@ -93,7 +95,7 @@
{% endif %} {% endif %}
<div class="grid clearfix"> <div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}" data-idcategory="bookmark"></div> <div class="grid-sizer {{ stylegrid }}" data-idcategory="bookmark"></div>
<div class="grid-gutter-sizer"></div> <div class="grid-gutter-sizer {{ stylegrid }}-gutter-sizer"></div>
{% for bookmark in bookmarks %} {% for bookmark in bookmarks %}
<div class="grid-item {{ stylegrid }}" data-idcategory="bookmark" data-title="{{ bookmark.title|lower }}"> <div class="grid-item {{ stylegrid }}" data-idcategory="bookmark" data-title="{{ bookmark.title|lower }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};"> <div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
@ -110,9 +112,9 @@
<div class="item-link clearfix"> <div class="item-link clearfix">
<div class="grid-item-logo"> <div class="grid-item-logo">
{% if bookmark.icon %} {% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}"> <img class="grid-item-img" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %} {% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png"> <img class="grid-item-img" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %} {% endif %}
</div> </div>

View File

@ -17,6 +17,8 @@
{% set stylegrid="grid-medium" %} {% set stylegrid="grid-medium" %}
{% elseif modedesktop==2 %} {% elseif modedesktop==2 %}
{% set stylegrid="grid-small" %} {% set stylegrid="grid-small" %}
{% elseif modedesktop==3 %}
{% set stylegrid="grid-list" %}
{% endif %} {% endif %}
{% set colorbodyfont = "" %} {% set colorbodyfont = "" %}