0
0
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: mk-ui-header-nav:
home: "Home" home: "Home"
messaging: "Messages" messaging: "Messages"
bbs: "BBS" channels: "Channels"
info: "News" info: "News"
mk-ui-header-search: mk-ui-header-search:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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