From ceeb8a52dc46cee8832c08cecd9d3229ed328702 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Sat, 10 Nov 2018 07:45:16 +0900 Subject: [PATCH 1/3] use closure actions `sendAction` is deprecated. --- README.md | 2 +- addon/components/basic-dialog.js | 2 +- addon/components/modal-dialog.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b412c916..4da1ad46 100644 --- a/README.md +++ b/README.md @@ -275,7 +275,7 @@ export default ModalDialog.extend(EmberKeyboardMixin, { }, closeOnEsc: Ember.on(keyDown('Escape'), function() { - this.sendAction('close'); + this.get('close')(); }) }); ``` diff --git a/addon/components/basic-dialog.js b/addon/components/basic-dialog.js index 6f6e7cce..288a3cda 100644 --- a/addon/components/basic-dialog.js +++ b/addon/components/basic-dialog.js @@ -80,7 +80,7 @@ export default Component.extend({ return; } - this.sendAction('onClose'); + this.get('onClose')(); }; const registerClick = () => document.addEventListener('click', this.handleClick); diff --git a/addon/components/modal-dialog.js b/addon/components/modal-dialog.js index 9a557498..be3a540e 100644 --- a/addon/components/modal-dialog.js +++ b/addon/components/modal-dialog.js @@ -99,14 +99,14 @@ export default Component.extend({ }, actions: { onClose() { - this.sendAction('onClose'); + this.get('onClose')(); }, onClickOverlay(e) { e.preventDefault(); if (this.get('onClickOverlay')) { - this.sendAction('onClickOverlay'); + this.get('onClickOverlay')(); } else { - this.sendAction('onClose'); + this.get('onClose')(); } } } From 4a883a986806e53172ff32f9bbb46f2cfeb72ab5 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Sat, 10 Nov 2018 12:49:40 +0900 Subject: [PATCH 2/3] try to fix tests --- tests/dummy/app/templates/animatable.hbs | 12 ++++++------ tests/dummy/app/templates/index.hbs | 4 ++-- tests/dummy/app/templates/tethered-animatable.hbs | 6 +++--- tests/dummy/app/templates/tethered.hbs | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/dummy/app/templates/animatable.hbs b/tests/dummy/app/templates/animatable.hbs index 2b4436b5..6466ac04 100644 --- a/tests/dummy/app/templates/animatable.hbs +++ b/tests/dummy/app/templates/animatable.hbs @@ -18,7 +18,7 @@ {{#if isShowingBasic}} {{!-- BEGIN-SNIPPET basic-modal-dialog-animatable --}} {{#modal-dialog - onClose='toggleBasic' + onClose=(action 'toggleBasic') overlayPosition='sibling' clickOutsideToClose=true animatable=true @@ -38,7 +38,7 @@ {{#if isShowingTranslucent}} {{!-- BEGIN-SNIPPET translucent-modal-dialog-animatable --}} {{#modal-dialog - onClose='toggleTranslucent' + onClose=(action 'toggleTranslucent') translucentOverlay=true overlayPosition='sibling' clickOutsideToClose=true @@ -59,7 +59,7 @@ {{#if isShowingWithoutOverlay}} {{!-- BEGIN-SNIPPET without-overlay-modal-dialog-animatable --}} {{#modal-dialog - onClose='toggleWithoutOverlay' + onClose=(action 'toggleWithoutOverlay') hasOverlay=false animatable=true }} @@ -80,7 +80,7 @@ {{#if isShowingWithoutOverlayClickOutsideToClose}} {{!-- BEGIN-SNIPPET without-overlay-click-outside-to-close-modal-dialog-animatable --}} {{#modal-dialog - onClose='toggleWithoutOverlayClickOutsideToClose' + onClose=(action 'toggleWithoutOverlayClickOutsideToClose') hasOverlay=false clickOutsideToClose=true animatable=true @@ -93,7 +93,7 @@ {{/if}} {{#if isShowingWithoutOverlayClickOutsideToCloseAnotherOne}} {{#modal-dialog - onClose='toggleWithoutOverlayClickOutsideToCloseAnotherOne' + onClose=(action 'toggleWithoutOverlayClickOutsideToCloseAnotherOne') hasOverlay=false clickOutsideToClose=true offset='100px 0' @@ -141,7 +141,7 @@ {{#if isShowingSubclassed}} {{!-- BEGIN-SNIPPET subclass-modal-dialog-animatable --}} {{#my-cool-modal-dialog - onClose='toggleSubclassed' + onClose=(action 'toggleSubclassed') animatable=true }}

Stop! Modal Time!

diff --git a/tests/dummy/app/templates/index.hbs b/tests/dummy/app/templates/index.hbs index 0d156600..64ac66f2 100644 --- a/tests/dummy/app/templates/index.hbs +++ b/tests/dummy/app/templates/index.hbs @@ -54,7 +54,7 @@ {{#modal-dialog onClose=(action (mut isShowingTranslucentWithCallback) false) translucentOverlay=true - onClickOverlay='clickedTranslucentOverlay' + onClickOverlay=(action 'clickedTranslucentOverlay') }}

Stop! Modal Time!

Translucent Overlay with Callback

@@ -223,7 +223,7 @@ {{#if isShowingCenteredScrolling}} {{!-- BEGIN-SNIPPET centered-scrolling-modal-dialog --}} {{#modal-dialog - onClose='toggleCenteredScrolling' + onClose=(action 'toggleCenteredScrolling') translucentOverlay=true targetAttachment='none' containerClass='centered-scrolling-container' diff --git a/tests/dummy/app/templates/tethered-animatable.hbs b/tests/dummy/app/templates/tethered-animatable.hbs index 2a097ad8..ad7bbf46 100644 --- a/tests/dummy/app/templates/tethered-animatable.hbs +++ b/tests/dummy/app/templates/tethered-animatable.hbs @@ -50,7 +50,7 @@ {{#if isShowingTargetSelector}} {{!-- BEGIN-SNIPPET target-selector-modal-dialog-liquid-tether --}} {{#modal-dialog - onClose='toggleTargetSelector' + onClose=(action 'toggleTargetSelector') hasOverlay=false targetAttachment=exampleTargetAttachment attachment=exampleAttachment @@ -78,7 +78,7 @@ {{#if isShowingTargetElement}} {{!-- BEGIN-SNIPPET target-element-modal-dialog-liquid-tether --}} {{#modal-dialog - onClose='toggleTargetElement' + onClose=(action 'toggleTargetElement') hasOverlay=false targetAttachment=exampleTargetAttachment attachment=exampleAttachment @@ -104,7 +104,7 @@ {{#if isShowingElementCenterModal}} {{!-- BEGIN-SNIPPET element-centered-modal-dialog-liquid-tether --}} {{#modal-dialog - onClose='toggleElementCenterModal' + onClose=(action 'toggleElementCenterModal') translucentOverlay=true tetherTarget='#elementCenter' animatable=true diff --git a/tests/dummy/app/templates/tethered.hbs b/tests/dummy/app/templates/tethered.hbs index 317d3675..1ea141e1 100644 --- a/tests/dummy/app/templates/tethered.hbs +++ b/tests/dummy/app/templates/tethered.hbs @@ -50,7 +50,7 @@ {{#if isShowingTargetSelector}} {{!-- BEGIN-SNIPPET target-selector-modal-dialog-tethered --}} {{#modal-dialog - onClose='toggleTargetSelector' + onClose=(action 'toggleTargetSelector') hasOverlay=false targetAttachment=exampleTargetAttachment attachment=exampleAttachment @@ -77,7 +77,7 @@ {{#if isShowingTargetElement}} {{!-- BEGIN-SNIPPET target-element-modal-dialog-tethered --}} {{#modal-dialog - onClose='toggleTargetElement' + onClose=(action 'toggleTargetElement') hasOverlay=false targetAttachment=exampleTargetAttachment attachment=exampleAttachment From efc90fb64637b95f9dee20e87b46e01b49325c1e Mon Sep 17 00:00:00 2001 From: Luke Melia Date: Sun, 11 Nov 2018 22:03:18 -0500 Subject: [PATCH 3/3] Make doc examples consistent with action names --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4da1ad46..7c71ca18 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ export default ModalDialog.extend({ _initEscListener() { const closeOnEscapeKey = (ev) => { - if (ev.keyCode === ESC_KEY) { this.get('closeAction')(); } + if (ev.keyCode === ESC_KEY) { this.get('onClose')(); } }; Ember.$('body').on('keyup.modal-dialog', closeOnEscapeKey); @@ -275,7 +275,7 @@ export default ModalDialog.extend(EmberKeyboardMixin, { }, closeOnEsc: Ember.on(keyDown('Escape'), function() { - this.get('close')(); + this.get('onClose')(); }) }); ```