FIX: enable_accepted_answers state was not correctly displayed (#82)
This commit is contained in:
parent
17912bdda3
commit
e974c35d38
|
@ -1,11 +1,15 @@
|
|||
{{#unless siteSettings.allow_solved_on_all_topics}}
|
||||
<h3>{{i18n 'solved.title'}}</h3>
|
||||
<section class='field'>
|
||||
<div class="enable-accepted-answer">
|
||||
<label class="checkbox-label">
|
||||
{{input type="checkbox" checked=category.enable_accepted_answers}}
|
||||
{{i18n 'solved.allow_accepted_answers'}}
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<h3>{{i18n 'solved.title'}}</h3>
|
||||
<section class='field'>
|
||||
<div class="enable-accepted-answer">
|
||||
<label class="checkbox-label">
|
||||
{{input
|
||||
type="checkbox"
|
||||
checked=(readonly category.enable_accepted_answers)
|
||||
change=(action "onChangeSetting" value="target.checked")
|
||||
}}
|
||||
{{i18n 'solved.allow_accepted_answers'}}
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
{{/unless}}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
export default {
|
||||
actions: {
|
||||
onChangeSetting(value) {
|
||||
this.set(
|
||||
"category.custom_fields.enable_accepted_answers",
|
||||
value ? "true" : "false"
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
|
@ -10,13 +10,8 @@ export default {
|
|||
enable_accepted_answers: Ember.computed(
|
||||
"custom_fields.enable_accepted_answers",
|
||||
{
|
||||
get(enableField) {
|
||||
return enableField === "true";
|
||||
},
|
||||
set(value) {
|
||||
value = value ? "true" : "false";
|
||||
this.set("custom_fields.enable_accepted_answers", value);
|
||||
return value;
|
||||
get(fieldName) {
|
||||
return Ember.get(this.custom_fields, fieldName) === "true";
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue