mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6299 from silverstripe/revert-6237-modeladmin-showImportForm
Revert "Added $showSearchForm to ModelAdmin"
This commit is contained in:
commit
cbd3aa0949
@ -65,17 +65,10 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
/**
|
/**
|
||||||
* Change this variable if you don't want the Import from CSV form to appear.
|
* Change this variable if you don't want the Import from CSV form to appear.
|
||||||
* This variable can be a boolean or an array.
|
* This variable can be a boolean or an array.
|
||||||
* If array, you can list className you want the form to appear on. i.e. array('myClassOne','myClassTwo')
|
* If array, you can list className you want the form to appear on. i.e. array('myClassOne','myClasstwo')
|
||||||
*/
|
*/
|
||||||
public $showImportForm = true;
|
public $showImportForm = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* Change this variable if you don't want the search form to appear.
|
|
||||||
* This variable can be a boolean or an array.
|
|
||||||
* If array, you can list className you want the form to appear on. i.e. array('myClassOne','myClassTwo')
|
|
||||||
*/
|
|
||||||
public $showSearchForm = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of all {@link DataObject}s which can be imported through
|
* List of all {@link DataObject}s which can be imported through
|
||||||
* a subclass of {@link BulkLoader} (mostly CSV data).
|
* a subclass of {@link BulkLoader} (mostly CSV data).
|
||||||
@ -189,14 +182,9 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Form|bool
|
* @return Form
|
||||||
*/
|
*/
|
||||||
public function SearchForm() {
|
public function SearchForm() {
|
||||||
if(!$this->showSearchForm ||
|
|
||||||
(is_array($this->showSearchForm) && !in_array($this->modelClass, $this->showSearchForm))
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$context = $this->getSearchContext();
|
$context = $this->getSearchContext();
|
||||||
$form = new Form($this, "SearchForm",
|
$form = new Form($this, "SearchForm",
|
||||||
$context->getSearchFields(),
|
$context->getSearchFields(),
|
||||||
@ -338,7 +326,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
/**
|
/**
|
||||||
* Generate a CSV import form for a single {@link DataObject} subclass.
|
* Generate a CSV import form for a single {@link DataObject} subclass.
|
||||||
*
|
*
|
||||||
* @return Form|bool
|
* @return Form
|
||||||
*/
|
*/
|
||||||
public function ImportForm() {
|
public function ImportForm() {
|
||||||
$modelSNG = singleton($this->modelClass);
|
$modelSNG = singleton($this->modelClass);
|
||||||
@ -414,7 +402,6 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @param SS_HTTPRequest $request
|
* @param SS_HTTPRequest $request
|
||||||
* @return bool|null
|
|
||||||
*/
|
*/
|
||||||
public function import($data, $form, $request) {
|
public function import($data, $form, $request) {
|
||||||
if(!$this->showImportForm || (is_array($this->showImportForm)
|
if(!$this->showImportForm || (is_array($this->showImportForm)
|
||||||
|
@ -16,9 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cms-content-header-tabs cms-tabset-nav-primary ss-ui-tabs-nav">
|
<div class="cms-content-header-tabs cms-tabset-nav-primary ss-ui-tabs-nav">
|
||||||
<% if $SearchForm || $ImportForm %>
|
<button id="filters-button" class="icon-button font-icon-search no-text" title="<%t CMSPagesController_Tools_ss.FILTER 'Filter' %>"></button>
|
||||||
<button id="filters-button" class="icon-button font-icon-search no-text" title="<%t CMSPagesController_Tools_ss.FILTER 'Filter' %>"></button>
|
|
||||||
<% end_if %>
|
|
||||||
<ul class="cms-tabset-nav-primary">
|
<ul class="cms-tabset-nav-primary">
|
||||||
<% loop $ManagedModelTabs %>
|
<% loop $ManagedModelTabs %>
|
||||||
<li class="tab-$ClassName $LinkOrCurrent<% if $LinkOrCurrent == 'current' %> ui-tabs-active<% end_if %>">
|
<li class="tab-$ClassName $LinkOrCurrent<% if $LinkOrCurrent == 'current' %> ui-tabs-active<% end_if %>">
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
<% if $SearchForm || $ImportForm %>
|
<div id="cms-content-tools-ModelAdmin" class="cms-content-filters">
|
||||||
<div id="cms-content-tools-ModelAdmin" class="cms-content-filters">
|
<% if $SearchForm %>
|
||||||
<% if $SearchForm %>
|
<h3 class="cms-panel-header"><%t ModelAdmin_Tools_ss.FILTER 'Filter' %></h3>
|
||||||
<h3 class="cms-panel-header"><%t ModelAdmin_Tools_ss.FILTER 'Filter' %></h3>
|
$SearchForm
|
||||||
$SearchForm
|
<% end_if %>
|
||||||
<% end_if %>
|
|
||||||
|
|
||||||
<% if $ImportForm %>
|
<% if $ImportForm %>
|
||||||
<h3 class="cms-panel-header"><%t ModelAdmin_Tools_ss.IMPORT 'Import' %></h3>
|
<h3 class="cms-panel-header"><%t ModelAdmin_Tools_ss.IMPORT 'Import' %></h3>
|
||||||
$ImportForm
|
$ImportForm
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
</div>
|
</div>
|
||||||
<% end_if %>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user