Update ember and ember-data

This commit is contained in:
Piotr Sarnacki 2012-09-26 15:07:52 +02:00
parent 6207eecbcf
commit b31515fa57
3 changed files with 9533 additions and 6417 deletions

View File

@ -1748,6 +1748,7 @@ DS.Store = Ember.Object.extend({
loadMany: function(type, ids, hashes) { loadMany: function(type, ids, hashes) {
var clientIds = Ember.A([]); var clientIds = Ember.A([]);
if (hashes === undefined) { if (hashes === undefined) {
hashes = ids; hashes = ids;
ids = []; ids = [];
@ -3131,8 +3132,8 @@ DS.Model = Ember.Object.extend(Ember.Evented, {
if (cachedValue) { if (cachedValue) {
var key = association.options.key || get(this, 'namingConvention').keyToJSONKey(name), var key = association.options.key || get(this, 'namingConvention').keyToJSONKey(name),
ids = data.get(key) || []; ids = data.get(key) || [];
var clientIds; var clientIds;
if(association.options.embedded) { if(association.options.embedded) {
clientIds = store.loadMany(association.type, ids).clientIds; clientIds = store.loadMany(association.type, ids).clientIds;
} else { } else {
@ -3140,7 +3141,7 @@ DS.Model = Ember.Object.extend(Ember.Evented, {
return store.clientIdForId(association.type, id); return store.clientIdForId(association.type, id);
}); });
} }
set(cachedValue, 'content', Ember.A(clientIds)); set(cachedValue, 'content', Ember.A(clientIds));
cachedValue.fetch(); cachedValue.fetch();
} }
@ -3155,7 +3156,7 @@ DS.Model = Ember.Object.extend(Ember.Evented, {
also call methods with the given name. also call methods with the given name.
*/ */
trigger: function(name) { trigger: function(name) {
this[name].apply(this, [].slice.call(arguments, 1)); Ember.tryInvoke(this, name, [].slice.call(arguments, 1));
this._super.apply(this, arguments); this._super.apply(this, arguments);
} }
}); });
@ -3671,8 +3672,8 @@ DS.Adapter = Ember.Object.extend({
(function() { (function() {
var set = Ember.set; var set = Ember.set;
Ember.onLoad('application', function(app) { Ember.onLoad('Ember.Application', function(Application) {
app.registerInjection({ Application.registerInjection({
name: "store", name: "store",
before: "controllers", before: "controllers",
@ -3683,11 +3684,11 @@ Ember.onLoad('application', function(app) {
} }
}); });
app.registerInjection({ Application.registerInjection({
name: "giveStoreToControllers", name: "giveStoreToControllers",
injection: function(app, stateManager, property) { injection: function(app, stateManager, property) {
if (property.match(/Controller$/)) { if (/^[A-Z].*Controller$/.test(property)) {
var controllerName = property.charAt(0).toLowerCase() + property.substr(1); var controllerName = property.charAt(0).toLowerCase() + property.substr(1);
var store = stateManager.get('store'); var store = stateManager.get('store');
var controller = stateManager.get(controllerName); var controller = stateManager.get(controllerName);
@ -3765,7 +3766,7 @@ DS.FixtureAdapter = DS.Adapter.extend({
return ids.indexOf(item.id) !== -1; return ids.indexOf(item.id) !== -1;
}); });
} }
if (fixtures) { if (fixtures) {
this.simulateRemoteCall(function() { this.simulateRemoteCall(function() {
store.loadMany(type, fixtures); store.loadMany(type, fixtures);
@ -3785,7 +3786,7 @@ DS.FixtureAdapter = DS.Adapter.extend({
findQuery: function(store, type, query, array) { findQuery: function(store, type, query, array) {
var fixtures = this.fixturesForType(type); var fixtures = this.fixturesForType(type);
Ember.assert("Unable to find fixtures for model type "+type.toString(), !!fixtures); Ember.assert("Unable to find fixtures for model type "+type.toString(), !!fixtures);
fixtures = this.queryFixtures(fixtures, query); fixtures = this.queryFixtures(fixtures, query);
@ -3846,7 +3847,7 @@ var get = Ember.get, set = Ember.set;
DS.RESTAdapter = DS.Adapter.extend({ DS.RESTAdapter = DS.Adapter.extend({
bulkCommit: false, bulkCommit: false,
createRecord: function(store, type, record) { createRecord: function(store, type, record) {
var root = this.rootForType(type); var root = this.rootForType(type);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff