Merge pull request #1214 from scott1702/clear-filter

Remove 'Filtered Tree' notification when clearing the filter
This commit is contained in:
Damian Mooyman 2015-06-16 11:02:50 +12:00
commit 9fd0c5b0d7

View File

@ -290,7 +290,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* @return boolean
*/
public function TreeIsFiltered() {
return $this->getRequest()->getVar('q');
$query = $this->getRequest()->getVar('q');
if (!$query || (count($query) === 1 && isset($query['FilterClass']) && $query['FilterClass'] === 'CMSSiteTreeFilter_Search')) {
return false;
}
return true;
}
public function ExtraTreeTools() {
@ -351,8 +357,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
// Create the Search and Reset action
$actions = new FieldList(
FormAction::create('doSearch', _t('CMSMain_left_ss.APPLY_FILTER', 'Apply Filter'))
->addExtraClass('ss-ui-action-constructive'),
Object::create('ResetFormAction', 'clear', _t('CMSMain_left_ss.RESET', 'Reset'))
->addExtraClass('ss-ui-action-constructive'),
Object::create('ResetFormAction', 'clear', _t('CMSMain_left_ss.CLEAR_FILTER', 'Clear Filter'))
);
// Use <button> to allow full jQuery UI styling on the all of the Actions