DEV: Ember 3.8.0

Co-Authored-By: majakomel <maja.komel@gmail.com>
This commit is contained in:
Maja Komel
2019-04-26 12:16:21 +02:00
committed by Joffrey JAFFEUX
parent c617e512ad
commit 4b455e741e
63 changed files with 573 additions and 438 deletions

View File

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