mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Merge remote-tracking branch 'silverstripe-scienceninjas/pull/SSF-12'
This commit is contained in:
commit
f216c783c6
@ -31,6 +31,7 @@ class AssetAdmin extends LeftAndMain {
|
||||
'savefile',
|
||||
'deleteUnusedThumbnails' => 'ADMIN',
|
||||
'SyncForm',
|
||||
'filter',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -210,6 +211,40 @@ JS
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a form for filtering of files and assets gridfield
|
||||
*
|
||||
* @return Form
|
||||
* @see AssetAdmin.js
|
||||
*/
|
||||
public function FilterForm() {
|
||||
$fields = new FieldList();
|
||||
// Below is the filters that this field should filter on
|
||||
$fields->push(new TextField('Title'));
|
||||
$fields->push(new TextField('ClassName','Type'));
|
||||
|
||||
$actions = new FieldList();
|
||||
$actions->push(new FormAction('doFilter', 'Filter'));
|
||||
$actions->push(new ResetFormAction('doResetFilter', 'Clear Filter'));
|
||||
|
||||
$form = new Form($this, 'filter', $fields, $actions);
|
||||
$form->addExtraClass('cms-filter-form');
|
||||
// This have to match data-name attribute on the gridfield so that the javascript selectors work
|
||||
$form->setAttribute('data-gridfield', 'File');
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this method get's called, it means that javascript didn't hook into to the submit on
|
||||
* FilterForm and we can currently not do a Filter without javascript.
|
||||
*
|
||||
* @param SS_HTTPRequest $data
|
||||
* @throws SS_HTTPResponse_Exception
|
||||
*/
|
||||
public function filter(SS_HTTPRequest $data) {
|
||||
throw new SS_HTTPResponse_Exception('Filterpanel doesn\'t work without javascript enabled.');
|
||||
}
|
||||
|
||||
public function AddForm() {
|
||||
$form = parent::AddForm();
|
||||
$folder = singleton('Folder');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="cms-content-tools west cms-panel cms-panel-layout collapsed" id="cms-content-tools" data-expandOnClick="true" data-layout-type="border">
|
||||
<div class="cms-panel-content center">
|
||||
<h3 class="cms-panel-header"><% _t('FILTER', 'Filter') %></h3>
|
||||
TODO
|
||||
$FilterForm
|
||||
</div>
|
||||
<div class="cms-panel-content-collapsed">
|
||||
<h3 class="cms-panel-header"><% _t('FILTER', 'Filter') %></h3>
|
||||
|
Loading…
Reference in New Issue
Block a user