mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: feat: blog
This commit is contained in:
1 parent
f43c1bc8c9
commit
79aca189d1
10 files changed
+36
-31
No files matched your search
@@ -20,7 +20,7 @@ console.log(
|
||||
`,
|
||||
);
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
window.UiContext = JSON.parse(window.UiContext);
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
@@ -32,16 +32,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
eval(payload[0]); // eslint-disable-line no-eval
|
||||
payload.shift();
|
||||
window.Hydro.preload = payload;
|
||||
import('./hydro');
|
||||
} else {
|
||||
fetch(`/constant?version=${UiContext.constantVersion}`)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
eval(data.payload[0]); // eslint-disable-line no-eval
|
||||
localStorage.setItem('hydro-constant', JSON.stringify(data));
|
||||
data.payload.shift();
|
||||
window.Hydro.preload = data.payload;
|
||||
import('./hydro');
|
||||
});
|
||||
const res = await fetch(`/constant?version=${UiContext.constantVersion}`);
|
||||
const data = await res.json();
|
||||
eval(data.payload[0]); // eslint-disable-line no-eval
|
||||
localStorage.setItem('hydro-constant', JSON.stringify(data));
|
||||
data.payload.shift();
|
||||
window.Hydro.preload = data.payload;
|
||||
}
|
||||
|
||||
import('./hydro');
|
||||
}, false);
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.27.11",
|
||||
"version": "4.27.12",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</li>
|
||||
<li><h2>{{ ddoc.title }}</h2></li>
|
||||
<li>
|
||||
{{ user.render_inline(udict[ddoc.owner]) }}
|
||||
{{ user.render_inline(udoc) }}
|
||||
@
|
||||
{{ datetimeSpan(ddoc._id)|safe }}
|
||||
</li>
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<ul class="section__footer supplementary dot list">
|
||||
{% if handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION) or (handler.user.own(ddoc) and handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION_SELF)) %}
|
||||
{% if handler.user.hasPriv(PRIV.PRIV_EDIT_SYSTEM) or handler.user.own(ddoc) %}
|
||||
<li><a href="{{ url('blog_edit', uid=udoc._id, did=ddoc.docId) }}">
|
||||
<span class="icon icon-edit"></span> {{ _('Edit') }}
|
||||
</a></li>
|
||||
@@ -34,8 +34,8 @@
|
||||
<input type="hidden" name="operation" value="{% if not dsdoc['star'] %}star{% else %}unstar{% endif %}">
|
||||
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
|
||||
<button class="star{% if dsdoc['star'] %} activated{% endif %}" type="submit">
|
||||
<span class="starred--hide"><span class="icon icon-star--outline"></span> {{ _('Star Topic') }}</span>
|
||||
<span class="starred--show"><span class="icon icon-star"></span> {{ _('Unstar Topic') }}</span>
|
||||
<span class="starred--hide"><span class="icon icon-star--outline"></span> {{ _('Star') }}</span>
|
||||
<span class="starred--show"><span class="icon icon-star"></span> {{ _('Unstar') }}</span>
|
||||
</button>
|
||||
</form></li>
|
||||
{% endif %}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<button name="operation" value="{{ 'update' if ddoc else 'create' }}" type="submit" class="rounded primary button">
|
||||
{{ _('Update') if ddoc else _('Create') }} (Ctrl+Enter)
|
||||
</button>
|
||||
{% if ddoc and (handler.user.own(ddoc) or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION)) %}
|
||||
{% if ddoc and (handler.user.hasPriv(PRIV.PRIV_EDIT_SYSTEM) or handler.user.own(ddoc)) %}
|
||||
<button name="operation" value="delete" type="submit" class="rounded button">
|
||||
{{ _('Delete') }}
|
||||
</button>
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
<h1 class="section__title">{{ _("{0}'s blog").format(udoc.uname) }}</h1>
|
||||
</div>
|
||||
<div class="section__body">
|
||||
{% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) and handler.user._id == udoc._id %}
|
||||
<p><a href="{{ url('blog_create', uid=udoc._id) }}" class="expanded primary button">{{ _('Create a Post') }}</a></p>
|
||||
{% if handler.user._id == udoc._id %}
|
||||
<p><a href="{{ url('blog_create', uid=udoc._id) }}" class="expanded primary button">{{ _('Create a Post') }}</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -71,13 +71,19 @@
|
||||
</a>
|
||||
</li>
|
||||
{% if handler.user.hasPriv(PRIV.PRIV_CREATE_FILE) %}
|
||||
<li class="menu__seperator"></li>
|
||||
<li class="menu__item">
|
||||
<a href="{{ url('home_files') }}" class="menu__link">
|
||||
<span class="icon icon-file"></span> {{ _('My Files') }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) and model.system.get('server.blog') %}
|
||||
<li class="menu__item">
|
||||
<a href="{{ url('blog_main', uid=handler.user._id) }}" class="menu__link">
|
||||
<span class="icon icon-book"></span> {{ _('Blog') }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="menu__seperator"></li>
|
||||
{% if handler.user.hasPriv(PRIV.PRIV_EDIT_SYSTEM) %}
|
||||
<li class="menu__item nojs--hide">
|
||||
|
||||
Reference in new issue
Block a user