Skip to content

Commit a79d8ab

Browse files
committed
added search on admin tables
+ fixes
1 parent 841cf85 commit a79d8ab

File tree

18 files changed

+658
-653
lines changed

18 files changed

+658
-653
lines changed

app/base/abstracts/AdminManageModelsPage.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ public function __construct(ContainerInterface $container)
4040
];
4141
if (is_array($paginate_params['condition'])) {
4242
foreach ($paginate_params['condition'] as $col => $search) {
43-
$paginate_params['condition'][$col . ' LIKE ?'] = ['%'.$search.'%'];
43+
if (trim($search) == '') {
44+
continue;
45+
}
46+
$paginate_params['condition']['`'.$col . '` LIKE ?'] = ['%'.$search.'%'];
4447
unset($paginate_params['condition'][$col]);
4548
}
49+
50+
$paginate_params['condition'] = array_filter($paginate_params['condition']);
4651
}
4752

4853
$data = $this->getContainer()->call([$this->getObjectClass(), 'paginate'], $paginate_params);

app/site/controllers/Admin/Blocks.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ function ($el) {
147147
'validate' => ['required'],
148148
]
149149
)
150-
->addField(
151-
'title',
152-
[
153-
'type' => 'textfield',
154-
'title' => 'Title',
155-
'default_value' => $block_title,
156-
'validate' => ['required'],
157-
]
158-
);
150+
->addField(
151+
'title',
152+
[
153+
'type' => 'textfield',
154+
'title' => 'Title',
155+
'default_value' => $block_title,
156+
'validate' => ['required'],
157+
]
158+
);
159159
if ($type == 'new' || $block->instance_class == Block::class) {
160160
$form->addField(
161161
'locale',
@@ -167,18 +167,18 @@ function ($el) {
167167
'validate' => ['required'],
168168
]
169169
)
170-
->addField(
171-
'content',
172-
[
173-
'type' => 'tinymce',
174-
'title' => 'Content',
175-
'tinymce_options' => [
176-
'plugins' => "code,link,lists,hr,preview,searchreplace,media mediaembed,table,powerpaste",
177-
],
178-
'default_value' => $block_content,
179-
'rows' => 20,
180-
]
181-
);
170+
->addField(
171+
'content',
172+
[
173+
'type' => 'tinymce',
174+
'title' => 'Content',
175+
'tinymce_options' => [
176+
'plugins' => "code,link,lists,hr,preview,searchreplace,media mediaembed,table,powerpaste",
177+
],
178+
'default_value' => $block_content,
179+
'rows' => 20,
180+
]
181+
);
182182
}
183183
$form->addField(
184184
'rewrites',
@@ -190,14 +190,14 @@ function ($el) {
190190
'options' => $rewrite_options,
191191
]
192192
)
193-
->addField(
194-
'order',
195-
[
196-
'type' => 'textfield',
197-
'title' => 'Order',
198-
'default_value' => $block_order,
199-
]
200-
);
193+
->addField(
194+
'order',
195+
[
196+
'type' => 'textfield',
197+
'title' => 'Order',
198+
'default_value' => $block_order,
199+
]
200+
);
201201

202202

203203
if ($block != null && method_exists($block->getRealInstance(), 'additionalConfigFieldset')) {

app/site/controllers/Admin/Config.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -118,45 +118,45 @@ public function getFormDefinition(FAPI\Form $form, &$form_state)
118118
'validate' => ['required'],
119119
]
120120
)
121-
->addField(
122-
'website_id',
123-
[
124-
'type' => 'select',
125-
'title' => 'Website',
126-
'default_value' => $configuration_website,
127-
'options' => $websites,
128-
'validate' => ['required'],
129-
]
130-
)
131-
->addField(
132-
'locale',
133-
[
134-
'type' => 'select',
135-
'title' => 'Locale',
136-
'default_value' => $configuration_locale,
137-
'options' => $languages,
138-
// 'validate' => ['required'],
139-
]
140-
)
141-
->addField(
142-
'value',
143-
[
144-
'type' => 'textarea',
145-
'title' => 'Configuration Value',
146-
'default_value' => $configuration_value,
147-
'rows' => 3,
148-
// 'validate' => ['required'],
149-
]
150-
)
151-
->addField(
152-
'button',
153-
[
154-
'type' => 'submit',
155-
'value' => 'ok',
156-
'container_class' => 'form-item mt-3',
157-
'attributes' => ['class' => 'btn btn-primary btn-lg btn-block'],
158-
]
159-
);
121+
->addField(
122+
'website_id',
123+
[
124+
'type' => 'select',
125+
'title' => 'Website',
126+
'default_value' => $configuration_website,
127+
'options' => $websites,
128+
'validate' => ['required'],
129+
]
130+
)
131+
->addField(
132+
'locale',
133+
[
134+
'type' => 'select',
135+
'title' => 'Locale',
136+
'default_value' => $configuration_locale,
137+
'options' => $languages,
138+
// 'validate' => ['required'],
139+
]
140+
)
141+
->addField(
142+
'value',
143+
[
144+
'type' => 'textarea',
145+
'title' => 'Configuration Value',
146+
'default_value' => $configuration_value,
147+
'rows' => 3,
148+
// 'validate' => ['required'],
149+
]
150+
)
151+
->addField(
152+
'button',
153+
[
154+
'type' => 'submit',
155+
'value' => 'ok',
156+
'container_class' => 'form-item mt-3',
157+
'attributes' => ['class' => 'btn btn-primary btn-lg btn-block'],
158+
]
159+
);
160160
break;
161161

