initial commit

This commit is contained in:
git@daemon.de
2013-09-12 23:13:49 +02:00
parent 874ee3cdab
commit 5992bf159b
50 changed files with 69273 additions and 0 deletions

95
js/mixins.js Normal file
View File

@@ -0,0 +1,95 @@
App.SelfMixin = Ember.Mixin.create({
passwdset: null,
/*
didLoad: function() {
this._passwdset();
},
didUpdate: function() {
this.didLoad();
},
*/
validate: function() {
var valid = true;
var errors = {valid: true};
if(! this.get('password')) {
errors.password = translate('_error_password');
errors.valid = false;
}
if(! this.get('name')) {
errors.name = translate('_error_name');
errors.valid = false;
}
if(! this.get('birth')) {
errors.birth = translate('_error_birth');
errors.valid = false;
}
if(! this.get('address')) {
errors.address = translate('_error_address');
errors.valid = false;
}
return errors;
},
haspasswd: function() {
var p = this.get('password');
if(p) {
return true;
}
else {
return false;
}
}.property()
});
App.ImportMixin = Ember.Mixin.create({
validate: function() {
var valid = true;
var errors = {valid: true};
if(! this.get('password')) {
errors.password = translate('_error_password');
errors.valid = false;
}
return errors;
}
});
App.SuccessorMixin = Ember.Mixin.create({
validate: function() {
var valid = true;
var errors = {valid: true};
if(! this.get('name')) {
errors.name = translate('_error_name');
errors.valid = false;
}
return errors;
}
});
App.AssetMixin = Ember.Mixin.create({
validate: function() {
var orderid;
var successorid;
var errors = {valid: true};
try {
orderid = this.get('order').get('id');
}
catch (e) { }
try {
successorid = this.get('successor').get('id');
}
catch (e) { }
//console.log("got o: %o, s: %o", orderid, successorid);
if(! orderid) {
errors.order = translate('_error_order');
errors.valid = false;
}
if(! successorid) {
errors.successor = translate('_error_successor');
errors.valid = false;
}
return errors;
}
});