修复discussion模块

This commit is contained in:
undefined committed 2020-05-01 18:43:40 +08:00
1 parent 2554cf660a
commit 33e277f28f
30 files changed
+2460 -187

No files matched your search

+1 -1
View File
@@ -72,7 +72,7 @@
{{ form_attr('select', args) }}
>
{% for k, v in args.options %}
<option value="{{ k }}"{% if value == k %} selected{% endif %}>
<option value="{{ k }}"{% if args.value == k %} selected{% endif %}>
{{ _(v) }}
</option>
{% endfor %}
+2 -1
View File
@@ -1,10 +1,11 @@
{% set page_name = "discussion_create" %}
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Create Discussion in {0}').format(title) }}</h1>
<h1 class="section__title">{{ _('Create Discussion in {0}').format(vnode.title) }}</h1>
</div>
<div class="section__body">
<form method="post">
+4 -3
View File
@@ -1,5 +1,6 @@
{% set page_name = "discussion_detail" %}
{% extends "layout/basic.html" %}
{% import "components/comments.html" as comments with context %}
{% import "components/comments_discussion.html" as comments with context %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
@@ -68,7 +69,7 @@
comment_delete_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_post_perm = perm.PERM_REPLY_DISCUSSION,
reply_edit_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY
) }}
{{ paginator.render(page, pcount) }}
{% if drcount == 0 %}
@@ -80,7 +81,7 @@
<div class="medium-3 columns">
{% set udoc = udict[ddoc['owner']] %}
<div class="section side">
<div class="profile__bg user-profile-bg--{{ vj4.model.adaptor.setting.UserSetting(udoc).get_setting('background_img') }}"></div>
<div class="profile__bg user-profile-bg--1"></div>
<div class="section__body">
<div class="media sidebar-user-profile">
<div class="media__left">
+4 -19
View File
@@ -48,35 +48,20 @@
</thead>
<tbody>
{% for role in roles %}
{% if role._id not in ['default', 'guest', 'root'] %}
<tr data-role="{{ role._id }}">
{% set isBuiltin = role._id not in ['default', 'guest', 'root'] %}
<tr{% if isBuiltin %} data-role="{{ role._id }}"{% endif %}>
<td class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" data-checkbox-group="role" data-checkbox-range>
<input type="checkbox" data-checkbox-group="role" {{ "data-checkbox-range" if isBuiltin else "disabled" }}>
</label>
</td>
<td class="col--id">
{{ _('User-defined role') }}: {{ role._id }}
</td>
<td class="col--users">
{{ role.count }}
</td>
</tr>
{% else %}
<tr>
<td class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" data-checkbox-group="role" disabled>
</label>
</td>
<td class="col--id">
{{ _('Built-in') }}: {{ role._id }}
{{ _('Built-in') if isBuiltin else _('User-defined role') }}: {{ role._id }}
</td>
<td class="col--users">
{{ role.count|default('--') }}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
+4 -8
View File
@@ -50,7 +50,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('{0}: Users').format(system.uname) }}</h1>
<div class="section__tools">
<button class="primary rounded button" name="add_user">{{ _('Add User to Domain') }}</button>
<button class="primary rounded button" name="add_user">{{ _('Add User') }}</button>
</div>
</div>
{{ noscript_note.render() }}
@@ -71,13 +71,12 @@
</th>
<th class="col--uid">{{ _('User ID') }}</th>
<th class="col--user">{{ _('Username') }}</th>
<th class="col--user">{{ _('Display Name') }}</th>
<th class="col--role">{{ _('Role') }}</th>
</tr>
</thead>
<tbody>
{% for role in roles %}
{% for rudoc in rudocs[role] %}
{% for rudoc in rudocs[role._id] %}
{% set is_disabled=(rudoc._id == handler.user._id) %}
<tr data-uid="{{ rudoc._id }}">
<td class="col--checkbox">
@@ -91,14 +90,11 @@
<td class="col--user">
{{ user.render_inline(udict[rudoc._id], badge=false) }}
</td>
<td class="col--name-alias">
{{ rudoc.displayName|default('') }}
</td>
<td class="col--role">
{{ form.select({
options:rolesSelect,
name:'role',
value:rudoc['role'],
value:rudoc.role,
extra_class:'compact',
disabled:is_disabled
}) }}
@@ -110,7 +106,7 @@
</table>
</div>
<div class="section__body">
<button class="rounded button" name="remove_selected">{{ _('Remove Selected User from Domain') }}</button>
<button class="rounded button" name="remove_selected">{{ _('Remove Selected User') }}</button>
<button class="rounded button" name="set_roles">{{ _('Set Roles for Selected User') }}</button>
</div>
</div>
+1 -1
View File
@@ -37,7 +37,7 @@
<!--[if lte IE 8]>
<script type="text/javascript" src="{{ static_url('shim.js') }}"></script>
<![endif]-->
<script type="text/javascript" src="{{ static_url('locale/{0}.js'.format(handler.user.lang)) }}"></script>
<script type="text/javascript" src="{{ static_url('locale/{0}.js'.format(handler.user.viewLang)) }}"></script>
<script type="text/javascript" src="{{ static_url('vj4.js') }}"></script>
</body>
</html>
+1 -1
View File
@@ -3,7 +3,7 @@
{{ form.form_checkbox({
label:'Highlight',
name:'highlight',
value:ddoc.highlight|default(false))
value:ddoc.highlight|default(false)
}) }}
{% endif %}
{{ form.form_text({
+6 -10
View File
@@ -10,7 +10,7 @@
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ reverse_url('discussion_create_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
<li class="menu__item"><a class="menu__link highlight" href="/discuss/problem/{{ pdoc._id }}/create">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
@@ -55,7 +55,7 @@
<li class="menu__seperator"></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="{{ reverse_url('discussion_node_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="/discuss/problem/{{ pdoc._id }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
@@ -89,15 +89,13 @@
</div>
<div class="section__body typo">
<dl class="large horizontal">
{% if pdoc['_id']|string|length < 10 %}
<dt>{{ _('ID') }}</dt>
<dd>{{ pdoc['_id'] }}</dd>
{% endif %}
<dd>{{ pdoc['pid'] }}</dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc['psdoc']['status'] %}
{% if pdoc.psdoc['status'] %}
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}"></span>
<a href="/r/{{ pdoc['psdoc']['rid'] }}" class="record-status--text {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}">
{{ model.builtin.STATUS_TEXTS[pdoc['psdoc']['status']] }}
@@ -115,7 +113,7 @@
{% if pdoc['category'] %}
<span class="hasjs--hide" name="problem-sidebar__categories">
{% for category in pdoc['category'] %}
<a href="{{ reverse_url('problem_category', category=category) }}">{{ category }}</a>
<a href="/p?category={{ category }}">{{ category }}</a>
{% if loop.index < pdoc['category']|length %}
{% if category in vj4.model.builtin.PROBLEM_CATEGORIES %}
{{ _('problem-category-delim') }}
@@ -152,10 +150,8 @@
<dt>{{ _('Be Copied') }}</dt>
<dd>{{ pdoc['num_be_copied'] }}</dd>
{% endif %}
{% if pdoc['owner'] != 0 %}
<dt>{{ _('Uploaded By') }}</dt>
<dd>{{ user.render_inline(owner_udoc, badge=false) }}</dd>
{% endif %}
</dl>
</div>
</div>
@@ -168,7 +164,7 @@
{% if tdocs %}
<p>{{ _('In following training plans') }}: </p>
{% for tdoc in tdocs %}
<p><a href="{{ reverse_url('training_detail', tid=tdoc._id) }}">{{ tdoc.title }}</a></p>
<p><a href="/t/{{ tdoc._id }}">{{ tdoc.title }}</a></p>
{% endfor %}
{% endif %}
{% if ctdocs %}