From 76f7bffd8f01df93d16f2944b06ff7477b48158f Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Wed, 10 Jan 2018 17:07:11 +0100 Subject: [PATCH] finished home contents, created edlp_fils custom module --- .../figli/edlp_fils/edlp_fils.info.yml | 14 +++++ .../modules/figli/edlp_fils/edlp_fils.module | 8 +++ .../figli/edlp_fils/edlp_fils.routing.yml | 23 +++++++ .../src/Controller/FilsController.php | 44 +++++++++++++ .../all/modules/figli/edlp_home/edlp_home.inc | 63 +++++++++++++++++-- .../edlp_productions.routing.yml | 4 +- .../templates/content/edlp-home.html.twig | 16 +++-- 7 files changed, 160 insertions(+), 12 deletions(-) create mode 100644 sites/all/modules/figli/edlp_fils/edlp_fils.info.yml create mode 100644 sites/all/modules/figli/edlp_fils/edlp_fils.module create mode 100644 sites/all/modules/figli/edlp_fils/edlp_fils.routing.yml create mode 100644 sites/all/modules/figli/edlp_fils/src/Controller/FilsController.php diff --git a/sites/all/modules/figli/edlp_fils/edlp_fils.info.yml b/sites/all/modules/figli/edlp_fils/edlp_fils.info.yml new file mode 100644 index 000000000..3d824fb1b --- /dev/null +++ b/sites/all/modules/figli/edlp_fils/edlp_fils.info.yml @@ -0,0 +1,14 @@ +# @Author: Bachir Soussi Chiadmi +# @Date: 13-12-2017 +# @Email: bachir@figureslibres.io +# @Filename: edlp_fils.info.yml +# @Last modified by: bach +# @Last modified time: 20-12-2017 +# @License: GPL-V3 + + +name: Edlp Fils +type: module +description: Manage fils for edlp d8. +core: 8.x +package: Edlp diff --git a/sites/all/modules/figli/edlp_fils/edlp_fils.module b/sites/all/modules/figli/edlp_fils/edlp_fils.module new file mode 100644 index 000000000..f3f64d17d --- /dev/null +++ b/sites/all/modules/figli/edlp_fils/edlp_fils.module @@ -0,0 +1,8 @@ + +# @Date: 13-12-2017 +# @Email: bachir@figureslibres.io +# @Filename: edlp_admin.module +# @Last modified by: bach +# @Last modified time: 20-12-2017 +# @License: GPL-V3 diff --git a/sites/all/modules/figli/edlp_fils/edlp_fils.routing.yml b/sites/all/modules/figli/edlp_fils/edlp_fils.routing.yml new file mode 100644 index 000000000..93ba0de6b --- /dev/null +++ b/sites/all/modules/figli/edlp_fils/edlp_fils.routing.yml @@ -0,0 +1,23 @@ +# @Author: Bachir Soussi Chiadmi +# @Date: 13-12-2017 +# @Email: bachir@figureslibres.io +# @Filename: edlp_corpus.routing.yml +# @Last modified by: bach +# @Last modified time: 20-12-2017 +# @License: GPL-V3 + +edlp_fils.fils: + path: '/fils' + defaults: + _controller: '\Drupal\edlp_fils\Controller\FilsController::fils' + _title: 'Fils' + requirements: + _permission: 'access content' + +edlp_fils.filsajax: + path: '/fils/ajax' + defaults: + _controller: '\Drupal\edlp_fils\Controller\FilsController::filsjson' + _title: 'Fils' + requirements: + _permission: 'access content' diff --git a/sites/all/modules/figli/edlp_fils/src/Controller/FilsController.php b/sites/all/modules/figli/edlp_fils/src/Controller/FilsController.php new file mode 100644 index 000000000..53b6dacde --- /dev/null +++ b/sites/all/modules/figli/edlp_fils/src/Controller/FilsController.php @@ -0,0 +1,44 @@ +"Edlp Fils" + ); + } + + /** + * Get agenda data as json through ajax. + * + * @return json + */ + public function filsjson() { + + $response = new JsonResponse(); + $renderable = array( + "#markup"=>"Edlp Fils" + ); + $rendered = render($renderable); + + $response->setData([ + 'test'=>'hello', + 'rendered'=> $rendered + ]); + + return $response; + } + +} diff --git a/sites/all/modules/figli/edlp_home/edlp_home.inc b/sites/all/modules/figli/edlp_home/edlp_home.inc index 5131cbf16..383b36f6c 100644 --- a/sites/all/modules/figli/edlp_home/edlp_home.inc +++ b/sites/all/modules/figli/edlp_home/edlp_home.inc @@ -1,20 +1,71 @@ getViewBuilder('node'); // dpm($vars); - // render the presentation node + // render the presentation column $vars["presentation"] = array( - $view_builder->view($vars["presentation_node"], 'default') + "#type"=>"container", + "pres"=>$view_builder->view($vars["presentation_node"], 'default'), + "link"=> array( + '#title' => t('Visiter la collection sonore.'), + '#type' => 'link', + '#url' => Url::fromRoute('', [], array( + 'attributes' => array( + 'class' => ['corpus-link', 'ajax-link'] + ) + )) + ) ); - // render the last fil node - $vars["last_fil"] = $view_builder->view($vars['last_fil_node'], 'teaser'); + // render the last fil column + $vars["last_fil"] = array( + "#type" => "container", + 'fil' => $view_builder->view($vars['last_fil_node'], 'teaser'), + 'links' => array( + '#theme' => 'item_list', + '#items' => array( + 'link_all' => array( + '#title' => t("Voir tous les fils de l'EP."), + '#type' => 'link', + '#url' => Url::fromRoute('edlp_fils.fils', [], array( + 'attributes' => array( + 'class' => ['fils-link', 'ajax-link'] + ) + )) + ), + // TODO: link posdcast fils + 'link_podcast' => array( + '#title' => t("S'abonner au podcast des fils."), + '#type' => 'link', + '#url' => Url::fromRoute('', [], array( + 'attributes' => array( + 'class' => ['fils-link'] + ) + )) + ) + ) + ) - // render the last production node - $vars["last_production"] = $view_builder->view($vars['last_production_node'], 'teaser'); + ); + + // render the last production column + $vars["last_production"] = array( + '#type' => 'container', + 'prod' => $view_builder->view($vars['last_production_node'], 'teaser'), + 'link'=> array( + '#title' => t('Voir toutes les productions.'), + '#type' => 'link', + '#url' => Url::fromRoute('edlp_productions.productions', [], array( + 'attributes' => array( + 'class' => ['productions-link', 'ajax-link'] + ) + )) + ) + ); // render the next events of agenda as list $agenda = array ( diff --git a/sites/all/modules/figli/edlp_productions/edlp_productions.routing.yml b/sites/all/modules/figli/edlp_productions/edlp_productions.routing.yml index 167d9f11b..01cfc0068 100644 --- a/sites/all/modules/figli/edlp_productions/edlp_productions.routing.yml +++ b/sites/all/modules/figli/edlp_productions/edlp_productions.routing.yml @@ -10,7 +10,7 @@ edlp_productions.productions: path: '/productions' defaults: _controller: '\Drupal\edlp_productions\Controller\ProductionsController::productions' - _title: 'Agenda' + _title: 'Productions' requirements: _permission: 'access content' @@ -18,6 +18,6 @@ edlp_productions.productionsajax: path: '/productions/ajax' defaults: _controller: '\Drupal\edlp_productions\Controller\ProductionsController::productionsjson' - _title: 'Agenda' + _title: 'Productions' requirements: _permission: 'access content' diff --git a/sites/all/themes/custom/edlptheme/templates/content/edlp-home.html.twig b/sites/all/themes/custom/edlptheme/templates/content/edlp-home.html.twig index 3ac64bb1e..2ab8c3028 100644 --- a/sites/all/themes/custom/edlptheme/templates/content/edlp-home.html.twig +++ b/sites/all/themes/custom/edlptheme/templates/content/edlp-home.html.twig @@ -1,14 +1,22 @@
- {{ presentation }} +
+ {{ presentation }} +
- {{ last_fil }} +
+ {{ last_fil }} +
- {{ last_production }} +
+ {{ last_production }} +
- {{ agenda }} +
+ {{ agenda }} +