mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
committed by
Joffrey JAFFEUX
parent
c617e512ad
commit
4b455e741e
@@ -1,19 +1,20 @@
|
||||
export default Ember.Mixin.create({
|
||||
overridden: function() {
|
||||
let val = this.get("value"),
|
||||
defaultVal = this.get("default");
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
@computed("value", "default")
|
||||
overridden(val, defaultVal) {
|
||||
if (val === null) val = "";
|
||||
if (defaultVal === null) defaultVal = "";
|
||||
|
||||
return val.toString() !== defaultVal.toString();
|
||||
}.property("value", "default"),
|
||||
},
|
||||
|
||||
validValues: function() {
|
||||
@computed("valid_values")
|
||||
validValues(validValues) {
|
||||
const vals = [],
|
||||
translateNames = this.get("translate_names");
|
||||
|
||||
this.get("valid_values").forEach(v => {
|
||||
validValues.forEach(v => {
|
||||
if (v.name && v.name.length > 0 && translateNames) {
|
||||
vals.addObject({ name: I18n.t(v.name), value: v.value });
|
||||
} else {
|
||||
@@ -21,12 +22,12 @@ export default Ember.Mixin.create({
|
||||
}
|
||||
});
|
||||
return vals;
|
||||
}.property("valid_values"),
|
||||
},
|
||||
|
||||
allowsNone: function() {
|
||||
const validValues = this.get("valid_values");
|
||||
@computed("valid_values")
|
||||
allowsNone(validValues) {
|
||||
if (validValues && validValues.indexOf("") >= 0) {
|
||||
return "admin.settings.none";
|
||||
}
|
||||
}.property("valid_values")
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user