[core] allow SHM_POST_INFO html element to accept a link parameter
This commit is contained in:
parent
209e9b4ab5
commit
9e9225acf3
2 changed files with 13 additions and 10 deletions
|
@ -154,9 +154,10 @@ function SHM_OPTION(string $value, string $text, bool $selected = false): HTMLEl
|
||||||
}
|
}
|
||||||
|
|
||||||
function SHM_POST_INFO(
|
function SHM_POST_INFO(
|
||||||
HTMLElement|string $title,
|
string $title,
|
||||||
HTMLElement|string|null $view = null,
|
HTMLElement|string|null $view = null,
|
||||||
HTMLElement|string|null $edit = null,
|
HTMLElement|string|null $edit = null,
|
||||||
|
string|null $link = null,
|
||||||
): HTMLElement {
|
): HTMLElement {
|
||||||
if(!is_null($view) && !is_null($edit)) {
|
if(!is_null($view) && !is_null($edit)) {
|
||||||
$show = emptyHTML(
|
$show = emptyHTML(
|
||||||
|
@ -170,5 +171,9 @@ function SHM_POST_INFO(
|
||||||
} else {
|
} else {
|
||||||
$show = "???";
|
$show = "???";
|
||||||
}
|
}
|
||||||
return TR(TH(["width" => "50px"], $title), TD($show));
|
return TR(
|
||||||
|
["data-row"=>$title],
|
||||||
|
TH(["width" => "50px"], $link ? A(["href" => $link], $title) : $title),
|
||||||
|
TD($show)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,6 @@ class TagEditTheme extends Themelet
|
||||||
}
|
}
|
||||||
|
|
||||||
return SHM_POST_INFO(
|
return SHM_POST_INFO(
|
||||||
Extension::is_enabled(TagHistoryInfo::KEY) ?
|
|
||||||
A(["href" => make_link("tag_history/{$image->id}")], "Tags") :
|
|
||||||
"Tags",
|
"Tags",
|
||||||
joinHTML(", ", $tag_links),
|
joinHTML(", ", $tag_links),
|
||||||
$user->can(Permissions::EDIT_IMAGE_TAG) ? INPUT([
|
$user->can(Permissions::EDIT_IMAGE_TAG) ? INPUT([
|
||||||
|
@ -66,7 +64,8 @@ class TagEditTheme extends Themelet
|
||||||
"value" => $image->get_tag_list(),
|
"value" => $image->get_tag_list(),
|
||||||
"id" => "tag_editor",
|
"id" => "tag_editor",
|
||||||
"autocomplete" => "off"
|
"autocomplete" => "off"
|
||||||
]) : null
|
]) : null,
|
||||||
|
link: Extension::is_enabled(TagHistoryInfo::KEY) ? make_link("tag_history/{$image->id}") : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,14 +95,13 @@ class TagEditTheme extends Themelet
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
return SHM_POST_INFO(
|
return SHM_POST_INFO(
|
||||||
Extension::is_enabled(SourceHistoryInfo::KEY) ?
|
"Source Link",
|
||||||
A(["href" => make_link("source_history/{$image->id}")], rawHTML("Source Link")) :
|
|
||||||
rawHTML("Source Link"),
|
|
||||||
DIV(
|
DIV(
|
||||||
["style" => "overflow: hidden; white-space: nowrap; max-width: 350px; text-overflow: ellipsis;"],
|
["style" => "overflow: hidden; white-space: nowrap; max-width: 350px; text-overflow: ellipsis;"],
|
||||||
$this->format_source($image->get_source())
|
$this->format_source($image->get_source())
|
||||||
),
|
),
|
||||||
$user->can(Permissions::EDIT_IMAGE_SOURCE) ? INPUT(["type" => "text", "name" => "tag_edit__source", "value" => $image->get_source()]) : null
|
$user->can(Permissions::EDIT_IMAGE_SOURCE) ? INPUT(["type" => "text", "name" => "tag_edit__source", "value" => $image->get_source()]) : null,
|
||||||
|
link: Extension::is_enabled(SourceHistoryInfo::KEY) ? make_link("source_history/{$image->id}") : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue