From 85b1e54904795613aa5483e470838cbc849ca625 Mon Sep 17 00:00:00 2001 From: myname Date: Thu, 16 Nov 2023 22:10:14 -0600 Subject: [PATCH] Refactoring auto-complete functionality for alias editor and auto tagger --- core/imageboard/autocomplete_column.php | 34 +++++++++++++++++++++++++ ext/alias_editor/main.php | 4 +-- ext/auto_tagger/main.php | 4 +-- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 core/imageboard/autocomplete_column.php diff --git a/core/imageboard/autocomplete_column.php b/core/imageboard/autocomplete_column.php new file mode 100644 index 000000000..50ce8fcad --- /dev/null +++ b/core/imageboard/autocomplete_column.php @@ -0,0 +1,34 @@ + "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}"] + ]); + } +} diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index 25632f229..c4c978425 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -19,8 +19,8 @@ public function __construct(\FFSPHP\PDO $db) $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"]; diff --git a/ext/auto_tagger/main.php b/ext/auto_tagger/main.php index a20084575..c9a4b707f 100644 --- a/ext/auto_tagger/main.php +++ b/ext/auto_tagger/main.php @@ -21,8 +21,8 @@ public function __construct(\FFSPHP\PDO $db) $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"];