Skip to content

Commit

Permalink
Merge pull request #12541 from rwjblue/random-cleanup
Browse files Browse the repository at this point in the history
Random cleanup while reviewing ember-views package.
  • Loading branch information
mixonic committed Nov 5, 2015
2 parents 867ca6a + 866be61 commit fa15725
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
12 changes: 6 additions & 6 deletions packages/ember-views/lib/components/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,14 @@ var Component = View.extend(TargetActionSupport, {
if (action === undefined) {
action = 'action';
}
actionName = get(this, 'attrs.' + action) || get(this, action);
actionName = get(this, `attrs.${action}`) || get(this, action);
actionName = validateAction(this, actionName);

// If no action name for that action could be found, just abort.
if (actionName === undefined) { return; }

if (typeof actionName === 'function') {
actionName.apply(null, contexts);
actionName(...contexts);
} else {
this.triggerAction({
action: actionName,
Expand All @@ -304,10 +304,10 @@ var Component = View.extend(TargetActionSupport, {

send(actionName, ...args) {
var target;
var hasAction = this.actions && this.actions[actionName];
var action = this.actions && this.actions[actionName];

if (hasAction) {
var shouldBubble = this.actions[actionName].apply(this, args) === true;
if (action) {
var shouldBubble = action.apply(this, args) === true;
if (!shouldBubble) { return; }
}

Expand All @@ -319,7 +319,7 @@ var Component = View.extend(TargetActionSupport, {
);
target.send(...arguments);
} else {
if (!hasAction) {
if (!action) {
throw new Error(Ember.inspect(this) + ' had no action handler for: ' + actionName);
}
}
Expand Down
7 changes: 1 addition & 6 deletions packages/ember-views/lib/views/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,12 @@ export default EmberComponent.extend({
disabled: false,
indeterminate: false,

init() {
this._super(...arguments);
this.on('change', this, this._updateElementValue);
},

didInsertElement() {
this._super(...arguments);
get(this, 'element').indeterminate = !!get(this, 'indeterminate');
},

_updateElementValue() {
change() {
set(this, 'checked', this.$().prop('checked'));
}
});
4 changes: 2 additions & 2 deletions packages/ember-views/lib/views/core_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var CoreView = EmberObject.extend(Evented, ActionHandler, {
_states: cloneStates(states),

init() {
this._super.apply(this, arguments);
this._super(...arguments);
this._state = 'preRender';
this._currentState = this._states.preRender;
this._isVisible = get(this, 'isVisible');
Expand Down Expand Up @@ -142,7 +142,7 @@ export var DeprecatedCoreView = CoreView.extend({
'Ember.CoreView is deprecated. Please use Ember.View.',
false, { id: 'ember-views.core-view', until: '2.4.0' }
);
this._super.apply(this, arguments);
this._super(...arguments);
}
});

Expand Down

0 comments on commit fa15725

Please sign in to comment.