blog: fix bug (#527)

pull/529/head
panda 2 years ago committed by GitHub
parent 44a579878b
commit 203195685d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -212,9 +212,8 @@ export async function apply(ctx: Context) {
ctx.Route('blog_create', '/blog/:uid/create', BlogEditHandler, PRIV.PRIV_USER_PROFILE);
ctx.Route('blog_detail', '/blog/:uid/:did', BlogDetailHandler);
ctx.Route('blog_edit', '/blog/:uid/:did/edit', BlogEditHandler, PRIV.PRIV_USER_PROFILE);
ctx.inject('UserDropdown', 'blog_main', {
icon: 'book', displayName: 'Blog', args: (h) => ({ uid: h.user._id }),
}, PRIV.PRIV_USER_PROFILE);
ctx.inject('UserDropdown', 'blog_main', (h) => ({ icon: 'book', displayName: 'Blog', uid: h.user._id.toString() }),
PRIV.PRIV_USER_PROFILE);
ctx.i18n.load('zh', {
"{0}'s blog": '{0} 的博客',
Blog: '博客',

@ -256,4 +256,5 @@ $contest-color = {
'ioi': #2E9AFE,
'ledo': #8076A3,
'homework': #FFCDCD,
'strictioi': #6EA2C7,
}

@ -83,8 +83,9 @@
<li class="menu__seperator"></li>
{%- for item in ui.getNodes('UserDropdown') -%}
<li class="menu__item nojs--hide">
<a href="{{ url(item.name, (item.args(handler) if typeof(item.args)=='function' else item.args) or {}) }}" class="menu__link">
<span class="icon icon-{{ item.args.icon }}"></span> {{ _(item.args.displayName or item.name) }}
{% set args = (item.args(handler) if typeof(item.args)=='function' else item.args) or {} %}
<a href="{{ url(item.name, args) }}" class="menu__link">
<span class="icon icon-{{ args.icon }}"></span> {{ _(args.displayName or item.name) }}
</a>
</li>
{%- endfor -%}

Loading…
Cancel
Save