Added category setting
This commit is contained in:
parent
08c7ed752f
commit
7114dee34f
|
@ -0,0 +1,25 @@
|
|||
import property from 'ember-addons/ember-computed-decorators';
|
||||
import Category from 'discourse/models/category';
|
||||
|
||||
export default {
|
||||
name: 'extend-category-for-voting',
|
||||
before: 'inject-discourse-objects',
|
||||
initialize() {
|
||||
|
||||
Category.reopen({
|
||||
|
||||
@property('custom_fields.enable_topic_voting')
|
||||
enable_topic_voting: {
|
||||
get(enableField) {
|
||||
return enableField === "true";
|
||||
},
|
||||
set(value) {
|
||||
value = value ? "true" : "false";
|
||||
this.set("custom_fields.enable_topic_voting", value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
<section class='field'>
|
||||
<div class="enable-topic-voting">
|
||||
<label class="checkbox-label">
|
||||
{{input type="checkbox" checked=category.enable_topic_voting}}
|
||||
{{i18n 'feature_voting.allow_topic_voting'}}
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
|
@ -1,4 +1,5 @@
|
|||
en:
|
||||
js:
|
||||
feature_voting:
|
||||
allow_topic_voting: "Allow users to vote on topics in this category"
|
||||
title: "Vote"
|
Loading…
Reference in New Issue