Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalle committed Aug 4, 2011
2 parents 280f940 + b4c454d commit 916412d
Show file tree
Hide file tree
Showing 29 changed files with 1,218 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ SC.TextFieldSupport = /** @scope SC.TextFieldSupport */{
SC.Event.add(input, 'blur', this, this.focusOut);
}

input.bind('change', function() {
input.bind('keyup', function() {
self.domValueDidChange(SC.$(this));
});
},
Expand Down
17 changes: 10 additions & 7 deletions frameworks/core_foundation/system/sparse_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,18 @@ SC.SparseArray = SC.Object.extend(SC.Observable, SC.Enumerable, SC.Array,
@returns {Number} the discovered index or -1 if not found
*/
indexOf: function(obj) {
var del = this.delegate ;
var c, ret, del = this.delegate ;
if (del && del.sparseArrayDidRequestIndexOf) {
return del.sparseArrayDidRequestIndexOf(this, obj);
} else {
var content = this._sa_content ;
if (!content) content = this._sa_content = [] ;
return content.indexOf(obj) ;
ret = del.sparseArrayDidRequestIndexOf(this, obj);
}

if (SC.none(ret)) {
c = this._sa_content ;
if (!c) c = this._sa_content = [] ;
ret = c.indexOf(obj) ;
}
},
return ret;
},

// ..........................................................
// EDITING
Expand Down
6 changes: 4 additions & 2 deletions frameworks/core_foundation/views/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,10 @@ SC.CoreView.reopen(
},

applyAttributesToContext: function(context) {
this._applyClassNameBindings();
this._applyAttributeBindings(context);
if (!this.get('layer')) {
this._applyClassNameBindings();
this._applyAttributeBindings(context);
}

context.addClass(this.get('classNames'));

Expand Down
15 changes: 14 additions & 1 deletion frameworks/datastore/models/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ SC.Record = SC.Object.extend(
@dependsOn status
*/
isError: function() {
return this.get('status') & SC.Record.ERROR;
return !!(this.get('status') & SC.Record.ERROR);
}.property('status').cacheable(),

/**
Expand Down Expand Up @@ -1336,6 +1336,9 @@ SC.Record.mixin( /** @scope SC.Record */ {
opts = opts || {};
var isNested = opts.nested || opts.isNested;
var attr;

this._throwUnlessRecordTypeDefined(recordType, 'toMany');

if(isNested){
attr = SC.ChildrenAttribute.attr(recordType, opts);
}
Expand All @@ -1362,6 +1365,9 @@ SC.Record.mixin( /** @scope SC.Record */ {
opts = opts || {};
var isNested = opts.nested || opts.isNested;
var attr;

this._throwUnlessRecordTypeDefined(recordType, 'toOne');

if(isNested){
attr = SC.ChildAttribute.attr(recordType, opts);
}
Expand All @@ -1370,6 +1376,13 @@ SC.Record.mixin( /** @scope SC.Record */ {
}
return attr;
},

_throwUnlessRecordTypeDefined: function(recordType, relationshipType) {
if (!recordType) {
throw "Attempted to create " + relationshipType + " attribute with " +
"undefined recordType. Did you forget to sc_require a dependency?";
}
},

/**
Returns all storeKeys mapped by Id for this record type. This method is
Expand Down
Loading

0 comments on commit 916412d

Please sign in to comment.