core&ui: fix bugs and add hint (#635)

Co-authored-by: panda <panda_dtdyy@outlook.com>
pull/651/head
panda 1 year ago committed by GitHub
parent e02d8b5d43
commit 7687b99f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,11 +42,13 @@ homework_main: Homework
homework_scoreboard: Scoreboard
judge_playground: Judge Playground
main: Home
manage_config: System Configurations
manage_dashboard: System
manage_module: Module Management
manage_script: Scripts
manage_setting: System Settings
manage_user_import: Import Users
manage_user_priv: User Privilege
manage: System Manage
no_translation_warn: <blockquote class="warn">This part of content is under translation.</blockquote>
page.problem_detail.sidebar.show_category: Click to Show

@ -322,7 +322,10 @@ class DiscussionDetailHandler extends DiscussionHandler {
@param('drrid', Types.ObjectId)
async postDeleteTailReply(domainId: string, drid: ObjectId, drrid: ObjectId) {
const deleteBy = this.user.own(this.drrdoc) ? 'self' : 'Admin';
if (!this.user.own(this.drrdoc)) this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY);
if (!(this.user.own(this.drrdoc)
&& this.user.hasPerm(PERM.PERM_DELETE_DISCUSSION_REPLY_SELF))) {
this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY);
}
const msg = JSON.stringify({
message: 'Admin {0} delete your discussion tail reply {1} in "{2}"({3:link}).',
params: [

@ -40,8 +40,9 @@ $font-size-icon = 16px
$font-size-title = 20px
// components
$section-gap-v = 25px
$section-gap-v = 15px
$section-gap-h = $grid-padding
$section-list-v = 25px
$section-margin = 30px
$section-shadow = rem(0 6px 22px) rgba(#AFC2C9, 0.5)
$section-bg-color = $content-bg-color

@ -0,0 +1,9 @@
.hint
font-size: $font-size-small
position: relative
top: $nav-item-height
z-index: 99
left: 0
width: 100%
color: #e58900
background: #fff0e3;

@ -59,8 +59,10 @@ class LegacyModeHandler extends Handler {
noCheckPermView = true;
@param('legacy', Types.Boolean)
async get(domainId: string, legacy = false) {
@param('nohint', Types.Boolean)
async get(domainId: string, legacy = false, nohint = false) {
this.session.legacy = legacy;
this.session.nohint = nohint;
this.back();
}
}

@ -484,6 +484,7 @@ Learn More: 了解更多
Leave blank to use numeric pid.: 留空来使用数字题号。
Leave empty for default: 留空以使用默认
Ledo: 乐多
Legacy mode: 兼容模式
Light: 亮色
Limit user to finish contest within N hours: 限制用户在N小时内完成比赛
Limitations: 限制
@ -817,6 +818,7 @@ Sorry, there are no users in this domain.: 对不起,此域中没有用户。
Sorry: 对不起
Sort by: 排序
Source type: 来源类型
Standard mode: 标准模式
Star Topic: 收藏讨论
Star: 收藏
Starred Users: 关注用户
@ -1005,6 +1007,7 @@ With this feature, you can copy problems that you can view from a domain to some
Write Your Comment: 发表您的评论
Write Your Solution: 发表您的题解
Year:
You are currently in legacy mode. Some additional features will be unavailable. We strongly recommend switching to standard mode on a modern browser.: 您当前处于兼容模式。某些功能在此模式下不可用。我们强烈建议在现代浏览器上切换为标准模式以获得更好的体验。
You are not allowed to join the domain. The link is either invalid or expired.: 您无法加入该域,链接无效或已过期。
You can also upload your avatar to Gravatar and it will be automatically updated here.: 你也可以将头像上传到 <a href="https://gravatar.com/">Gravatar</a>,本站的头像将自动更新。
You can create your own training plans and share them with others.: 您可以创建您自己的训练计划并且与他人分享。

@ -33,6 +33,12 @@
padding: rem($section-gap-v) rem($section-gap-h) 0
position: relative
&:last-child
padding-bottom: rem($section-gap-v)
+.section__body.no-padding:last-child
padding-top: rem($section-gap-v) !important
.section__body
padding: 0.7em rem($section-gap-h)
@ -92,7 +98,7 @@ h3.section__title
color: $section-toolbtn-color-hover
.section__list__item
padding: rem($section-gap-v $section-gap-h)
padding: rem($section-list-v $section-gap-h)
border-bottom: 1px solid $table-border-color
&:last-child

@ -221,7 +221,7 @@ export default new NamedPage(['problem_create', 'problem_edit'], (pagename) => {
}
async function handleClickDownloadAll() {
const files = $('.additionalfile-table tr').map(function () { return $(this).attr('data-filename'); }).get();
const files = $('.additional_file-table tr').map(function () { return $(this).attr('data-filename'); }).get();
const { links, pdoc } = await request.post('./files', { operation: 'get_links', files, type: 'additional_file' });
const targets = [];
for (const filename of Object.keys(links)) targets.push({ filename, url: links[filename] });

@ -234,7 +234,7 @@ function hideTags(target) {
}
const categoryDialog: any = new Dialog({
$body: $('.dialog--category-filter'),
$body: $('.dialog--category-filter > div'),
cancelByClickingBack: true,
cancelByEsc: true,
});

@ -14,12 +14,10 @@
comment_ref,
reply_ref,
comment_post_perm,
comment_edit_perm,
comment_edit_self_perm,
comment_delete_perm,
comment_delete_self_perm,
reply_post_perm,
reply_edit_perm,
reply_edit_self_perm,
reply_delete_perm,
reply_delete_self_perm,
@ -101,7 +99,7 @@
{% if handler.user.hasPerm(reply_post_perm) %}
{{ action(_('Reply'), 'reply', 'comment', {operation: reply_post_op, drid: doc._id}, 'reply') }}
{% endif %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_edit_perm) %}
{% if handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc) %}
{{ action(_('Edit'), 'edit', 'comment', {operation: comment_edit_op, drid: doc._id}, 'edit') }}
{% endif %}
{% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %}
@ -142,10 +140,10 @@
{% if handler.user.hasPerm(reply_post_perm) %}
{{ action(_('Reply'), 'reply', 'reply', {}, 'reply') }}
{% endif %}
{% if handler.user.own(doc) or handler.user.hasPerm(reply_edit_perm) %}
{% if handler.user.own(rdoc) and handler.user.hasPerm(reply_edit_self_perm) %}
{{ action(_('Edit'), 'edit', 'reply', {operation: reply_edit_op, drid: doc._id, drrid: rdoc._id}, 'edit') }}
{% endif %}
{% if handler.user.own(doc) or handler.user.hasPerm(reply_delete_perm) %}
{% if (handler.user.own(rdoc) and handler.user.hasPerm(reply_delete_self_perm)) or handler.user.hasPerm(reply_delete_perm) %}
{{ action(_('Delete'), 'delete', 'reply', {operation: reply_delete_op, drid: doc._id, drrid: rdoc._id}, 'delete') }}
{% endif %}
</div>

@ -91,13 +91,11 @@
reply_edit_op = 'edit_tail_reply',
reply_delete_op = 'delete_tail_reply',
comment_post_perm = perm.PERM_REPLY_DISCUSSION,
comment_edit_perm = perm.PERM_NEVER,
comment_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if handler.user.own(ddoc) else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
comment_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF,
reply_post_perm = perm.PERM_REPLY_DISCUSSION,
reply_edit_perm = perm.PERM_NEVER,
reply_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if handler.user.own(ddoc) else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY,
reply_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
reply_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF,
reactions = reactions,

@ -3,6 +3,14 @@
{% block body %}
{% if UserContext %}{% include "partials/nav.html" %}{% endif %}
<div class="slideout-panel" id="panel">
{% if handler.session.legacy and not handler.session.nohint %}
<div class="typo hint flex-row flex-main-center flex-cross-center">
<p>
{{ _('You are currently in legacy mode. Some additional features will be unavailable. We strongly recommend switching to standard mode on a modern browser.') }}
<a href="/legacy">{{ _('Standard mode') }}</a> <a href="/legacy?legacy=true&nohint=true">{{ _('Hidden') }}</a>
</p>
</div>
{% endif %}
<div class="slideout-overlay"></div>
{% if UserContext %}{% include "partials/header_mobile.html" %}{% endif %}
<div class="main">

@ -1,41 +1,43 @@
{% set _categories = (handler.domain.problemCategories or model.system.get('problem.categories'))|parseYaml %}
<div class="dialog--category-filter">
<div class="category-filter__header">
<div class="list flex-row flex-cross-center" data-category-container>
{%- for category, sub_categories in _categories -%}
<div class="list__item" data-category="{{category}}">{{ category }}</div>
{%- endfor -%}
<div class="dialog--category-filter" style="display:none;">
<div>
<div class="category-filter__header">
<div class="list flex-row flex-cross-center" data-category-container>
{%- for category, sub_categories in _categories -%}
<div class="list__item" data-category="{{category}}">{{ category }}</div>
{%- endfor -%}
</div>
</div>
</div>
<div class="category-filter__body">
{%- for category, sub_categories in _categories -%}
<div class="section__body subcategory-container hide" data-subcategory-container="{{ category }}">
<div class="subcategory__selected">
<h2>{{ _('Selected categories') }}: </h2>
<div class="list flex-row flex-wrap">
<div class="chip-list__item search-tag__item hide selected" data-selection="category:{{ category }}">
{{ category }}
<span class="icon icon-close"></span>
</div>
{%- for sub_category in sub_categories -%}
<div class="chip-list__item search-tag__item hide selected" data-selection="category:{{ sub_category }}">
{{ sub_category }}
<span class="icon icon-close"></span>
<div class="category-filter__body">
{%- for category, sub_categories in _categories -%}
<div class="section__body subcategory-container hide" data-subcategory-container="{{ category }}">
<div class="subcategory__selected">
<h2>{{ _('Selected categories') }}: </h2>
<div class="list flex-row flex-wrap">
<div class="chip-list__item search-tag__item hide selected" data-selection="category:{{ category }}">
{{ category }}
<span class="icon icon-close"></span>
</div>
{%- for sub_category in sub_categories -%}
<div class="chip-list__item search-tag__item hide selected" data-selection="category:{{ sub_category }}">
{{ sub_category }}
<span class="icon icon-close"></span>
</div>
{%- endfor -%}
</div>
{%- endfor -%}
</div>
<div class="divider"></div>
<div class="subcategory__all">
<h2>{{ category }}: </h2>
<div class="list flex-row flex-wrap">
<div class="chip-list__item search-tag__item" data-selection="category:{{ category }}">{{ category }}</div>
{%- for sub_category in sub_categories -%}
<div class="chip-list__item search-tag__item" data-selection="category:{{ sub_category }}">{{ sub_category }}</div>
{%- endfor -%}
</div>
</div>
</div>
<div class="divider"></div>
<div class="subcategory__all">
<h2>{{ category }}: </h2>
<div class="list flex-row flex-wrap">
<div class="chip-list__item search-tag__item" data-selection="category:{{ category }}">{{ category }}</div>
{%- for sub_category in sub_categories -%}
<div class="chip-list__item search-tag__item" data-selection="category:{{ sub_category }}">{{ sub_category }}</div>
{%- endfor -%}
</div>
</div>
{%- endfor -%}
</div>
{%- endfor -%}
</div>
</div>
Loading…
Cancel
Save