Began writing the plugin, used the 2 files and they work.
The hardest part for me to understand how this field should be used further.
import property from 'ember-addons/ember-computed-decorators';
import Category from 'discourse/models/category';
export default {
name: 'extend-category-for-temp',
before: 'inject-discourse-objects',
initialize() {
Category.reopen({
@property('custom_fields.enable_topic_temp')
enable_topic_temp: {
get(enableField) {
return enableField === "true";
},
set(value) {
value = value ? "true" : "false";
this.set("custom_fields.enable_topic_temp", value);
return value;
}
}
});
}
};
and
<section class='field'>
<div class="enable-topic-temp">
<label class="checkbox-label">
{{input type="checkbox" checked=category.enable_topic_temp}}
{{i18n 'temp.allow_temp'}}
</label>
</div>
</section>