2017-10-31 19:17:14 +01:00
|
|
|
<mk-index>
|
2017-11-01 16:20:33 +01:00
|
|
|
<mk-header/>
|
|
|
|
<hr>
|
2017-10-31 20:11:56 +01:00
|
|
|
<button onclick={ n }>%i18n:ch.tags.mk-index.new%</button>
|
|
|
|
<hr>
|
|
|
|
<ul if={ channels }>
|
|
|
|
<li each={ channels }><a href={ '/' + this.id }>{ this.title }</a></li>
|
|
|
|
</ul>
|
2017-10-31 19:17:14 +01:00
|
|
|
<style>
|
|
|
|
:scope
|
|
|
|
display block
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
this.mixin('api');
|
|
|
|
|
|
|
|
this.on('mount', () => {
|
2017-11-08 08:53:34 +01:00
|
|
|
this.api('channels', {
|
|
|
|
limit: 100
|
|
|
|
}).then(channels => {
|
2017-10-31 20:11:56 +01:00
|
|
|
this.update({
|
|
|
|
channels: channels
|
|
|
|
});
|
|
|
|
});
|
2017-10-31 19:17:14 +01:00
|
|
|
});
|
|
|
|
|
2017-10-31 20:11:56 +01:00
|
|
|
this.n = () => {
|
2017-10-31 19:17:14 +01:00
|
|
|
const title = window.prompt('%i18n:ch.tags.mk-index.channel-title%');
|
|
|
|
|
|
|
|
this.api('channels/create', {
|
|
|
|
title: title
|
|
|
|
}).then(channel => {
|
|
|
|
location.href = '/' + channel.id;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</mk-index>
|