Refactoring auto-complete functionality for alias editor and auto tagger
This commit is contained in:
parent
e5c8bf7b18
commit
85b1e54904
3 changed files with 38 additions and 4 deletions
34
core/imageboard/autocomplete_column.php
Normal file
34
core/imageboard/autocomplete_column.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shimmie2;
|
||||
|
||||
use MicroCRUD\TextColumn;
|
||||
|
||||
use function MicroHTML\INPUT;
|
||||
|
||||
class AutoCompleteColumn extends TextColumn
|
||||
{
|
||||
public function read_input(array $inputs)
|
||||
{
|
||||
return INPUT([
|
||||
"type" => "text",
|
||||
"name" => "r_{$this->name}",
|
||||
"class" => "autocomplete_tags",
|
||||
"placeholder" => $this->title,
|
||||
"value" => @$inputs["r_{$this->name}"]
|
||||
]);
|
||||
}
|
||||
|
||||
public function create_input(array $inputs)
|
||||
{
|
||||
return INPUT([
|
||||
"type" => "text",
|
||||
"name" => "c_{$this->name}",
|
||||
"class" => "autocomplete_tags",
|
||||
"placeholder" => $this->title,
|
||||
"value" => @$inputs["c_{$this->name}"]
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -19,8 +19,8 @@ class AliasTable extends Table
|
|||
$this->size = 100;
|
||||
$this->limit = 1000000;
|
||||
$this->set_columns([
|
||||
new TextColumn("oldtag", "Old Tag"),
|
||||
new TextColumn("newtag", "New Tag"),
|
||||
new AutoCompleteColumn("oldtag", "Old Tag"),
|
||||
new AutoCompleteColumn("newtag", "New Tag"),
|
||||
new ActionColumn("oldtag"),
|
||||
]);
|
||||
$this->order_by = ["oldtag"];
|
||||
|
|
|
@ -21,8 +21,8 @@ class AutoTaggerTable extends Table
|
|||
$this->size = 100;
|
||||
$this->limit = 1000000;
|
||||
$this->set_columns([
|
||||
new TextColumn("tag", "Tag"),
|
||||
new TextColumn("additional_tags", "Additional Tags"),
|
||||
new AutoCompleteColumn("tag", "Tag"),
|
||||
new AutoCompleteColumn("additional_tags", "Additional Tags"),
|
||||
new ActionColumn("tag"),
|
||||
]);
|
||||
$this->order_by = ["tag"];
|
||||
|
|
Reference in a new issue