Skip to content
Snippets Groups Projects
Commit c6944846 authored by Ghislain Loas's avatar Ghislain Loas Committed by Laurent
Browse files

hackfest : library widget default values

parent 18d3fecd
Branches
Tags
3 merge requests!2080Sandbox detach zf from storm,!1940Dev#48981 3455 lier des cartes via bokeh,!1929Dev#48981 3455 lier des cartes via bokeh
......@@ -26,6 +26,7 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba
$_selected_filters = [],
$_filter_settings;
public function shouldCacheContent() {
return false;
}
......
......@@ -50,8 +50,10 @@ abstract class ZendAfi_View_Helper_Filters_Strategy_Elements extends ZendAfi_Vie
protected function _getSelectedElementsLabel() {
$labels = [];
foreach ($this->_getElements() as $value => $label) {
if ($this->_isSelected($value))
$labels [] = $label;
if (!$this->_isSelected($value))
return;
$labels [] = $label;
}
return $labels;
......
......@@ -44,8 +44,28 @@ class ZendAfi_View_Helper_Filters_Strategy_Facet extends ZendAfi_View_Helper_Fil
$url = $this->view->url($url_params, null, true);
return $this->_tag('li',
$this->_getView()->tagAnchor($url, $label),
$this->view->tagAnchor($url, $label)
. $this->_setDefaultValue($value, $label),
$selected ? ['class' => 'selected'] : []);
}
protected function _setDefaultValue($value, $label) {
if(!Class_Users::isCurrentUserCanAccesBackend())
return '';
$url_params = array_merge($this->_getUrlParams(),
[$this->_getFilterKey() => $value],
['save_' . $this->_getFilterKey() => $value]);
$url = $this->view->url($url_params, null, true);
$saved_label = 'save_' . $label;
return $this->view->tag('input',
'',
['type' => 'checkbox',
'name' => $saved_label,
'value' => $saved_label,
'title' => $this->view->_('Appliquer le filtre %s par défaut', $label),
'data-url' => $url]);
}
}
\ No newline at end of file
......@@ -67,6 +67,7 @@
.boite ul.filters.list ul li {
display: block;
position: relative;
}
.boite ul.filters.list ul li input {
......@@ -81,3 +82,14 @@
.boite ul.filters.list .search h2 {
display: none;
}
.boite ul.filters.list ul li a + input {
display: none;
position: absolute;
right: 5px;
top: 5px;
}
.boite ul.filters.list ul li:hover a + input {
display: block;
}
\ No newline at end of file
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