Commit 67ec7de8 authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'dev#83983_3mn_bokeh_boite_bib' into 'master'

dev #83983 Improve navigation in library administration

See merge request !2946
parents 6aaa348e d80db5cc
Pipeline #5952 passed with stage
in 33 minutes and 59 seconds
- ticket #83983 : Amélioration de l'ergonomie de la navigation dans l'administration des bibliothèques
\ No newline at end of file
......@@ -51,18 +51,6 @@ class Admin_BibController extends ZendAfi_Controller_Action {
}
public function localisationsAction() {
$cls_loc = new Class_Localisation();
$id_bib = (int)$this->_request->getParam('id_bib');
$this->view->id_bib = $id_bib;
if (!$bib=Class_Bib::find($id_bib))
return $this->_redirect('admin/bib/index');
$this->view->nom_bib = $bib->getLibelle();
$this->view->localisations = $bib->getLocalisations();
$this->view->titre = $this->view->_("Localisations de la bibliothèque: %s",
$this->view->nom_bib);
}
protected function _checkPost($localisation) {
$this->view->localisation = $localisation;
......@@ -186,19 +174,6 @@ class Admin_BibController extends ZendAfi_Controller_Action {
}
public function plansAction() {
$cls_loc = new Class_Localisation();
$id_bib = (int)$this->_request->getParam('id_bib');
if (!$bib= Class_Bib::find($id_bib))
return $this->_redirect('admin/');
$this->view->id_bib = $id_bib;
$this->view->nom_bib = $bib->getLibelle();
$this->view->plans = $bib->getPlans();
$this->view->titre = $this->view->_('Plans de la bibliothèque: %s', $this->view->nom_bib);
}
public function addplanAction() {
if (!$bib = $this->getBib())
return;
......
......@@ -65,12 +65,20 @@ class Admin_OuverturesController extends ZendAfi_Controller_Action {
}
public function indexAction() {
$this->_forward('list');
}
public function listAction() {
parent::indexAction();
if ($this->_response->isRedirect())
return;
$this->view->multimedia = $this->_is_multimedia;
$this->view->model_name = 'library';
$this->view->library = $this->_library;
$form =
$this->_newHolidaysForm()
......
......@@ -54,6 +54,36 @@ class ZendAfi_Controller_Plugin_Manager_Library extends ZendAfi_Controller_Plugi
}
public function localisationsAction() {
$id_bib = (int)$this->_request->getParam('id_bib');
$this->_view->id_bib = $id_bib;
if (!$bib = Class_Bib::find($id_bib))
return $this->_redirect('admin/bib/index');
$this->_addModelToView($bib);
$this->_view->nom_bib = $bib->getLibelle();
$this->_view->localisations = $bib->getLocalisations();
$this->_view->titre = $this->_view->_("Localisations de la bibliothèque: %s",
$bib->getLibelle());
}
public function plansAction() {
$id_bib = (int)$this->_request->getParam('id_bib');
if (!$bib= Class_Bib::find($id_bib))
return $this->_redirect('admin/');
$this->_addModelToView($bib);
$this->_view->id_bib = $id_bib;
$this->_view->nom_bib = $bib->getLibelle();
$this->_view->plans = $bib->getPlans();
$this->_view->titre = $this->_view->_('Plans de la bibliothèque: %s',
$bib->getLibelle());
}
public function getActions($model) {
return [['url' => '/admin/bib/edit/id/%s',
'icon' => 'edit',
......
......@@ -39,6 +39,13 @@ class ZendAfi_Controller_Plugin_Manager_Opening extends ZendAfi_Controller_Plugi
}
public function getActions($model) {
return $model->getClassName() == 'Class_Bib'
? (new ZendAfi_Controller_Plugin_Manager_Library($this->_controller))->getActions($model)
: [];
}
protected function _doBeforeSave($model) {
return $model->setIdSite($this->_getParam('id_site', 0));
}
......
......@@ -1217,8 +1217,6 @@ class BibControllerLocalisationNewTest extends BibControllerTestCase {
public function libelleShouldBeNouvelleLocalisation(){
$this->assertXPath('//input[@id="libelle"][@value="** nouvelle localisation **"]');
}
}
......@@ -1266,6 +1264,43 @@ class BibControllerLocalisationNewPostTest extends BibControllerTestCase {
class BibControllerLocalisationsAnnecyListTest extends BibControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_Localisation',
['id' => 9,
'libelle' => 'Arts',
'description' => 'Coin des arts.',
'bib' => $this->bib_annecy,
'image' => 'bib_2_localisation_9.jpg']);
$this->dispatch('admin/bib/localisations/id_bib/2');
}
/** @test */
public function titleShouldBeLocalisations() {
$this->assertXPathContentContains('//h1', 'Localisations de la bibliothèque: Annecy');
}
/** @test */
public function tdShouldListLocalisationArts() {
$this->assertXPathContentContains('//td', 'Arts');
}
/** @test */
public function pageShouldContainsLinkToEditLibrary2() {
$this->assertXPath('//div[@class="actions"]//a[contains(@href, "/admin/bib/edit/id/2")]');
}
}
class BibControllerLocalisatonDeleteTest extends BibControllerTestCase {
public function setUp() {
parent::setUp();
......@@ -1390,10 +1425,17 @@ class BibControllerPlanMajTest extends BibControllerTestCase {
$this->assertXPath('//img[contains(@src,"plans/bib_3_plan_3.png")]',$this->_response->getBody());
}
/** @test */
public function forCranPageShouldContainsLinkToEditIdBibThree() {
$this->dispatch('admin/bib/plans/id_bib/3');
$this->assertXPath('//div[@class="actions"]//a[contains(@href, "/admin/bib/edit/id/3")]');
}
}
class BibControllerPostMajPlanTest extends BibControllerTestCase {
public function setUp() {
parent::setUp();
......
......@@ -243,10 +243,17 @@ class OuverturesControllerIndexActionSiteCranTest extends OuverturesControllerTe
public function shouldContainReposApresAnniversaireDeFrancine() {
$this->assertXPathContentContains('//ul//li[6]//table//td', 'Repos après l\'anniversaire de francine');
}
/** @test */
public function pageShouldContainsLinkToEditLibraryOne() {
$this->assertXPath('//div[@class="actions"]//a[contains(@href, "/admin/bib/edit/id/1")]');
}
}
class OuverturesControllerIndexActionSiteCranMultimediaEnabledTest extends OuverturesControllerTestCase {
public function setUp() {
parent::setUp();
......
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