Fix UI collapse support options (including open on start) a766a348f0 (commitcomment-44636896)

This commit is contained in:
Ilia Rostovtsev
2020-11-29 21:48:51 +03:00
parent 0de015ebf6
commit 3f8991ce04
2 changed files with 16 additions and 8 deletions

View File

@ -82,7 +82,10 @@ if ($r == 0) {
print &ui_alert_box($text{'index_notrun'}, 'danger');
if ($rout) {
print &ui_details($text{'syslog_desc2'}, &text('index_emsg', "<tt>$rout</tt>"), 'error');
print &ui_details({
'title' => $text{'syslog_desc2'},
'content' => &text('index_emsg',"<tt>$rout</tt>"),
'class' =>'error'});
}
if ($access{'stop'} && &is_mysql_local()) {
@ -102,8 +105,12 @@ elsif ($r == -1) {
print &ui_alert_box($text{'index_nopass'}, 'warn');
if ($rout) {
print &ui_details($text{'syslog_desc2'}, &text('index_emsg', "<tt>$rout</tt>"), 'error') . "<br>";
}
print &ui_details({
'title' => $text{'syslog_desc2'},
'content' => &text('index_emsg',"<tt>$rout</tt>"),
'class' => 'error',
'open' => 'open'}) . "<br>";
}
print &ui_form_start("login.cgi", "post");
print &ui_table_start($text{'index_ltitle'}, undef, 2);

View File

@ -2731,15 +2731,16 @@ the widget is toggled into an "open" state.
=cut
sub ui_details
{
my ($title, $content, $class) = @_;
my ($c) = @_;
if (defined(&theme_ui_details)) {
return &theme_ui_details(@_);
}
my $rv;
$class = " class=\"$class\"" if($class);
$rv = "<details$class>";
$rv .= "<summary>$title</summary>";
$rv .= "$content";
$c->{'class'} = "class=\"$c->{'class'}\"" if($c->{'class'});
$rv = "<details $c->{'class'} $c->{'open'}>";
$rv .= "<summary>$c->{'title'}</summary>";
$rv .= "$c->{'content'}";
$rv .= "</details>";
return $rv;
}