Added category setting

This commit is contained in:
Joe Buhlig 2016-02-17 07:42:58 -06:00
parent 08c7ed752f
commit 7114dee34f
3 changed files with 34 additions and 0 deletions

View File

@ -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;
}
}
});
}
};

View File

@ -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>

View File

@ -1,4 +1,5 @@
en:
js:
feature_voting:
allow_topic_voting: "Allow users to vote on topics in this category"
title: "Vote"