This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/edit-category-settings.js.es6
2017-03-22 16:54:18 -04:00

52 lines
1.8 KiB
JavaScript

import { setting } from 'discourse/lib/computed';
import { buildCategoryPanel } from 'discourse/components/edit-category-panel';
import computed from "ember-addons/ember-computed-decorators";
export default buildCategoryPanel('settings', {
emailInEnabled: setting('email_in'),
showPositionInput: setting('fixed_category_positions'),
isParentCategory: Em.computed.empty('category.parent_category_id'),
showSubcategoryListStyle: Em.computed.and('category.show_subcategory_list', 'isParentCategory'),
isDefaultSortOrder: Em.computed.empty('category.sort_order'),
@computed
availableSubcategoryListStyles() {
return [
{name: I18n.t('category.subcategory_list_styles.rows'), value: 'rows'},
{name: I18n.t('category.subcategory_list_styles.rows_with_featured_topics'), value: 'rows_with_featured_topics'},
{name: I18n.t('category.subcategory_list_styles.boxes'), value: 'boxes'},
{name: I18n.t('category.subcategory_list_styles.boxes_with_featured_topics'), value: 'boxes_with_featured_topics'}
];
},
@computed
availableViews() {
return [
{name: I18n.t('filters.latest.title'), value: 'latest'},
{name: I18n.t('filters.top.title'), value: 'top'}
];
},
@computed
availableTopPeriods() {
return ['all', 'yearly', 'quarterly', 'monthly', 'weekly', 'daily'].map((p) => {
return {name: I18n.t(`filters.top.${p}.title`), value: p};
});
},
@computed
availableSorts() {
return ['likes', 'op_likes', 'views', 'posts', 'activity', 'posters', 'category', 'created']
.map(s => ({ name: I18n.t('category.sort_options.' + s), value: s }))
.sort((a,b) => { return a.name > b.name; });
},
@computed
sortAscendingOptions() {
return [
{name: I18n.t('category.sort_ascending'), value: 'true'},
{name: I18n.t('category.sort_descending'), value: 'false'}
];
}
});