Skip to content
Snippets Groups Projects
Commit bb403b6c authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

dev #65265 : fix redirect when no version at all

parent 2e423f5e
Branches
Tags
2 merge requests!2364Dev#65265 versionning des articles en front,!2360Dev#65265 versionning des articles en front
Pipeline #2640 passed with stage
in 20 minutes and 26 seconds
......@@ -34,7 +34,7 @@ abstract class ZendAfi_Controller_Plugin_Versionning_Abstract
return $this->_redirectCloseReferer();
if (!$versions = $this->_versionsFor($model)->findAll())
return $this->_notifyToReferer($this->_('Aucune version dans l\'historique'));
return $this->_handleNoVersion($model);
$this->_view->titre = $this->_('Versions de : "%s"', $this->_modelLabel($model));
$this->_view->versions = $versions;
......@@ -50,7 +50,7 @@ abstract class ZendAfi_Controller_Plugin_Versionning_Abstract
$key = $this->_versionsFor($model)->findLastKey();
if (!$version = $this->_versionsFor($model)->find($key))
return $this->_notifyToReferer($this->_('Aucune version dans l\'historique'));
return $this->_handleNoVersion($model);
$this->_view->titre = $this->_('Version de : "%s"', $this->_modelLabel($model));
$this->_view->version = $version;
......@@ -102,6 +102,14 @@ abstract class ZendAfi_Controller_Plugin_Versionning_Abstract
}
protected function _handleNoVersion($model) {
$this->_notify($this->_('Aucune version dans l\'historique'));
return $this->_view->isPopup()
? $this->_redirectCloseReferer()
: $this->_redirect($this->_editUrl($model));
}
protected function _notifyToReferer($message) {
$this->_notify($message);
$this->_redirectCloseReferer();
......@@ -141,4 +149,9 @@ abstract class ZendAfi_Controller_Plugin_Versionning_Abstract
protected function _versionUrl($model) {
return '';
}
protected function _editUrl($model) {
return '';
}
}
......@@ -78,4 +78,9 @@ class ZendAfi_Controller_Plugin_Versionning_Article
protected function _versionUrl($model) {
return '/admin/cms/version/id/' . $model->getId();
}
protected function _editUrl($model) {
return '/admin/cms/edit/id/' . $model->getId();
}
}
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