Skip to content

Instantly share code, notes, and snippets.

@ef4
Last active April 12, 2016 02:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ef4/0bcc6f7c99dafffdf6cc to your computer and use it in GitHub Desktop.
Save ef4/0bcc6f7c99dafffdf6cc to your computer and use it in GitHub Desktop.
import { helper } from 'ember-helper';
import $ from 'jquery';
export default helper(function([selector, handler]) {
return function(event) {
if ($(event.target).is(selector) && handler) {
return handler(event);
}
};
});
<div class="modal">
{{#with-sidebar name="modal" as |modalContent hooks|}}
{{#if modalContent}}
<div class="modal-backdrop"></div>
<div class="modal-container" onclick={{action (exact-target ".modal-container" hooks.outsideClick) }}>
<div class="modal-dialog" >
{{component modalContent}}
</div>
</div>
{{/if}}
{{/with-sidebar}}
</div>
.modal-backdrop {
position: fixed;
top: 0;
width: 100vw;
height: 100vh;
background-color: black;
opacity: 0.8;
z-index: 12;
}
.modal-container {
position: fixed;
top: 0;
width: 100vw;
height: 100vh;
z-index: 13;
display: flex;
align-items: center;
justify-content: center;
}
.modal-dialog {
background-color: white;
border-radius: 4px;
max-height: 100vh;
overflow-y: auto;
}
{{#if showUploader}}
{{in-sidebar name="modal"
show=(component "image-upload-modal" imagesReady=(action "imageReady"))
hooks=(hash outsideClick=(action (mut showUploader) false)) }}
{{/if}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment