From 7fcc4f269bf9eb2c7e4b1b6bcbca224b32e35c26 Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Tue, 10 Dec 2024 17:24:22 -0500 Subject: [PATCH] Improve display of profile topic interest table - A bit more spacing - Topics always get their own row --- src/options/o_checkboxesbase.php | 5 ++--- src/topicset.php | 21 ++++++++++++++------- src/userstatus.php | 11 ++++++++--- stylesheets/style.css | 6 +++--- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/options/o_checkboxesbase.php b/src/options/o_checkboxesbase.php index 337498374..99e229ce9 100644 --- a/src/options/o_checkboxesbase.php +++ b/src/options/o_checkboxesbase.php @@ -203,15 +203,14 @@ function print_web_edit(PaperTable $pt, $ov, $reqov) { "data-range-type" => $this->formid]; if (($isgroup = $tg->nontrivial())) { echo '
  • '; - if ($tg->improper()) { + if ($tg->has_group_topic()) { $arg["data-default-checked"] = in_array($tg->tid, $ov->value_list()); $checked = in_array($tg->tid, $reqov->value_list()); echo ''; } else { - echo '
    ', - htmlspecialchars($tg->name), '
    '; + echo '
    ', $tg->unparse_name_html(), '
    '; } echo '
    '; } diff --git a/src/topicset.php b/src/topicset.php index b97fafc35..e641f5993 100644 --- a/src/topicset.php +++ b/src/topicset.php @@ -6,7 +6,7 @@ class TopicGroup { /** @var string */ public $name; // never contains a colon /** @var ?int */ - public $tid; // if nonnull, its name equals the group name + public $tid; // if nonnull, the group name is also a topic name /** @var ?list */ public $members; // if nonnull, contains all members @@ -15,11 +15,15 @@ function __construct($name) { $this->name = $name; } /** @return bool */ + function trivial() { + return $this->members === null || count($this->members) <= 1; + } + /** @return bool */ function nontrivial() { return $this->members !== null && count($this->members) > 1; } /** @return bool */ - function improper() { + function has_group_topic() { return $this->tid !== null; } /** @return int */ @@ -39,6 +43,11 @@ function proper_members() { } return $this->members; } + /** @param string $suffix + * @return string */ + function unparse_name_html($suffix = "") { + return '' . htmlspecialchars($this->name) . $suffix . ''; + } } class TopicSet implements ArrayAccess, IteratorAggregate, Countable { @@ -405,12 +414,10 @@ function unparse_name_html($tid) { $tg = ($this->group_map())[$tid]; if ($tg->nontrivial()) { if ($tg->tid === $tid) { - $this->_topic_html[$tid] = '' - . htmlspecialchars($tg->name) . ''; + $this->_topic_html[$tid] = $tg->unparse_name_html(); } else { - $this->_topic_html[$tid] = '' - . htmlspecialchars($tg->name) . ': ' - . htmlspecialchars(ltrim(substr($tname, strlen($tg->name) + 1))); + $this->_topic_html[$tid] = $tg->unparse_name_html(":") + . ' ' . htmlspecialchars(ltrim(substr($tname, strlen($tg->name) + 1))); } } else { $this->_topic_html[$tid] = htmlspecialchars($tname); diff --git a/src/userstatus.php b/src/userstatus.php index 97ce8f0c1..a687e1ec9 100644 --- a/src/userstatus.php +++ b/src/userstatus.php @@ -1714,7 +1714,7 @@ static function print_topics(UserStatus $us) { topics. We use this information to help match papers to reviewers.

    ', Ht::hidden("has_ti", 1), $us->feedback_html_at("ti"), - ' + '
    ', "\n"; @@ -1724,9 +1724,14 @@ static function print_topics(UserStatus $us) { foreach ($ts->group_list() as $tg) { foreach ($tg->members() as $i => $tid) { $tic = "ti_topic"; - if ($i === 0) { + if ($tg->trivial() || ($i === 0 && $tg->has_group_topic())) { $n = $ts->unparse_name_html($tid); } else { + if ($i == 0) { + echo " \n"; + } $n = $ts->unparse_subtopic_name_html($tid); $tic .= " ti_subtopic"; } @@ -1736,7 +1741,7 @@ static function print_topics(UserStatus $us) { for ($j = -2; $j <= 2; ++$j) { $ichecked = $ival >= $ibound[$j+2] && $ival < $ibound[$j+3]; $reqchecked = $reqval >= $ibound[$j+2] && $reqval < $ibound[$j+3]; - echo '"; + echo '"; } echo "\n"; } diff --git a/stylesheets/style.css b/stylesheets/style.css index 7022d82c4..6fa6fe46c 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -2938,14 +2938,14 @@ del .rto { } .ti_interest { - padding-right: 1px; + padding: 2px 1px 2px 0; white-space: nowrap; font-size: smaller; text-align: center; min-width: 2.2rem; } .ti_topic { - padding-right: 0.5em; + padding: 2px 0.5em 2px 6px; } .ti_subtopic { padding-left: 1.75em; @@ -2953,7 +2953,7 @@ del .rto { table.reviewers, div.revnotes { margin-bottom: 8px; } -table.reviewers { +table.reviewers, table.profile-topic-interests { margin-left: -6px; } td.rl:first-child {
    LowHigh
    ", + $tg->unparse_name_html(), + "
    ', Ht::radio("ti$tid", $j, $reqchecked, ["class" => "uic js-range-click", "data-range-type" => "topicinterest$j", "data-default-checked" => $ichecked]), "', Ht::radio("ti{$tid}", $j, $reqchecked, ["class" => "uic js-range-click", "data-range-type" => "topicinterest{$j}", "data-default-checked" => $ichecked]), "