Commit bee18354 authored by Ghislain Loas's avatar Ghislain Loas

wip on bootstrap

parent 5cfed973
Pipeline #9990 passed with stage
in 44 minutes and 1 second
......@@ -586,9 +586,21 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
->setModel($this->notice)
->collection();
$html = [$this->view->renderTracks($tracks),
$this->view->renderPictures($pictures),
$this->view->renderTrailers($trailers)];
$viewer = ($viewer = (new Class_Notice_Numel($this->notice))->getViewer())
? $viewer
: (new Class_Notice_Gallica($this->notice))->getViewer();
$html = [];
if ($viewer)
$html = [$viewer->renderOn($this->view)];
$html = array_merge($html,
[$this->view->renderAlbum($this->notice->getAlbum()),
$this->view->recordAlbums($this->notice),
$this->view->renderTracks($tracks),
$this->view->renderPictures($pictures),
$this->view->renderTrailers($trailers)]);
$html = array_filter($html);
......
......@@ -629,8 +629,13 @@ class Class_ScriptLoader {
* @return String
*/
public function styleSheetsHTML() {
return implode('', $this->styleSheetsArray());
}
public function styleSheetsArray() {
$this->_deferredLoadAmber();
return implode('',array_unique($this->_css_lines));
return array_unique($this->_css_lines);
}
......@@ -647,11 +652,16 @@ class Class_ScriptLoader {
* @return String
*/
public function javaScriptsHTML() {
return implode('', $this->javaScriptsArray());
}
public function javaScriptsArray() {
$this
->_deferredLoadAmber()
->_injectJQueryReadyScripts();
return implode('',array_unique($this->_script_lines));
return array_unique($this->_script_lines);
}
......
......@@ -109,7 +109,6 @@ class ZendAfi_Form_Configuration_Widget_Search
['label' => $this->_('Mode de sélection des domaines'),
'multiOptions' => $simple_search->getSelectionModeOptions(),
'value' => $simple_search->getSelectionModeDefault()]);
}
......
......@@ -88,6 +88,7 @@ div:hover > .img_as_background {
i:first-child,
.widget.rech_simple .dropdown-menu i:first-child,
.widget.rech_simple .criteres_recherche i:first-child,
.card-link + .card-link,
.badge,
p > i {
......@@ -429,7 +430,7 @@ label[data-name=note] ~ div label.multi-element-label + br {
padding: 5%;
top: 0;
left: 0;
background-color: var(--front-background-modale);
background-color: var(--front-background-modale) !important;
z-index: 20;
text-align: center;
flex: 100%;
......@@ -437,8 +438,10 @@ label[data-name=note] ~ div label.multi-element-label + br {
max-height: 100%;
}
.modal_image img {
width: auto !important;
.modal_image * {
width: 100% !important;
height: 100% !important;
object-fit: contain;
}
.blockquote-footer {
......
......@@ -83,7 +83,7 @@ class Intonation_Library_FormCustomizer {
protected function _getStrategyFor($form) {
$strategies = ['ZendAfi_Form_Configuration_Widget_Login' => 'FormStyle',
'ZendAfi_Form_Configuration_Widget_Search' => 'FormStyle'];
'Intonation_Library_Widget_Search_Form' => 'FormStyle'];
if (!in_array(get_class($form), array_keys($strategies)))
return false;
......
......@@ -402,7 +402,8 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
$actions = array_merge([$this->_addToSelectionAction()],
$this->_socialNetworksActions(),
[$this->_printAction()],
$this->_thumbnailActions());
$this->_thumbnailActions(),
[$this->_addNumericResourceAction()]);
$button = new Intonation_Library_Link(['Text' => $this->_('Plus'),
'Attribs' => ['class' => 'more_action'],
......@@ -430,6 +431,28 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
}
protected function _addNumericResourceAction() {
if ( ! Class_AdminVar::isBibNumEnabled())
return;
if ( ! Class_Users::isCurrentUserAdmin())
return;
return new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin',
'controller' => 'album',
'action' => 'link_album_to',
'id_notice' => $this->_model->getId()]),
'Image' => Class_Template::current()->getIco($this->_view,
'media',
'library'),
'Text' => $this->_('Créer …'),
'Attribs' => ['class' => 'menu_admin_front_anchor'],
'Popup' => 'true',
'Title' => $this->_('Créer un album numérique %s',
$this->_model->getTitrePrincipal(' '))]);
}
protected function _socialNetworksActions() {
return $this->_view->socialNetworksActions($this->_model);
}
......
......@@ -34,12 +34,7 @@ class Intonation_Library_View_Wrapper_Record_RichContent_Media extends Intonatio
if ($this->_content)
return $this->_content;
$album = ($album = $this->_model->getAlbum()
? $this->_view->renderAlbum($album)
: '');
$html = [$album,
$this->_view->renderAjax('noticeajax', 'media', [], $this->_getJsCallback())];
$html = [$this->_view->renderAjax('noticeajax', 'media', [], $this->_getJsCallback())];
return $this->_content = $this->_view->grid(implode($html));
}
......
......@@ -24,11 +24,13 @@ class Intonation_Library_Widget_Search_Definition extends Class_Systeme_ModulesA
public function __construct() {
parent::__construct();
$this->_view_helper = 'Intonation_Library_Widget_Search_View';
$this->_form = 'Intonation_Library_Widget_Search_Form';
$this->_defaultValues = array_merge($this->_defaultValues,
[Class_Template::current()->withNameSpace('FormStyle') => 'inline',
'search_button' => $this->_('Rechercher'),
'placeholder' => $this->_('Titre, auteur…'),
'type_doc' => ''
'type_doc' => '',
'facets_in_session' => 1
]);
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2017, 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_Widget_Search_Form extends ZendAfi_Form_Configuration_Widget_Search {
public function init() {
parent::init();
$this
->addElement('checkbox',
'facets_in_session',
['label' => $this->_('Persistance des facettes en session'),
'multiOptions' => [1,0]]);
}
public function populate(array $datas) {
parent::populate($datas);
$this->removeElement('largeur');
$this->addToSelectionGroup(['facets_in_session']);
return $this;
}
}
\ No newline at end of file
......@@ -105,6 +105,9 @@ abstract class IntonationSearchRenderAbstract {
if (!$last_search = Zend_Registry::get('session')->last_search)
return $this;
if ( ! $this->_settings->getFacetsInSession())
return $this;
$criteria = (new Class_CriteresRecherche())
->setParams($last_search);
......@@ -170,7 +173,7 @@ abstract class IntonationSearchRenderAbstract {
['Title' => $this->_('Réinitialiser la recherche'),
'type' => 'button',
'class' => 'btn btn-sm btn-warning border-dark',
'onclick' => 'var form = $(this).closest(\'form\'); form.attr(\'action\', \'' . $this->_view->url(['controller' => 'recherche', 'action' => 'simple'], null, true) . '\'); form.find(\'.expressionRecherche\').attr(\'value\', \'\'); $(this).hide(); form.find(\'.criteres_recherche\').hide(); form.find(\'.has_facet\').removeClass(\'bg-warning\'); $.ajax(\'' . $this->_view->url(['controller' => 'recherche', 'action' => 'clear-last-search-session'], null, true) . '\');']);
'onclick' => 'var form = $(this).closest(\'form\'); form.attr(\'action\', \'' . $this->_view->url(['controller' => 'recherche', 'action' => 'simple'], null, true) . '\'); form.find(\'.expressionRecherche\').attr(\'value\', \'\'); $(this).hide(); form.parent().find(\'.criteres_recherche\').hide(); form.parent().find(\'.has_facet\').removeClass(\'bg-warning\'); $.ajax(\'' . $this->_view->url(['controller' => 'recherche', 'action' => 'clear-last-search-session'], null, true) . '\');']);
}])
->addElement('button',
......@@ -321,10 +324,11 @@ class IntonationSearchRenderDefault extends IntonationSearchRenderAbstract {
public function render() {
$criteria = $this->_renderCriteria('');
$html = $this->_view->renderForm($this->_getForm()
->addUniqDisplayGroup('search_group'));
->addUniqDisplayGroup('search_group'));
$html = $this->_renderCriteria($html);
$html .= $criteria;
return $this->_isAdvancedSearchEnabled()
? $html . $this->_renderAdvancedSearch()
......
......@@ -145,6 +145,8 @@ class Intonation_View_Opac extends ZendAfi_View_Helper_BaseHelper {
if($this->_template->getIntonationCss())
$head_scripts->addStyleSheets([Class_Url::absolute('/library/templates/Intonation/Assets/css/intonation.css')]);
$this->_addTemplateCss($head_scripts);
if($custom_css_urls = $this->_template->getCustomCssUrl())
$head_scripts->addStyleSheets($custom_css_urls);
......@@ -179,15 +181,16 @@ class Intonation_View_Opac extends ZendAfi_View_Helper_BaseHelper {
$this->_tag('meta', null, ['name' => 'revisit-after',
'content' => '10 days']),
$this->_tag('title', $this->view->getTitre()),
$this->_tag('title', $this->view->getTitre())];
$content = array_merge($content,
$head_scripts->styleSheetsArray(),
$script_loader->styleSheetsArray(),
$head_scripts->javaScriptsArray(),
$script_loader->javaScriptsArray(),
[$this->view->heartbeat()]);
$script_loader->styleSheetsHTML(),
$head_scripts->styleSheetsHTML(),
$head_scripts->javaScriptsHTML(),
$script_loader->javaScriptsHTML(),
$this->view->heartbeat(),
$this->view->headScript(),
$this->view->headLink()];
$content = array_unique($content);
return implode($content);
}
......@@ -208,4 +211,8 @@ class Intonation_View_Opac extends ZendAfi_View_Helper_BaseHelper {
$this->view->addBootstrap($script_loader);
return $this;
}
protected function _addTemplateCss($script_loader) {
}
}
\ No newline at end of file
......@@ -24,14 +24,15 @@ class Intonation_View_Search_HtmlCriteria extends ZendAfi_View_Helper_TagCritere
protected
$_cache,
$_domain;
$_domain,
$_criteria;
public function search_HtmlCriteria($criteres_recherche) {
if ($this->_cache)
return $this->_cache;
$criteres_recherche = (new Intonation_Library_Search_Criteria)
$this->_criteria = $criteres_recherche = (new Intonation_Library_Search_Criteria)
->from($criteres_recherche);
$this->visitCriteresRecherche($criteres_recherche);
......@@ -69,6 +70,13 @@ class Intonation_View_Search_HtmlCriteria extends ZendAfi_View_Helper_TagCritere
}
public function visitPanier($panier) {
return $this
->htmlAppend($this->getSuppressionImgUrlForLibelle($panier->getLibelle(),
$this->_criteres_recherche->getUrlCriteresWithoutElement('id_panier')));
}
public function visitNouveaute($months_delay) {
return $this->_domain ? $this : parent::visitNouveaute($months_delay);
}
......
......@@ -34,7 +34,17 @@ class Intonation_View_Search_TextCriteria extends Intonation_View_Search_HtmlCri
public function visitCatalogue($catalogue) {
$this->_domain = $catalogue;
return $this;
return $this->_criteria->hasExpressionRecherche()
? $this->htmlAppend($this->view->_('dans %s', $catalogue->getLibelle()))
: $this;
}
public function visitPanier($panier) {
return $this->_criteria->hasExpressionRecherche()
? $this->htmlAppend($this->view->_('dans la sélection %s', $panier->getLibelle()))
: $this;
}
......
......@@ -21,9 +21,8 @@
class Muscle_View_Opac extends Intonation_View_Opac {
protected function _headContent() {
Class_ScriptLoader::getInstance()
->addStyleSheet(Class_Url::absolute('/library/templates/Muscle/Assets/css/muscle.css'));
return parent::_headContent();
protected function _addTemplateCss($script_loader) {
if ($this->_template->getMuscleCss())
$script_loader->addStyleSheet(Class_Url::absolute('/library/templates/Muscle/Assets/css/muscle.css'));
}
}
......@@ -21,9 +21,8 @@
class MyBibApp_View_Opac extends Intonation_View_Opac {
protected function _headContent() {
Class_ScriptLoader::getInstance()
->addStyleSheet(Class_Url::absolute('/library/templates/MyBibApp/Assets/css/mybibapp.css'));
return parent::_headContent();
protected function _addTemplateCss($script_loader) {
if ($this->_template->getMybibappCss())
$script_loader->addStyleSheet(Class_Url::absolute('/library/templates/MyBibApp/Assets/css/mybibapp.css'));
}
}
......@@ -21,12 +21,12 @@
class Polygone_View_Opac extends Intonation_View_Opac {
protected function _headContent() {
protected function _addTemplateCss($script_loader) {
if ($this->_template->getPolygoneCss())
$script_loader->addStyleSheet(Class_Url::absolute('/library/templates/Polygone/Assets/css/polygone.css'));
Class_ScriptLoader::getInstance()
->addStyleSheet(Class_Url::absolute('/library/templates/Polygone/Assets/css/polygone.css'))
->addScript(Class_Url::absolute('/library/templates/Polygone/Assets/js/scroll_search.js'))
->addJQueryReady('$(".scroll_search").scroll_search();');
return parent::_headContent();
}
}
......@@ -21,9 +21,8 @@
class TerreDuMilieu_View_Opac extends Intonation_View_Opac {
protected function _headContent() {
Class_ScriptLoader::getInstance()
->addStyleSheet(Class_Url::absolute('/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css'));
return parent::_headContent();
protected function _addTemplateCss($script_loader) {
if ($this->_template->getTerredumilieuCss())
$script_loader->addStyleSheet(Class_Url::absolute('/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css'));
}
}
......@@ -47,7 +47,7 @@
}
.admin-form [size] {
width: auto !important;
width: auto;
}
.admin-form tr {
......
......@@ -31,8 +31,18 @@ abstract class MuscleTemplateTestCase extends Admin_AbstractControllerTestCase {
$profile = $this->fixture('Class_Profil',
['id' => 23]);
(new Muscle_Template)->tryOn($profile);
$settings = $this->fixture('Class_Template_Settings',
['id' => 1,
'template' => 'MUSCLE']);
$settings
->updateAttributes(['MuscleCustomCssUrl' => ['custom_template.css']])
->save();
$id = (new Muscle_Template)->tryOn($profile);
(new Class_Profil_Promoter)->promote($profile);
Class_Profil::find($id)->setHeaderCss('live_editor.css')->save();
}
......@@ -115,6 +125,19 @@ class MuscleTemplateProfilePatcherTest extends MuscleTemplateTestCase {
public function addNewArticleInWidgetShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "admin/cms/add")]', 'Ajouter un nouvel article');
}
/** @test */
public function cssFilesOrderShouldContainsIntonationThenMuscleThenCustomCssThenProfileCss() {
$this->assertXPath('//link[1][contains(@href, "jquery-ui.min.css")]');
$this->assertXPath('//link[2][contains(@href, "all.min.css")]');
$this->assertXPath('//link[3][contains(@href, "bootstrap.min.css")]');
$this->assertXPath('//link[4][contains(@href, "core.css")]');
$this->assertXPath('//link[5][contains(@href, "intonation.css")]');
$this->assertXPath('//link[6][contains(@href, "muscle.css")]');
$this->assertXPath('//link[7][contains(@href, "custom_template.css")]');
$this->assertXPath('//link[8][contains(@href, "live_editor.css")]');
}
}
......
......@@ -1396,7 +1396,7 @@ class TemplatesSearchWidgetSettingsFormTest extends TemplatesIntonationTestCase
public function setUp() {
parent::setUp();
$this->dispatch('/admin/widget/edit-widget/id/8/id_profil/72', true);
$this->dispatch('/admin/widget/edit-widget/id/8/id_profil/72');
}
......@@ -2468,7 +2468,7 @@ class TemplatesDispatchNoticeAjaxTrailerTest extends TemplatesIntonationTestCase
'player' => '<iframe src="https://www.super-trailers.org/?media=18397590" style="width:500px; height:400px" frameborder="0"></iframe>']));
Class_WebService_AllServices::setHttpClient($mock);
}
}
/** @test */
......@@ -2485,7 +2485,7 @@ class TemplatesDispatchNoticeAjaxTrailerTest extends TemplatesIntonationTestCase
}
/** @test */
/** @test */
public function shouldRenderEditTrailer() {
$this->dispatch('/noticeajax/media/id/34/id_profil/72');
$this->assertXPath('//button[contains(@onclick, "/admin/records/trailer/id/34")]');
......@@ -4575,7 +4575,22 @@ class TemplatesSearchInSessionTest extends TemplatesIntonationTestCase {
}
/** @test */
/** @test */
public function searchWidgetShouldNotContainsTrollDeTroy() {
$widget = (new Class_Systeme_Widget_Widget)
->setId(8)
->setProfileId(72)
->load();
$widget->setNewDatas(['facets_in_session' => 0]);
$widget->updateProfile();
$this->dispatch('/opac/index/index/id_profil/72');
$this->assertNotXPath('//input[contains(@value, "trolls de troy")]');
}
/** @test */
public function searchSessionShouldBeEmpty() {
$this->dispatch('/opac/recherche/clear-last-search-session');
$this->assertEquals(null, Zend_Registry::get('session')->last_search);
......
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