162162
case 'delete':
@@ -237,8 +237,8 @@ protected function getTableHeader()
237237
return [
238238
'ID' => 'id',
239239
'Website' => 'website_id',
240-
'Locale' => 'locale',
241-
'Path' => 'path',
240+
'Locale' => ['order' => 'locale', 'search' => 'locale'],
241+
'Path' => ['order' => 'path', 'search' => 'path'],
242242
'Value' => null,
243243
'Is System' => 'is_system',
244244
'actions' => null,

app/site/controllers/Admin/ContactForms.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,9 @@ protected function getTableHeader()
516516
return [
517517
'ID' => 'id',
518518
'Website' => 'website_id',
519-
'Title' => 'title',
520-
'Locale' => 'locale',
521-
'URL' => 'url',
519+
'Title' => ['order' => 'title', 'search' => 'title'],
520+
'Locale' => ['order' => 'locale', 'search' => 'locale'],
521+
'URL' => ['order' => 'url', 'search' => 'url'],
522522
'# Submissions' => null,
523523
'actions' => null,
524524
];

app/site/controllers/Admin/Cron.php

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -158,48 +158,48 @@ public function getFormDefinition(FAPI\Form $form, &$form_state)
158158
'validate' => ['required'],
159159
]
160160
)
161-
->addField(
162-
'cron_task_callable',
163-
[
164-
'type' => 'textfield',
165-
'title' => 'Callable',
166-
'default_value' => $task_callable,
167-
'validate' => ['required'],
168-
]
169-
)
170-
->addField(
171-
'schedule',
172-
[
173-
'type' => 'textfield',
174-
'title' => 'Schedule',
175-
'default_value' => $task_schedule,
176-
'validate' => ['required'],
177-
]
178-
)
179-
->addField(
180-
'active',
181-
[
182-
'type' => 'switchbox',
183-
'title' => 'Active',
184-
// 'value' => boolval($task_active) ? 1 : 0,
185-
// 'default_value' => 1,
186-
'default_value' => boolval($task_active) ? 1 : 0,
187-
'yes_value' => 1,
188-
'yes_label' => 'Yes',
189-
'no_value' => 0,
190-
'no_label' => 'No',
191-
'field_class' => 'switchbox',
192-
]
193-
)
194-
->addField(
195-
'button',
196-
[
197-
'type' => 'submit',
198-
'value' => 'ok',
199-
'container_class' => 'form-item mt-3',
200-
'attributes' => ['class' => 'btn btn-primary btn-lg btn-block'],
201-
]
202-
);
161+
->addField(
162+
'cron_task_callable',
163+
[
164+
'type' => 'textfield',
165+
'title' => 'Callable',
166+
'default_value' => $task_callable,
167+
'validate' => ['required'],
168+
]
169+
)
170+
->addField(
171+
'schedule',
172+
[
173+
'type' => 'textfield',
174+
'title' => 'Schedule',
175+
'default_value' => $task_schedule,
176+
'validate' => ['required'],
177+
]
178+
)
179+
->addField(
180+
'active',
181+
[
182+
'type' => 'switchbox',
183+
'title' => 'Active',
184+
// 'value' => boolval($task_active) ? 1 : 0,
185+
// 'default_value' => 1,
186+
'default_value' => boolval($task_active) ? 1 : 0,
187+
'yes_value' => 1,
188+
'yes_label' => 'Yes',
189+
'no_value' => 0,
190+
'no_label' => 'No',
191+
'field_class' => 'switchbox',
192+
]
193+
)
194+
->addField(
195+
'button',
196+
[
197+
'type' => 'submit',
198+
'value' => 'ok',
199+
'container_class' => 'form-item mt-3',
200+
'attributes' => ['class' => 'btn btn-primary btn-lg btn-block'],
201+
]
202+
);
203203
break;
204204

205205
case 'delete':
@@ -299,9 +299,9 @@ protected function getTableHeader()
299299
{
300300
return [
301301
'ID' => 'id',
302-
'Title' => 'title',
303-
'Callable' => 'cron_task_callable',
304-
'Schedule' => 'schedule',
302+
'Title' => ['order' => 'title', 'search' => 'title'],
303+
'Callable' => ['order' => 'cron_task_callable', 'search' => 'cron_task_callable'],
304+
'Schedule' => ['order' => 'schedule', 'search' => 'schedule'],
305305
'Active' => 'active',
306306
'actions' => null,
307307
];

0 commit comments

Comments
 (0)