From fa287477c6333ff485a5e8e183572a160beb1915 Mon Sep 17 00:00:00 2001 From: afornerot Date: Fri, 17 Apr 2020 17:21:40 +0200 Subject: [PATCH] select icon dans frame + widget info comme les autres (ref #120) --- .../Resources/views/Group/edit.html.twig | 87 +++++++------------ .../Controller/IconController.php | 43 +++++++-- .../PortalBundle/Resources/config/routing.yml | 8 ++ .../Resources/views/Icon/edit.html.twig | 20 +++-- .../Resources/views/Icon/list.html.twig | 15 +++- .../Resources/views/Icon/select.html.twig | 32 +++++++ .../views/Pagewidget/viewinfo.html.twig | 21 +++-- 7 files changed, 139 insertions(+), 87 deletions(-) create mode 100644 src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/select.html.twig diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig index cf297b66..13f492b6 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/edit.html.twig @@ -89,20 +89,6 @@ {% endif %} -
- {% if group.icon %} - - {% endif %} -
- -
- {{ form_row(form.idicon) }} - Selectionner un Icône - Détacher l'Icône -
- - -
{% if form.fgcancreatepage is defined %}
@@ -123,7 +109,24 @@ {{ form_widget(form.fgcancreateproject) }}
- + {% endif %} +
+ +
+
+ {% if group.icon %} + + {% endif %} +
+ +
+ {{ form_row(form.idicon) }} + Selectionner un Icône + Détacher l'Icône +
+
+ + {% if form.fgcancreatepage is defined %}
Elements du Portail @@ -143,46 +146,6 @@ {% endif %}
- - {{ form_end(form) }} {% endblock %} @@ -245,13 +208,21 @@ hideshow(); }); - function selIcon(idicon) { + function selIcon(idicon,label) { $("#group_idicon").val(idicon); $("#diviconsel img").remove(); - $("#icon-"+idicon).clone().appendTo($("#diviconsel")); + url="/{{ alias }}/"+label; + $("#diviconsel").append(""); $("#diviconsel img").attr("height","100px"); - $('#selicon').modal('hide'); + $("#mymodal").modal("hide"); + } + + function selectIcon() { + $("#mymodal").find(".modal-title").html("SELECTIONNER UN ICONE"); + var url="{{ path('cadoles_portal_user_icon_select') }}"; + $("#mymodal").find("#framemodal").attr("src",url); + $("#mymodal").modal("show"); } function delIcon() { diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/IconController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/IconController.php index 8bf0b316..3ef5ba5a 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/IconController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/IconController.php @@ -19,8 +19,10 @@ class IconController extends Controller private $labeldata = 'icon'; private $labeldatas = 'icons'; - public function listAction($access="config") + public function listAction(Request $request,$access="config") { + $inframe=$request->get("inframe"); + $em = $this->getDoctrine()->getManager(); if($access=="config") $icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]); @@ -28,16 +30,19 @@ class IconController extends Controller $icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]); return $this->render($this->labelentity.':list.html.twig',[ - 'useheader' => true, + 'useheader' => !($inframe), 'usemenu' => false, 'usesidebar' => ($access=="config"), 'access' => $access, - $this->labeldatas => $icons + $this->labeldatas => $icons, + 'inframe' => $inframe ]); } public function submitAction(Request $request,$access="config") { + $inframe=$request->get("inframe"); + // Initialisation de l'enregistrement $data = new Icon(); @@ -62,23 +67,26 @@ class IconController extends Controller $em->flush(); // Retour à la liste - return $this->redirectToRoute('cadoles_portal_'.$access.'_icon'); + return $this->redirectToRoute('cadoles_portal_'.$access.'_icon',['inframe'=>$inframe]); } // Affichage du formulaire return $this->render($this->labelentity.':edit.html.twig', [ - 'useheader' => true, + 'useheader' => !($inframe), 'usemenu' => false, 'usesidebar' => ($access=="config"), 'access' => $access, $this->labeldata => $data, 'mode' => 'submit', 'form' => $form->createView(), + 'inframe' => $inframe, ]); } public function updateAction($id,Request $request,$access="config") { + $inframe=$request->get("inframe"); + // Récupération de l'enregistrement courant $data=$this->getData($id); @@ -103,13 +111,13 @@ class IconController extends Controller $em->flush(); // Retour à la liste - return $this->redirectToRoute('cadoles_portal_'.$access.'_icon'); + return $this->redirectToRoute('cadoles_portal_'.$access.'_icon',['inframe'=>$inframe]); } // Affichage du formulaire return $this->render($this->labelentity.':edit.html.twig', [ - 'useheader' => true, + 'useheader' => !($inframe), 'usemenu' => false, 'usesidebar' => ($access=="config"), 'access' => $access, @@ -117,11 +125,14 @@ class IconController extends Controller 'mode' => 'update', 'form' => $form->createView(), 'refresh' => false, + 'inframe' => $inframe ]); } public function deleteAction($id,Request $request,$access="config") { + $inframe=$request->get("inframe"); + // Récupération de l'enregistrement courant $data=$this->getData($id); @@ -132,9 +143,25 @@ class IconController extends Controller $em->remove($data); $em->flush(); - return $this->redirectToRoute('cadoles_portal_'.$access.'_icon'); + return $this->redirectToRoute('cadoles_portal_'.$access.'_icon',['inframe'=>$inframe]); } + public function selectAction($access="config") { + // Affichage du formulaire + $icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]); + $iconsuser=null; + if($access=="user") $iconsuser=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]); + + return $this->render($this->labelentity.':select.html.twig',[ + 'useheader' => false, + 'usemenu' => false, + 'usesidebar' => false, + 'access' => $access, + $this->labeldatas => $icons, + 'iconsuser' => $iconsuser + ]); + + } public function iconAction() { diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml index d5a07897..b1f73f56 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml @@ -59,6 +59,10 @@ cadoles_portal_config_icon_delete: path: /config/icon/delete/{id} defaults: { _controller: CadolesPortalBundle:Icon:delete, access: config } +cadoles_portal_config_icon_select: + path: /config/icon/select + defaults: { _controller: CadolesPortalBundle:Icon:select, access: config } + cadoles_portal_config_icon_icon: path: /config/icon/icon defaults: { _controller: CadolesPortalBundle:Icon:icon, access: config } @@ -79,6 +83,10 @@ cadoles_portal_user_icon_delete: path: /user/icon/delete/{id} defaults: { _controller: CadolesPortalBundle:Icon:delete, access: user } +cadoles_portal_user_icon_select: + path: /user/icon/select + defaults: { _controller: CadolesPortalBundle:Icon:select, access: user } + cadoles_portal_user_icon_icon: path: /user/icon/icon defaults: { _controller: CadolesPortalBundle:Icon:icon, access: user } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig index e2fcce3b..1a4fead2 100755 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/edit.html.twig @@ -2,18 +2,20 @@ {% block pagewrapper %} {{ form_start(form) }} -

- {% if mode=="update" %} - Modification Icône - {% elseif mode=="submit" %} - Création Icône - {% endif %} -

+ {% if not inframe %} +

+ {% if mode=="update" %} + Modification Icône + {% elseif mode=="submit" %} + Création Icône + {% endif %} +

+ {%endif%} {{ form_widget(form.submit) }} - Annuler + Annuler {% if mode=="update" %} - diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig index 0bf0f0e1..ac84dc92 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/list.html.twig @@ -1,13 +1,20 @@ {% extends '@CadolesCore/base.html.twig' %} {% block pagewrapper %} -

Gestion des Icônes

+ {% if not inframe %} +

Gestion des Icônes

+ {% endif %} + +

+ Ajouter + {% if inframe %} + Fermer + {% endif %} +

-

Ajouter

-
{% for icon in icons %} - + {% endfor %}
{% endblock %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/select.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/select.html.twig new file mode 100644 index 00000000..3a5bbdcd --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Icon/select.html.twig @@ -0,0 +1,32 @@ +{% extends '@CadolesCore/base.html.twig' %} + +{% block pagewrapper %} +
+
+ Fermer + {% if access=="user" %} + Gérer mes Icônes + {% endif %} +
+ +
+ {% if iconsuser is not empty %} +

Mes Icônes

+ {% for icon in iconsuser %} + + + + {% endfor %} + +

Icônes Communs

+ {% endif %} + {% for icon in icons %} + + + + {% endfor %} +
+
+{% endblock %} + + diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig index 50d233dc..c398d35a 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewinfo.html.twig @@ -28,22 +28,27 @@
{% endif %} -
+
+ {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
+ +
+ {% set style = "margin: auto; display: inherit;background-color:transparent;" %} {% if icon %} {% else %} {% endif %} -
- - -
- -
+
{%if usage=="group" %}Groupe
{% endif %} - {{ title }}

+ {{ title }}
{{ description | raw }} {%if usage=="group" %}