1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 15:51:16 +02:00

Extract sortMap variable

Also revert previous uncommitted change in dist file
This commit is contained in:
Toby Zerner
2016-03-18 10:06:12 +10:30
parent 476c1a5691
commit 1ca1639139
2 changed files with 9 additions and 7 deletions

View File

@@ -204,16 +204,17 @@ export default class IndexPage extends Page {
*/
viewItems() {
const items = new ItemList();
const sortMap = app.cache.discussionList.sortMap();
const sortOptions = {};
for (const i in app.cache.discussionList.sortMap()) {
for (const i in sortMap) {
sortOptions[i] = app.translator.trans('core.forum.index_sort.' + i + '_button');
}
items.add('sort',
Select.component({
options: sortOptions,
value: this.params().sort || Object.keys(app.cache.discussionList.sortMap())[0],
value: this.params().sort || Object.keys(sortMap)[0],
onchange: this.changeSort.bind(this)
})
);