Refactoring auto-complete functionality for alias editor and auto tagger

This commit is contained in:
myname 2023-11-16 22:10:14 -06:00 committed by Shish
parent e5c8bf7b18
commit 85b1e54904
3 changed files with 38 additions and 4 deletions

View 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}"]
]);
}
}

View file

@ -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"];

View file

@ -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"];