From 82d8ee90cea9b7d63c1ea70b7761f1cdf88078e7 Mon Sep 17 00:00:00 2001 From: afornerot Date: Fri, 30 Aug 2019 11:51:18 +0200 Subject: [PATCH] mode liste --- .../CoreBundle/Resources/public/css/style.css | 79 +++++++++++++++++-- .../PortalBundle/Command/InitDataCommand.php | 4 +- .../Controller/PagewidgetController.php | 23 +++++- .../PortalBundle/Form/PagewidgetType.php | 15 +++- .../Resources/views/Blog/view.html.twig | 29 ++++--- .../Pagewidget/viewappexternal.html.twig | 2 + .../views/Pagewidget/viewblog.html.twig | 27 ++++--- .../views/Pagewidget/viewbookmark.html.twig | 4 +- .../views/Pagewidget/viewflux.html.twig | 54 +++++++------ .../views/Pagewidget/viewitem.html.twig | 8 +- .../Pagewidget/viewitemessential.html.twig | 2 + 11 files changed, 185 insertions(+), 62 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css index 172492c5..ea3b38a1 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/css/style.css @@ -397,8 +397,42 @@ a.item-heart { .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 { width:19.2%; height:auto; @@ -425,7 +459,7 @@ a.item-heart { .grid-gutter-sizer-image { width: 1% } - +/* Preview */ .grid .grid-preview { width:19.2%; min-width:220px; @@ -433,20 +467,49 @@ a.item-heart { text-align: left; } +.grid .grid-preview .caption { padding: 9px } +.grid .grid-preview-gutter-sizer { width: 1% } + .grid .grid-preview a:hover { text-decoration: none; } -.grid .grid-preview .grid-preview-title { - margin:0px; - font-size:20px; - text-align:left; - word-wrap: break-word; +.grid .grid-preview .item-link { + height:auto; } -.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) { .grid .grid-preview { diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php index 4f91fa94..2299e5ed 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -435,7 +435,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setBorder(false); $entityWidget->setOpened(true); $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); $em->persist($entityWidget); @@ -614,7 +614,7 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setBorder(false); $entityWidget->setOpened(true); $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); $em->persist($entityWidget); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php index 5b134a13..3a313dc9 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php @@ -818,7 +818,17 @@ class PagewidgetController extends Controller $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); 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 $user=$this->getUser(); $roles=($user?$user->getRoles():["ROLE_ANONYME"]); @@ -1026,9 +1036,11 @@ class PagewidgetController extends Controller return $this->render($this->labelentity.':viewflux.html.twig', [ 'entity' => $entity, 'canupdate' => $canupdate, + 'modelist' => $modelist, 'fluxs' => $fluxsordered, 'access' => $access, 'feeds' => $feeds, + ]); } @@ -1052,6 +1064,7 @@ class PagewidgetController extends Controller // Récupération des paramétres du widget $url=""; $nbarticle="_blank"; + $modelist=0; foreach($entity->getParameter()["fields"] as $parameter) { switch($parameter["id"]) { case "url": @@ -1059,9 +1072,12 @@ class PagewidgetController extends Controller break; case "nbarticle": $nbarticle=$parameter["value"]; - break; + break; + case "modelist": + $modelist=$parameter["value"]; + break; } - } + } // On regarde si le flux a été lu il y a peu $toregen=true; @@ -1220,6 +1236,7 @@ class PagewidgetController extends Controller //'fluxs' => $fluxsordered, 'access' => $access, 'feeds' => $feeds, + 'modelist' => $modelist, ]); } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagewidgetType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagewidgetType.php index 45507562..1bbd1d6e 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagewidgetType.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/PagewidgetType.php @@ -118,10 +118,23 @@ class PagewidgetType extends AbstractType 'label_attr' => ['loc' => $field->loc], 'data' => $field->value, '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") { $builder ->add($field->id, ChoiceType::class, [ diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig index 108857dc..25777bf5 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig @@ -80,23 +80,30 @@ -
+ diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig index 39cc5c10..3c1a3710 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewappexternal.html.twig @@ -17,6 +17,8 @@ {% set stylegrid="grid-medium" %} {% elseif modedesktop==2 %} {% set stylegrid="grid-small" %} +{% elseif modedesktop==3 %} + {% set stylegrid="grid-list" %} {% endif %} {% set colorbodyfont = "" %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig index 77db3873..6b700887 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewblog.html.twig @@ -52,19 +52,26 @@ {% for blogarticle in blogarticles %} {% if loop.index==1 %}
-
+
{% endif %} {% endfor %}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig index 32083649..86369dd3 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewbookmark.html.twig @@ -16,6 +16,8 @@ {% set stylegrid="grid-medium" %} {% elseif modedesktop==2 %} {% set stylegrid="grid-small" %} +{% elseif modedesktop==3 %} + {% set stylegrid="grid-list" %} {% endif %} {% set colorbodyfont = "" %} @@ -48,7 +50,7 @@ {% if bookmarks is not empty %} -
+
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig index 69b9202f..ea8444d5 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig @@ -30,11 +30,11 @@ {% endif %} {% endif %} - +{% if modelist==0 %} + {% set stylegrid="grid-preview" %} +{% elseif modelist==1 %} + {% set stylegrid="grid-list" %} +{% endif %}
{% if canupdate %} @@ -56,7 +56,7 @@ {% set firstflux="" %} -
+
{% if fluxs is defined %} {% if fluxs|length > 1 %}
Tout
@@ -69,18 +69,14 @@
{{ flux.title }}
{% endfor %} - {% else %} -

{% endif %} - {% else %} -

{% endif %}
{% for feed in feeds %} {% if loop.index==1 %} -
-
+
+
{% endif %} @@ -93,18 +89,30 @@ {% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %} {% endif %} -
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig index 6af724c4..4e11468e 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewitem.html.twig @@ -18,6 +18,8 @@ {% set stylegrid="grid-medium" %} {% elseif modedesktop==2 %} {% set stylegrid="grid-small" %} +{% elseif modedesktop==3 %} + {% set stylegrid="grid-list" %} {% endif %} {% set colorbodyfont = "" %} @@ -93,7 +95,7 @@ {% endif %}
-
+
{% for bookmark in bookmarks %}
@@ -110,9 +112,9 @@