From 2787028069d5547a3976fae78d60f0f5234ba80e Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 13 Feb 2023 11:57:10 +0800 Subject: [PATCH] fix(user): hide hidden problems --- web/app/models/HTML.php | 6 +++--- web/app/models/UOJProblem.php | 2 +- web/app/views/user-info.php | 21 ++++++++++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/web/app/models/HTML.php b/web/app/models/HTML.php index fa5b242..aeab070 100644 --- a/web/app/models/HTML.php +++ b/web/app/models/HTML.php @@ -307,17 +307,17 @@ class HTML { } public static function link(?string $uri, $text, $cfg = []) { - $cfg += ['location' => 'main', 'escape' => true]; + $cfg += ['location' => 'main', 'escape' => true, 'class' => '']; if ($cfg['escape']) { $text = HTML::escape($text); } if ($uri === null) { - return HTML::tag('a', [], $text); + return HTML::tag('a', ['class' => $cfg['class']], $text); } - return HTML::tag('a', ['href' => HTML::url($uri, $cfg)], $text); + return HTML::tag('a', ['href' => HTML::url($uri, $cfg), 'class' => $cfg['class']], $text); } public static function autolink(string $url, array $attr = [], $cfg = []) { diff --git a/web/app/models/UOJProblem.php b/web/app/models/UOJProblem.php index cc97442..465778e 100644 --- a/web/app/models/UOJProblem.php +++ b/web/app/models/UOJProblem.php @@ -367,7 +367,7 @@ class UOJProblem { } public function getLink(array $cfg = []) { - return HTML::link($this->getUri(), $this->getTitle($cfg), ['escape' => false]); + return HTML::link($this->getUri(), $this->getTitle($cfg), ['escape' => false, 'class' => $cfg['class'] ?: '']); } public function getAttachmentUri() { diff --git a/web/app/views/user-info.php b/web/app/views/user-info.php index 6cb986f..e5d1c63 100644 --- a/web/app/views/user-info.php +++ b/web/app/views/user-info.php @@ -252,17 +252,24 @@
- +