Skip to content

Commit

Permalink
Merge pull request #10919 from stefanpenner/cleanup
Browse files Browse the repository at this point in the history
some cleanup
  • Loading branch information
stefanpenner committed Apr 22, 2015
2 parents ad2933d + 60c93c4 commit a8400e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions packages/ember-views/lib/views/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,18 @@ var Component = View.extend(TargetActionSupport, ComponentTemplateDeprecation, {
@deprecated
@property template
*/
template: computed({
get: function() {
template: computed('templateName', {
get() {
var templateName = get(this, 'templateName');
var template = this.templateForName(templateName, 'template');

Ember.assert("You specified the templateName " + templateName + " for " + this + ", but it did not exist.", !templateName || !!template);

return template || get(this, 'defaultTemplate');
},
set: function(key, value) {
set(key, value) {
return value;
}
}).property('templateName'),
}),

/**
Specifying a components `templateName` is deprecated without also
Expand Down Expand Up @@ -199,10 +198,10 @@ var Component = View.extend(TargetActionSupport, ComponentTemplateDeprecation, {
@type Ember.Controller
@default null
*/
targetObject: computed(function(key) {
targetObject: computed('_parentView', function(key) {
var parentView = this._parentView;
return parentView ? get(parentView, 'controller') : null;
}).property('_parentView'),
}),

/**
Triggers a named action on the controller context where the component is used if
Expand Down
8 changes: 4 additions & 4 deletions packages/ember-views/lib/views/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,13 +738,13 @@ var View = CoreView.extend(
*/

template: computed('templateName', {
get: function() {
get() {
var templateName = get(this, 'templateName');
var template = this.templateForName(templateName, 'template');
Ember.assert("You specified the templateName " + templateName + " for " + this + ", but it did not exist.", !templateName || !!template);
return template || get(this, 'defaultTemplate');
},
set: function(key, value) {
set(key, value) {
if (value !== undefined) { return value; }
return get(this, key);
}
Expand All @@ -764,14 +764,14 @@ var View = CoreView.extend(
@property layout
@type Function
*/
layout: computed(function(key) {
layout: computed('layoutName', function(key) {
var layoutName = get(this, 'layoutName');
var layout = this.templateForName(layoutName, 'layout');

Ember.assert("You specified the layoutName " + layoutName + " for " + this + ", but it did not exist.", !layoutName || !!layout);

return layout || get(this, 'defaultLayout');
}).property('layoutName'),
}),

_yield(context, options, morph) {
var template = get(this, 'template');
Expand Down

0 comments on commit a8400e6

Please sign in to comment.