chore: create the authorize logs page
This commit is contained in:
parent
20311fbfed
commit
d9458ba3ef
6 changed files with 49 additions and 5 deletions
BIN
js/dist/forum.js
generated
vendored
BIN
js/dist/forum.js
generated
vendored
Binary file not shown.
BIN
js/dist/forum.js.map
generated
vendored
BIN
js/dist/forum.js.map
generated
vendored
Binary file not shown.
13
js/src/forum/components/user/AuthorizePage.js
Normal file
13
js/src/forum/components/user/AuthorizePage.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import UserPage from 'flarum/forum/components/UserPage';
|
||||||
|
export default class AuthorizePage extends UserPage {
|
||||||
|
oninit(vnode) {
|
||||||
|
super.oninit(vnode);
|
||||||
|
this.loadUser(m.route.param('username'));
|
||||||
|
}
|
||||||
|
content() {
|
||||||
|
return (
|
||||||
|
<div className="AuthorizePage">
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
29
js/src/forum/index.js
Normal file
29
js/src/forum/index.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import app from 'flarum/forum/app';
|
||||||
|
import {extend} from 'flarum/common/extend';
|
||||||
|
import UserPage from 'flarum/forum/components/UserPage';
|
||||||
|
import LinkButton from 'flarum/common/components/LinkButton';
|
||||||
|
import AuthorizePage from "./components/user/AuthorizePage";
|
||||||
|
app.initializers.add('foskym/flarum-oauth-center', () => {
|
||||||
|
app.routes['user.authorize'] = {
|
||||||
|
path: '/u/:username/authorize',
|
||||||
|
component: AuthorizePage
|
||||||
|
};
|
||||||
|
extend(UserPage.prototype, 'navItems', function (items) {
|
||||||
|
if (app.session.user && app.session.user.id() === this.user.id()) {
|
||||||
|
items.add(
|
||||||
|
'authorize',
|
||||||
|
LinkButton.component(
|
||||||
|
{
|
||||||
|
href: app.route('user.authorize', { username: this.user.username() }),
|
||||||
|
icon: 'fas fa-user-friends',
|
||||||
|
},
|
||||||
|
[
|
||||||
|
app.translator.trans('foskym-oauth-center.forum.page.label.authorize'),
|
||||||
|
// this.user.moderatorNoteCount() > 0 ? <span className="Button-badge">{this.user.moderatorNoteCount()}</span> : '',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
-110
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,5 +0,0 @@
|
||||||
import app from 'flarum/forum/app';
|
|
||||||
|
|
||||||
app.initializers.add('foskym/flarum-oauth-center', () => {
|
|
||||||
console.log('[foskym/flarum-oauth-center] Hello, forum!');
|
|
||||||
});
|
|
7
locale/zh-Hans.yml
Normal file
7
locale/zh-Hans.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
foskym-oauth-center:
|
||||||
|
admin:
|
||||||
|
|
||||||
|
forum:
|
||||||
|
page:
|
||||||
|
label:
|
||||||
|
authorize: 授权
|
Loading…
Reference in a new issue