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

Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
panda authored and GitHub committed 2023-08-27 01:58:32 +08:00
1 parent e02d8b5d43
commit 7687b99f07
13 files changed
+81 -49

No files matched your search

@@ -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>
<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 class="category-filter__body">
{%- for category, sub_categories in _categories -%}
<div class="list__item" data-category="{{category}}">{{ category }}</div>
<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>
</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>
{%- endfor -%}
</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>
{%- endfor -%}
</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>
</div>
{%- endfor -%}
</div>
</div>