Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random cleanup while reviewing ember-views package. #12541

Merged
merged 1 commit into from
Nov 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -284,14 +284,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 @@ -302,10 +302,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 @@ -317,7 +317,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'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a slight change in behavior? The children must call super?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yes, but they should have been already....

}
});
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