This commit is contained in:
syuilo 2017-10-31 22:35:31 +09:00
parent 30a4e839a6
commit 5efb52b9f5
7 changed files with 26 additions and 15 deletions

View File

@ -241,7 +241,7 @@ desktop:
mk-ui-header-nav:
home: "Home"
messaging: "Messages"
bbs: "BBS"
channels: "Channels"
info: "News"
mk-ui-header-search:

View File

@ -241,7 +241,7 @@ desktop:
mk-ui-header-nav:
home: "ホーム"
messaging: "メッセージ"
bbs: "掲示板"
channels: "チャンネル"
info: "お知らせ"
mk-ui-header-search:

View File

@ -474,8 +474,16 @@ const endpoints: Endpoint[] = [
name: 'messaging/messages/create',
withCredential: true,
kind: 'messaging-write'
}
},
{
name: 'channels/create',
withCredential: true,
limit: {
duration: ms('1hour'),
max: 3,
minInterval: ms('10seconds')
}
},
];
export default endpoints;

View File

@ -2,8 +2,8 @@
* Module dependencies
*/
import $ from 'cafy';
import Channel from '../../../models/channel';
import serialize from '../../../serializers/channel';
import Channel from '../../models/channel';
import serialize from '../../serializers/channel';
/**
* Create a channel

View File

@ -9,6 +9,7 @@ let page = null;
export default me => {
route('/', index);
route('/i>mentions', mentions);
route('/channel', channels);
route('/post::post', post);
route('/search::query', search);
route('/:user', user.bind(null, 'home'));
@ -54,6 +55,10 @@ export default me => {
mount(el);
}
function channels() {
mount(document.createElement('mk-channels-page'));
}
function notFound() {
mount(document.createElement('mk-not-found'));
}

View File

@ -1,8 +1,7 @@
<mk-channels-page>
<mk-ui ref="ui">
<main>
<h1>%i18n:desktop.tags.mk-bbs-page.title%</h1>
<button onclick={ parent.new }>%i18n:desktop.tags.mk-bbs-page.new%</button>
<button onclick={ parent.new }>%i18n:desktop.tags.mk-channels-page.new%</button>
</main>
</mk-ui>
<style>
@ -14,16 +13,15 @@
this.mixin('api');
this.on('mount', () => {
document.title = '%i18n:desktop.tags.mk-bbs-page.title%';
});
this.new = () => {
const title = window.prompt('%i18n:desktop.tags.mk-bbs-page.channel-title%');
const title = window.prompt('%i18n:desktop.tags.mk-channels-page.channel-title%');
this.api('bbs/channels/create', {
title: title
}).then(channel => {
location.href = '/bbs/' + channel.id;
location.href = '/channel/' + channel.id;
});
};
</script>

View File

@ -335,10 +335,10 @@
</a>
</li>
</virtual>
<li class="bbs">
<a href={ CONFIG.url + '/bbs' }>
<i class="fa fa-coffee"></i>
<p>%i18n:desktop.tags.mk-ui-header-nav.bbs%</p>
<li class="channels">
<a href={ CONFIG.url + '/channel' }>
<i class="fa fa-television"></i>
<p>%i18n:desktop.tags.mk-ui-header-nav.channels%</p>
</a>
</li>
<li class="info">