Commit 902d90a7 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

wip on bootstrap

parent 600ea398
Pipeline #8863 failed with stage
in 35 minutes and 44 seconds
......@@ -1867,4 +1867,11 @@ class AbonneController extends ZendAfi_Controller_Action {
$record->updateFacetsFromExemplaires();
}
}
public function clearHistoryAction() {
(new Class_SearchHistory())->clear();
$this->_helper->notify($this->_('Votre historique de recherche a été supprimé.'), ['status' => 'success']);
return $this->_redirectClose($this->_getReferer());
}
}
\ No newline at end of file
......@@ -22,14 +22,14 @@
class ZendAfi_Controller_Plugin_LastSearch extends Zend_Controller_Plugin_Abstract {
public function preDispatch(Zend_Controller_Request_Abstract $request) {
$session = Zend_Registry::get('session');
if ('recherche' !== $request->getControllerName())
return;
if ('simple' !== $request->getActionName())
return;
$session = Zend_Registry::get('session');
if ($request->isPost()) {
$session->last_search = null;
return;
......
......@@ -460,7 +460,6 @@ label[data-name=note] ~ div label.multi-element-label + br {
main.col,
aside.col,
header.col {
overflow: hidden;
min-height: 1px;
min-width: 1px;
}
......@@ -486,13 +485,25 @@ header.col {
display: none;
}
.img-thumbnail .card-columns {
.card-img-top > .card-columns,
.img-thumbnail > .card-columns {
column-gap: 0.05rem;
column-count: 3;
}
.card-img-top > .card-columns .card-img-overlay,
.img-thumbnail > .card-columns .card-img-overlay {
padding: 0;
}
.card-img-top > .card-columns .card-img-overlay div,
.img-thumbnail > .card-columns .card-img-overlay div {
display: none;
visibility: hidden;
}
.card .card-columns .card {
margin-bottom: 0.05rem;
margin:0 0 0 0.05rem;
}
.fs_1em {
......
......@@ -62,7 +62,7 @@ class Intonation_Library_View_Wrapper_Search extends Intonation_Library_View_Wra
? $this->_('Suivre cette recherche')
: $this->_('Ne plus suivre cette recherche.')),
'NoButtonText' => 1,
'Attribs' => ['data-popup' => true]]);
'Popup' => true]);
}
......@@ -147,11 +147,9 @@ class Intonation_Library_View_Wrapper_Search extends Intonation_Library_View_Wra
return [new Intonation_Library_Link(['Url' => $this->_view->url($this->_model->getCriteriasUrl()),
'Text' => $this->_('Voir'),
'Title' => $this->_('Voir le résultat de recherche'),
'Tag' => 'button',
'Image' => Class_Template::current()->getIco($this->_view,
'search_more',
'library'),
'Attribs' => ['class' => 'btn btn-primary text-white']])];
'library')])];
}
......
<?php
/**
* Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Intonation_Library_View_Wrapper_SearchHistory extends Intonation_Library_View_Wrapper_Search {
public function getMainLink() {
return reset(parent::getActions());
}
public function getActions() {
return [parent::getMainLink()];
}
public function getBadges() {
if (!$criterias = $this->_model->getUnserializedCriterias())
return [];
$badges = [['tag' => 'span',
'class' => 'secondary',
'text' => date('d/m/Y H:i:s', $criterias->getTime()),
'title' => $this->_('La date de la recherche %s', $this->_model->getLabel())]];
return parent::getBadges() . $this->_view->renderBadges($badges);
}
}
\ No newline at end of file
......@@ -33,11 +33,15 @@ class Intonation_Library_View_Wrapper_User_RichContent_Selections extends Intona
$this->_view->bookmarkedSearches(Class_User_BookmarkedSearch::findAllBy(['id_user' => $this->_model->getId(),
'order' => 'creation_date desc'])),
$this->_view->search_History(),
$this->_view->renderNewsletters(Class_Newsletter::getPublishedNewsletters())];
$html = array_map(function($content)
{
return $this->_view->div(['class' => 'col-12 mb-5'], $content);
return $content
? $this->_view->div(['class' => 'col-12 mb-5'], $content)
: '';
},
$html);
......
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Intonation_View_Search_History extends ZendAfi_View_Helper_BaseHelper {
public function search_History() {
$title = $this->_tag('h3', $this->_('Historique de recherches'));
if (!$history = (new Class_SearchHistory())->getHistory())
return
$title
. $this->_('Vous n\'avez pas encore effectué de recherche. %s !',
$this->view->tagAnchor(['controller' => 'recherche',
'action' => 'simple'],
$this->_('Commencer maintenant')));
$history = array_reverse($history);
$history = array_map(function($criteria)
{
$unserialized_criteria = unserialize($criteria);
$bookmarked_search = (new Class_User_BookmarkedSearch)
->setLabel($unserialized_criteria
? $unserialized_criteria->getExpressionRecherche()
:'')
->setCriterias($criteria);
return (new Intonation_Library_View_Wrapper_SearchHistory)
->setModel($bookmarked_search)
->setView($this->view);
}, $history);
$callback = function($wrapped) {
return $this->view->cardify($wrapped);
};
$actions = [new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne',
'action' => 'clear-history']),
'Popup' => true,
'Text' => $this->_('Vider'),
'Title' => $this->_('Vider l\'historique de recherches'),
'Image' => Class_Template::current()->getIco($this->view,
'delete',
'utils')])];
$html = [$this->view->div(['class' => 'col-12'], $this->view->renderActions($actions)),
$this->view->div(['class' => 'col-12'],
$this->view->renderMultipleCarousel(new Storm_Collection($history), $callback))];
$html = $this->view->grid(implode($html));
return $title . $html;
}
}
......@@ -4598,3 +4598,14 @@ class TemplatesDispatchWidgetTemplateImageTest extends TemplatesIntonationTestCa
$this->assertXPath('//div[contains(@class, "widget")]');
}
}
class TemplatesDispatchAbonneClearHistoryTest extends TemplatesIntonationAccountTestCase {
/** @test */
public function shouldRedirect() {
$this->dispatch('/opac/abonne/clear-history/id_profil/72');
$this->assertRedirect();
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment