Use ember-data from drogus fork, easier-overrides branch
This commit is contained in:
parent
395c818a64
commit
0a09c96eb1
63
assets/scripts/vendor/ember-data.js
vendored
63
assets/scripts/vendor/ember-data.js
vendored
|
@ -1,4 +1,4 @@
|
|||
// Last commit: 8801f2e (2013-02-15 13:53:27 -0800)
|
||||
// Last commit: 6d9eeaf (2013-02-20 22:27:54 +0100)
|
||||
|
||||
|
||||
(function() {
|
||||
|
@ -3918,11 +3918,10 @@ DS.Model.reopen({
|
|||
|
||||
attributeDidChange: Ember.observer(function(record, key) {
|
||||
record.send('didSetProperty', { name: key });
|
||||
})
|
||||
});
|
||||
}),
|
||||
|
||||
function getAttr(record, options, key) {
|
||||
var attributes = get(record, 'data').attributes;
|
||||
getAttr: function(key, options) {
|
||||
var attributes = get(this, 'data').attributes;
|
||||
var value = attributes[key];
|
||||
|
||||
if (value === undefined) {
|
||||
|
@ -3931,6 +3930,7 @@ function getAttr(record, options, key) {
|
|||
|
||||
return value;
|
||||
}
|
||||
});
|
||||
|
||||
DS.attr = function(type, options) {
|
||||
options = options || {};
|
||||
|
@ -3947,7 +3947,7 @@ DS.attr = function(type, options) {
|
|||
if (arguments.length > 1) {
|
||||
Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.constructor.toString(), key !== 'id');
|
||||
} else {
|
||||
value = getAttr(this, options, key);
|
||||
value = this.getAttr(key, options);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -3972,18 +3972,8 @@ DS.attr = function(type, options) {
|
|||
var get = Ember.get, set = Ember.set,
|
||||
none = Ember.isNone;
|
||||
|
||||
DS.belongsTo = function(type, options) {
|
||||
Ember.assert("The first argument DS.belongsTo must be a model type or string, like DS.belongsTo(App.Person)", !!type && (typeof type === 'string' || DS.Model.detect(type)));
|
||||
|
||||
options = options || {};
|
||||
|
||||
var meta = { type: type, isRelationship: true, options: options, kind: 'belongsTo' };
|
||||
|
||||
return Ember.computed(function(key, value) {
|
||||
if (arguments.length === 2) {
|
||||
return value === undefined ? null : value;
|
||||
}
|
||||
|
||||
DS.Model.reopen({
|
||||
getBelongsTo: function(key, type, meta) {
|
||||
var data = get(this, 'data').belongsTo,
|
||||
store = get(this, 'store'), id;
|
||||
|
||||
|
@ -4000,6 +3990,22 @@ DS.belongsTo = function(type, options) {
|
|||
} else {
|
||||
return store.find(type, id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
DS.belongsTo = function(type, options) {
|
||||
Ember.assert("The first argument DS.belongsTo must be a model type or string, like DS.belongsTo(App.Person)", !!type && (typeof type === 'string' || DS.Model.detect(type)));
|
||||
|
||||
options = options || {};
|
||||
|
||||
var meta = { type: type, isRelationship: true, options: options, kind: 'belongsTo' };
|
||||
|
||||
return Ember.computed(function(key, value) {
|
||||
if (arguments.length === 2) {
|
||||
return value === undefined ? null : value;
|
||||
}
|
||||
|
||||
return this.getBelongsTo(key, type, meta);
|
||||
}).property('data').meta(meta);
|
||||
};
|
||||
|
||||
|
@ -4049,12 +4055,8 @@ DS.Model.reopen({
|
|||
|
||||
(function() {
|
||||
var get = Ember.get, set = Ember.set;
|
||||
var hasRelationship = function(type, options) {
|
||||
options = options || {};
|
||||
|
||||
var meta = { type: type, isRelationship: true, options: options, kind: 'hasMany' };
|
||||
|
||||
return Ember.computed(function(key, value) {
|
||||
DS.Model.reopen({
|
||||
getHasMany: function(key, type, meta) {
|
||||
var data = get(this, 'data').hasMany,
|
||||
store = get(this, 'store'),
|
||||
ids, relationship;
|
||||
|
@ -4069,6 +4071,16 @@ var hasRelationship = function(type, options) {
|
|||
set(relationship, 'name', key);
|
||||
|
||||
return relationship;
|
||||
}
|
||||
});
|
||||
|
||||
var hasRelationship = function(type, options) {
|
||||
options = options || {};
|
||||
|
||||
var meta = { type: type, isRelationship: true, options: options, kind: 'hasMany' };
|
||||
|
||||
return Ember.computed(function(key, value) {
|
||||
return this.getHasMany(key, type, meta);
|
||||
}).property().meta(meta);
|
||||
};
|
||||
|
||||
|
@ -4933,7 +4945,9 @@ DS.RelationshipChangeRemove.prototype.sync = function() {
|
|||
|
||||
if (secondRecord && firstRecord) {
|
||||
if(this.secondRecordKind === "belongsTo"){
|
||||
secondRecord.suspendRelationshipObservers(function(){
|
||||
set(secondRecord, secondRecordName, null);
|
||||
});
|
||||
}
|
||||
else if(this.secondRecordKind === "hasMany"){
|
||||
secondRecord.suspendRelationshipObservers(function(){
|
||||
|
@ -6469,7 +6483,6 @@ DS.JSONSerializer = DS.Serializer.extend({
|
|||
|
||||
sideloadedType = type.typeForRelationship(prop);
|
||||
|
||||
console.log('sideloadedType', type, prop, sideloadedType);
|
||||
if (!sideloadedType) {
|
||||
sideloadedType = this.sideloadMapping.get(prop);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user