mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:29:30 +08:00
FEATURE: category setting for default list filter.
This commit is contained in:
parent
058bf56b4c
commit
6f03d14c23
|
@ -68,6 +68,13 @@ export default buildCategoryPanel("settings", {
|
|||
);
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
availableListFilters() {
|
||||
return ["all", "none"].map(p => {
|
||||
return { name: I18n.t(`category.list_filters.${p}`), value: p };
|
||||
});
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
searchPrioritiesOptions() {
|
||||
const options = [];
|
||||
|
|
|
@ -187,7 +187,8 @@ const Category = RestModel.extend({
|
|||
),
|
||||
search_priority: this.search_priority,
|
||||
reviewable_by_group_name: this.reviewable_by_group_name,
|
||||
read_only_banner: this.read_only_banner
|
||||
read_only_banner: this.read_only_banner,
|
||||
default_list_filter: this.default_list_filter
|
||||
},
|
||||
type: id ? "PUT" : "POST"
|
||||
});
|
||||
|
|
|
@ -196,6 +196,22 @@
|
|||
{{/unless}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="field">
|
||||
<label for="category-default-filter">
|
||||
{{i18n "category.default_list_filter"}}
|
||||
</label>
|
||||
<div class="controls">
|
||||
{{combo-box
|
||||
id="category-default-filter"
|
||||
valueProperty="value"
|
||||
content=availableListFilters
|
||||
value=category.default_list_filter
|
||||
none="category.list_filters.all"
|
||||
}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{#if isParentCategory}}
|
||||
<section class="field show-subcategory-list-field">
|
||||
<label>
|
||||
|
|
|
@ -329,6 +329,7 @@ class CategoriesController < ApplicationController
|
|||
:required_tag_group_name,
|
||||
:min_tags_from_required_group,
|
||||
:read_only_banner,
|
||||
:default_list_filter,
|
||||
custom_fields: [params[:custom_fields].try(:keys)],
|
||||
permissions: [*p.try(:keys)],
|
||||
allowed_tags: [],
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddDefaultListFilterToCategories < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :categories, :default_list_filter, :string, limit: 20, default: 'all'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user