From d8095ef6357e28e39391df1c08cd788ecc7a36d9 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Wed, 6 Feb 2019 17:36:07 +0100 Subject: [PATCH] dev #64573 start implementing record nav --- .../Intonation/Assets/css/intonation.css | 5 ++ .../templates/Intonation/Library/Settings.php | 11 ++- .../Intonation/View/RenderRecord.php | 72 ++++++++++++++++++- 3 files changed, 86 insertions(+), 2 deletions(-) diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index c655262a9aa..a68e62bbf97 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -80,6 +80,7 @@ p > i { margin-right: 0.5em; } +.nav-link i:first-child, .carousel-control-prev i:first-child, .carousel-control-next i:first-child { margin-right: 0; @@ -392,3 +393,7 @@ label[for=note] ~ div label.multi-element-label + br { .badge .rating-ico { color: inherit; } + +.nav-link { + font-size: 2em; +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index a2930c3b1ad..d793262a89e 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -96,6 +96,8 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'dt' => 'col-12 col-sm-3', 'dd' => 'col-12 col-sm-9', 'a' => 'btn-link', + 'a class active' => '', + 'a class nav-link' => '', 'a class card-link' => '', 'a class account-loans' => 'list-group-item-info', 'ul' => 'list-unstyled', @@ -122,7 +124,14 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'return-date' => 'class fas fa-dolly', 'place' => 'class fas fa-map-signs', 'cote' => 'class fas fa-crosshairs', - 'hold' => 'class fas fa-thumbtack'], + 'hold' => 'class fas fa-thumbtack', + 'record' => 'class fas fa-home', + 'related' => 'class fas fa-clone', + 'description' => 'class fas fa-info', + 'resume' => 'class fab fa-readme', + 'reviews' => 'class fas fa-comments', + 'media' => 'class fas fa-images', + ], 'icons_map_utils' => ['image_place_holder' => '/library/templates/Intonation/Assets/images/image_place_holder.png', 'previous' => 'class fas fa-chevron-left', diff --git a/library/templates/Intonation/View/RenderRecord.php b/library/templates/Intonation/View/RenderRecord.php index c42108ba68e..a092468f922 100644 --- a/library/templates/Intonation/View/RenderRecord.php +++ b/library/templates/Intonation/View/RenderRecord.php @@ -124,7 +124,8 @@ class Intonation_View_RenderRecord extends ZendAfi_View_Helper_BaseHelper { $html = $this->_div(['class' => 'col-12 col-sm-6 col-md-4 col-lg-3 col-xl-2 offset-xl-1'], $this->_recordThumbnail()) . $this->_div(['class' => 'col-12 col-md-6 col-lg-7 col-xl-4'], $this->_recordMetaData()) - . $this->_div(['class' => 'mh-100 no-gutters col-12 col-md-10 col-xl-3'], $this->_recordItems()); + . $this->_div(['class' => 'mh-100 no-gutters col-12 col-md-10 col-xl-3'], $this->_recordItems()) + . $this->_div(['class' => 'col-12 col-md-10 col-xl-9 offset-xl-1'], $this->_nav()); return $this->_div(['class' => 'jumbotron jumbotron-fluid w-100 no_overflow'], $this->_grid($html, @@ -133,6 +134,75 @@ class Intonation_View_RenderRecord extends ZendAfi_View_Helper_BaseHelper { } + protected function _nav() { + $current_url = $this->view->url(); + + $template = Class_Template::current(); + + $id = $this->_record->getId(); + + $anchors = [$this->view->tagAnchor(['controller' => 'recherche', + 'action' => 'viewnotice', + 'id' => $id], + $template->getIco($this->view, 'record', 'library'), + ['title' => $this->_('Toutes les informations sur le document'), + 'class' => 'nav-link' . ((false !== strpos($current_url, 'recherche/viewnotice')) ? ' active' : '')]), + + $this->view->tagAnchor(['controller' => 'record', + 'action' => 'resume', + 'id' => $id], + $template->getIco($this->view, 'resume', 'library'), + ['title' => $this->_('Le résumé du document'), + 'class' => 'nav-link' . ((false !== strpos($current_url, 'record/resume')) ? ' active' : '')]), + + $this->view->tagAnchor(['controller' => 'record', + 'action' => 'media', + 'id' => $id], + $template->getIco($this->view, 'media', 'library'), + ['title' => $this->_('Les médias du document'), + 'class' => 'nav-link' . ((false !== strpos($current_url, 'record/media')) ? ' active' : '')]), + + $this->view->tagAnchor(['controller' => 'record', + 'action' => 'reviews', + 'id' => $id], + $template->getIco($this->view, 'reviews', 'library'), + ['title' => $this->_('Les avis du document'), + 'class' => 'nav-link' . ((false !== strpos($current_url, 'record/reviews')) ? ' active' : '')]), + + $this->view->tagAnchor(['controller' => 'record', + 'action' => 'description', + 'id' => $id], + $template->getIco($this->view, 'description', 'library'), + ['title' => $this->_('La description du document'), + 'class' => 'nav-link' . ((false !== strpos($current_url, 'record/description')) ? ' active' : '')]), + + $this->view->tagAnchor(['controller' => 'record', + 'action' => 'related', + 'id' => $id], + $template->getIco($this->view, 'related', 'library'), + ['title' => $this->_('Les documents reliés'), + 'class' => 'nav-link' . ((false !== strpos($current_url, 'record/related')) ? ' active' : '')]), + + $this->view->tagAnchor(['controller' => 'record', + 'action' => 'author', + 'id' => $id], + $template->getIco($this->view, 'author', 'library'), + ['title' => $this->_('L\'auteur principal du document'), + 'class' => 'nav-link' . ((false !== strpos($current_url, 'record/author')) ? ' active' : '')]) + + ]; + + $lis = array_map(function($anchor) + { + return $this->_tag('li', $anchor, ['class' => 'nav-item']); + }, $anchors); + + return $this->_tag('ul', + implode($lis), + ['class' => 'nav nav-tabs nav-fill']); + } + + protected function _recordThumbnail() { $image = $this->_wrapped->getPicture(); return $this->view->tagImg($image, -- GitLab