Skip to content

Commit

Permalink
add noSearch flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Rico Kaltofen committed Jun 27, 2018
1 parent 709de1e commit 608d0c1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 29 deletions.
1 change: 1 addition & 0 deletions src/Model/ListConfigModel.php
Expand Up @@ -53,6 +53,7 @@
* @property string $list
* @property string $manager
* @property string $item
* @property bool $noSearch
*/
class ListConfigModel extends Model
{
Expand Down
2 changes: 2 additions & 0 deletions src/Module/ModuleList.php
Expand Up @@ -193,6 +193,8 @@ protected function compile()

$this->cssID = $cssID;

$this->Template->noSearch = (bool) $this->manager->getListConfig()->noSearch;

$this->Template->list = function (string $listTemplate = null, string $itemTemplate = null, array $data = []) {
return $this->manager->getList()->parse($listTemplate, $itemTemplate, $data);
};
Expand Down
64 changes: 36 additions & 28 deletions src/Resources/contao/dca/tl_list_config.php
Expand Up @@ -9,7 +9,7 @@
'ctable' => 'tl_list_config_element',
'enableVersioning' => true,
'onload_callback' => [
['HeimrichHannot\ListBundle\Backend\ListConfig', 'flattenPaletteForSubEntities']
['HeimrichHannot\ListBundle\Backend\ListConfig', 'flattenPaletteForSubEntities'],
],
'onsubmit_callback' => [
['huh.utils.dca', 'setDateAdded'],
Expand All @@ -27,7 +27,7 @@
'label' => [
'fields' => ['title'],
'format' => '%s',
'label_callback' => ['HeimrichHannot\ListBundle\Backend\ListConfig', 'generateLabel']
'label_callback' => ['HeimrichHannot\ListBundle\Backend\ListConfig', 'generateLabel'],
],
'sorting' => [
'mode' => 2,
Expand All @@ -48,7 +48,7 @@
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['edit'],
'href' => 'table=tl_list_config_element',
'icon' => 'edit.svg',
'button_callback' => ['HeimrichHannot\ListBundle\Backend\ListConfig', 'edit']
'button_callback' => ['HeimrichHannot\ListBundle\Backend\ListConfig', 'edit'],
],
'editheader' => [
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['editheader'],
Expand All @@ -65,7 +65,7 @@
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"',
'attributes' => 'onclick="if(!confirm(\''.$GLOBALS['TL_LANG']['MSC']['deleteConfirm'].'\'))return false;Backend.getScrollOffset()"',
],
'show' => [
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['show'],
Expand All @@ -87,21 +87,21 @@
'addAjaxPagination',
'addMasonry',
],
'default' => '{general_legend},title,parentListConfig;' . '{filter_legend},filter;' . '{config_legend},manager,list,item,numberOfItems,perPage,skipFirst,doNotRenderEmpty,showItemCount,showNoItemsText,showInitialResults,limitFormattedFields,isTableList;' . '{sorting_legend},sortingMode;' . '{jumpto_legend},useAlias,addDetails,addShare;' . '{action_legend},addHashToAction,removeAutoItemFromAction;' . '{misc_legend},addAjaxPagination,addMasonry;' . '{template_legend},listTemplate,itemTemplate;',
'default' => '{general_legend},title,parentListConfig;'.'{filter_legend},filter;'.'{config_legend},manager,list,item,numberOfItems,perPage,skipFirst,doNotRenderEmpty,showItemCount,showNoItemsText,showInitialResults,limitFormattedFields,isTableList;'.'{sorting_legend},sortingMode;'.'{jumpto_legend},useAlias,addDetails,addShare;'.'{action_legend},addHashToAction,removeAutoItemFromAction;'.'{misc_legend},addAjaxPagination,addMasonry;'.'{search_legend},noSearch;'.'{template_legend},listTemplate,itemTemplate;',
],
'subpalettes' => [
'showItemCount' => 'itemCountText',
'showNoItemsText' => 'noItemsText',
'limitFormattedFields' => 'formattedFields',
'isTableList' => 'tableFields,hasHeader,sortingHeader',
'sortingMode_' . \HeimrichHannot\ListBundle\Backend\ListConfig::SORTING_MODE_FIELD => 'sortingField,sortingDirection',
'sortingMode_' . \HeimrichHannot\ListBundle\Backend\ListConfig::SORTING_MODE_TEXT => 'sortingText',
'sortingMode_' . \HeimrichHannot\ListBundle\Backend\ListConfig::SORTING_MODE_MANUAL => 'sortingItems',
'useAlias' => 'aliasField',
'addDetails' => 'useModalExplanation,useModal,jumpToDetails',
'addShare' => 'jumpToShare,shareAutoItem',
'addAjaxPagination' => 'addInfiniteScroll',
'addMasonry' => 'masonryStampContentElements',
'showItemCount' => 'itemCountText',
'showNoItemsText' => 'noItemsText',
'limitFormattedFields' => 'formattedFields',
'isTableList' => 'tableFields,hasHeader,sortingHeader',
'sortingMode_'.\HeimrichHannot\ListBundle\Backend\ListConfig::SORTING_MODE_FIELD => 'sortingField,sortingDirection',
'sortingMode_'.\HeimrichHannot\ListBundle\Backend\ListConfig::SORTING_MODE_TEXT => 'sortingText',
'sortingMode_'.\HeimrichHannot\ListBundle\Backend\ListConfig::SORTING_MODE_MANUAL => 'sortingItems',
'useAlias' => 'aliasField',
'addDetails' => 'useModalExplanation,useModal,jumpToDetails',
'addShare' => 'jumpToShare,shareAutoItem',
'addAjaxPagination' => 'addInfiniteScroll',
'addMasonry' => 'masonryStampContentElements',
],
'fields' => [
'id' => [
Expand Down Expand Up @@ -139,49 +139,49 @@
'options_callback' => function (DataContainer $dc) {
return \Contao\System::getContainer()->get('huh.list.choice.parent-list-config')->getCachedChoices(
[
'id' => $dc->id
'id' => $dc->id,
]
);
},
'eval' => ['tl_class' => 'w50', 'includeBlankOption' => true, 'chosen' => true, 'notOverridable' => true, 'submitOnChange' => true],
'sql' => "int(10) unsigned NOT NULL default '0'"
'sql' => "int(10) unsigned NOT NULL default '0'",
],
// config
'manager' => [
'manager' => [
'inputType' => 'select',
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['manager'],
'options_callback' => ['huh.list.choice.manager', 'getChoices'],
'eval' => [
'chosen' => true,
'includeBlankOption' => true,
'tl_class' => 'clr w50',
'mandatory' => true
'mandatory' => true,
],
'exclude' => true,
'sql' => "varchar(128) NOT NULL default 'default'",
],
'list' => [
'list' => [
'inputType' => 'select',
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['list'],
'options_callback' => ['huh.list.choice.list', 'getChoices'],
'eval' => [
'chosen' => true,
'includeBlankOption' => true,
'mandatory' => true,
'tl_class' => 'w50'
'tl_class' => 'w50',
],
'exclude' => true,
'sql' => "varchar(128) NOT NULL default 'default'",
],
'item' => [
'item' => [
'inputType' => 'select',
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['item'],
'options_callback' => ['huh.list.choice.item', 'getChoices'],
'eval' => [
'chosen' => true,
'includeBlankOption' => true,
'mandatory' => true,
'tl_class' => 'w50'
'tl_class' => 'w50',
],
'exclude' => true,
'sql' => "varchar(128) NOT NULL default 'default'",
Expand Down Expand Up @@ -249,7 +249,7 @@
'eval' => ['tl_class' => 'w50'],
'sql' => "char(1) NOT NULL default '1'",
],
'doNotRenderEmpty' => [
'doNotRenderEmpty' => [
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['doNotRenderEmpty'],
'exclude' => true,
'inputType' => 'checkbox',
Expand Down Expand Up @@ -346,7 +346,7 @@
return \HeimrichHannot\ListBundle\Util\ListConfigHelper::getModelInstances($dc);
},
'eval' => ['tl_class' => 'w50', 'mandatory' => true, 'multiple' => true],
'sql' => "blob NULL"
'sql' => "blob NULL",
],
// jump to
'useAlias' => [
Expand Down Expand Up @@ -473,10 +473,18 @@
'eval' => ['tl_class' => 'w50 clr', 'includeBlankOption' => true],
'sql' => "varchar(128) NOT NULL default ''",
],
'noSearch' => [
'label' => &$GLOBALS['TL_LANG']['tl_list_config']['noSearch'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => true,
'eval' => ['tl_class' => 'w50 clr'],
'sql' => "char(1) NOT NULL default ''",
],
],
];

$GLOBALS['TL_DCA']['tl_list_config']['fields']['useModalExplanation']['eval']['notOverridable'] = true;
$GLOBALS['TL_DCA']['tl_list_config']['fields']['numberOfItems']['eval']['tl_class'] = 'w50 clr';
$GLOBALS['TL_DCA']['tl_list_config']['fields']['numberOfItems']['eval']['tl_class'] = 'w50 clr';

\HeimrichHannot\ListBundle\Backend\ListConfig::addOverridableFields();
5 changes: 5 additions & 0 deletions src/Resources/contao/languages/de/tl_list_config.php
Expand Up @@ -90,6 +90,10 @@
$lang['stampBlock'][0] = 'Block';
$lang['stampBlock'][1] = 'Wählen Sie hier einen Block aus.';

// search
$lang['noSearch'][0] = 'Nicht durchsuchen';
$lang['noSearch'][1] = 'Diese Liste nicht in den Suchindex aufnehmen.';

// template
$lang['itemTemplate'][0] = 'Listen-Template';
$lang['itemTemplate'][1] = 'Wählen Sie hier das Template aus, mit dem Liste gerendert werden sollen.';
Expand All @@ -107,6 +111,7 @@
$lang['sorting_legend'] = 'Sortierung';
$lang['jumpto_legend'] = 'Weiterleitung';
$lang['misc_legend'] = 'Verschiedenes';
$lang['search_legend'] = 'Sucheinstellungen';
$lang['template_legend'] = 'Template';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/templates/mod_list.html5
@@ -1,4 +1,4 @@
<?php $this->extend('block_searchable'); ?>
<?php $this->extend($this->noSearch ? 'block_unsearchable' : 'block_searchable'); ?>
<?php $this->block('content'); ?>
<?= $this->list(); ?>
<?php $this->endblock(); ?>

0 comments on commit 608d0c1

Please sign in to comment.