Skip to content

Instantly share code, notes, and snippets.

@code0100fun
Last active September 12, 2018 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code0100fun/aa9fc3680770874b33e960f3cbd67ed6 to your computer and use it in GitHub Desktop.
Save code0100fun/aa9fc3680770874b33e960f3cbd67ed6 to your computer and use it in GitHub Desktop.
Modal Component
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['modal-dialog'],
});
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['modal-wrapper'],
});
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['modal-fullscreen'],
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('show-modal');
this.route('show-modal-fullscreen');
});
export default Router;
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.modal-wrapper {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
pointer-events: none;
}
.modal-background {
pointer-events: auto;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0.9;
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 6000;
}
.modal-dialog {
}
.modal-fullscreen {
}
.modal-content {
align-items: center;
justify-content: center;
background-color: rgb(255, 255, 255);
}
{{link-to 'Show Modal Dialog' 'show-modal'}}
{{link-to 'Show Modal Fullscreen' 'show-modal-fullscreen'}}
{{outlet}}
{{from-elsewhere name="to-application"}}
<div class="modal-content">{{yield}}</div>
<div class="modal-background"></div>
{{#modal-dialog}}
<fieldset>
<label>Name:</label>
<input>
</fieldset>
{{/modal-dialog}}
{{log 'modal-florm'}}
{{to-elsewhere
named="to-application"
send=(component "modal-form")
}}
{
"version": "0.15.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.1.1",
"ember-template-compiler": "3.1.1",
"ember-testing": "3.1.1"
},
"addons": {
"ember-data": "3.2.0",
"ember-elsewhere": "1.0.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment