Merge pull request #50 from clarkwinkelmann/use-page-component

Use page component for tags page
This commit is contained in:
Toby Zerner 2018-05-25 07:45:30 +09:30 committed by GitHub
commit 2b3e925cf9

View File

@ -1,20 +1,18 @@
import Component from 'flarum/Component'; import Page from 'flarum/components/Page';
import IndexPage from 'flarum/components/IndexPage'; import IndexPage from 'flarum/components/IndexPage';
import listItems from 'flarum/helpers/listItems'; import listItems from 'flarum/helpers/listItems';
import humanTime from 'flarum/helpers/humanTime'; import humanTime from 'flarum/helpers/humanTime';
import icon from 'flarum/helpers/icon';
import tagLabel from 'flarum/tags/helpers/tagLabel'; import tagLabel from 'flarum/tags/helpers/tagLabel';
import sortTags from 'flarum/tags/utils/sortTags'; import sortTags from 'flarum/tags/utils/sortTags';
export default class TagsPage extends Component { export default class TagsPage extends Page {
init() { init() {
super.init();
this.tags = sortTags(app.store.all('tags').filter(tag => !tag.parent())); this.tags = sortTags(app.store.all('tags').filter(tag => !tag.parent()));
app.current = this; app.history.push('tags', app.translator.trans('flarum-tags.forum.header.back_to_tags_tooltip'));
app.history.push('tags', icon('fas fa-th-large'));
app.drawer.hide();
app.modal.close();
} }
view() { view() {
@ -75,14 +73,10 @@ export default class TagsPage extends Component {
{cloud.length ? ( {cloud.length ? (
<div className="TagCloud"> <div className="TagCloud">
{cloud.map(tag => { {cloud.map(tag => [
const color = tag.color();
return [
tagLabel(tag, {link: true}), tagLabel(tag, {link: true}),
' ' ' ',
]; ])}
})}
</div> </div>
) : ''} ) : ''}
</div> </div>