new Category.is_support attribute

This commit is contained in:
Régis Hanol
2015-11-24 18:45:50 +01:00
parent 0d54c18c8b
commit 9ef8397164
7 changed files with 16 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ CategoryList.reopenClass({
const users = Discourse.Model.extractByKey(result.featured_users, Discourse.User); const users = Discourse.Model.extractByKey(result.featured_users, Discourse.User);
const list = Discourse.Category.list(); const list = Discourse.Category.list();
result.category_list.categories.forEach(function(c) { result.category_list.categories.forEach(c => {
if (c.parent_category_id) { if (c.parent_category_id) {
c.parentCategory = list.findBy('id', c.parent_category_id); c.parentCategory = list.findBy('id', c.parent_category_id);
} }

View File

@@ -86,6 +86,7 @@ const Category = RestModel.extend({
custom_fields: this.get('custom_fields'), custom_fields: this.get('custom_fields'),
topic_template: this.get('topic_template'), topic_template: this.get('topic_template'),
suppress_from_homepage: this.get('suppress_from_homepage'), suppress_from_homepage: this.get('suppress_from_homepage'),
is_support: this.get("is_support"),
}, },
type: this.get('id') ? 'PUT' : 'POST' type: this.get('id') ? 'PUT' : 'POST'
}); });

View File

@@ -20,6 +20,12 @@
</section> </section>
{{#if emailInEnabled}} {{#if emailInEnabled}}
<section class='field'>
<label>
{{input type="checkbox" checked=category.is_support}}
{{i18n 'category.email_in_allow_strangers'}}
</label>
</section>
<section class='field'> <section class='field'>
<label> <label>
{{input type="checkbox" checked=category.email_in_allow_strangers}} {{input type="checkbox" checked=category.email_in_allow_strangers}}

View File

@@ -178,6 +178,7 @@ class CategoriesController < ApplicationController
:position, :position,
:email_in, :email_in,
:email_in_allow_strangers, :email_in_allow_strangers,
:is_support,
:suppress_from_homepage, :suppress_from_homepage,
:parent_category_id, :parent_category_id,
:auto_close_hours, :auto_close_hours,

View File

@@ -8,6 +8,7 @@ class CategorySerializer < BasicCategorySerializer
:position, :position,
:email_in, :email_in,
:email_in_allow_strangers, :email_in_allow_strangers,
:is_support,
:suppress_from_homepage, :suppress_from_homepage,
:can_delete, :can_delete,
:cannot_delete_reason, :cannot_delete_reason,

View File

@@ -1590,6 +1590,7 @@ en:
email_in_allow_strangers: "Accept emails from anonymous users with no accounts" email_in_allow_strangers: "Accept emails from anonymous users with no accounts"
email_in_disabled: "Posting new topics via email is disabled in the Site Settings. To enable posting new topics via email, " email_in_disabled: "Posting new topics via email is disabled in the Site Settings. To enable posting new topics via email, "
email_in_disabled_click: 'enable the "email in" setting.' email_in_disabled_click: 'enable the "email in" setting.'
is_support: "Transform this category into a private support portal."
suppress_from_homepage: "Suppress this category from the homepage." suppress_from_homepage: "Suppress this category from the homepage."
allow_badges_label: "Allow badges to be awarded in this category" allow_badges_label: "Allow badges to be awarded in this category"
edit_permissions: "Edit Permissions" edit_permissions: "Edit Permissions"

View File

@@ -0,0 +1,5 @@
class AddIsSupportToCategories < ActiveRecord::Migration
def change
add_column :categories, :is_support, :boolean, default: false, null: false
end
end