Skip to content

Commit

Permalink
Update ember to 3.5
Browse files Browse the repository at this point in the history
[BREAKING] drops support for Ember 2.4
  • Loading branch information
lukemelia committed Nov 12, 2018
1 parent 79143f0 commit c06573b
Show file tree
Hide file tree
Showing 46 changed files with 3,754 additions and 3,285 deletions.
19 changes: 19 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/coverage/
!.*

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module'
},
extends: 'eslint:recommended',
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true
},
Expand Down
22 changes: 11 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/dist/
/tmp/

# dependencies
/node_modules
/bower_components
/bower_components/
/node_modules/

# misc
/.sass-cache
/connect.lock
/coverage/*
/coverage/
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
44 changes: 26 additions & 18 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
/bower_components
# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.eslintignore
/.eslintrc.js
/.gitignore
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.gitignore
.eslintrc.js
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js
/ember-cli-build.js
/testem.js
/tests/
/yarn.lock
.gitkeep

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended'
};
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016
Copyright (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,29 +339,39 @@ module.exports = {
* For Ember versions >= 2.4, use the latest published version
* For Ember versions >= 1.10 and < 2.4, use ember-modal-dialog 1.0.0 _(Due to a bug in these versions of Ember, you may have trouble with Ember 1.13.7, 1.13.8 and 1.13.9 -- See #71)_

## Installation
Installation
------------------------------------------------------------------------------

* `ember install ember-modal-dialog`

## Running the dummy app
### Installation

* `ember server`
* Visit your app at http://localhost:4200.
* `git clone <repository-url>`
* `cd my-addon`
* `npm install`

## Running Tests
### Linting

* `ember try:each`
* `ember test`
* `ember test --server`
* `npm run lint:hbs`
* `npm run lint:js`
* `npm run lint:js -- --fix`

### Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions

## Unit Tests

When running unit tests on components that use ember-modal-dialog, modals will be
attached to the `#ember-testing` div.

## Building

* `ember build`
## Running the Dummy Application

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).

Expand All @@ -378,4 +388,4 @@ This project uses [https://github.com/skywinder/github-changelog-generator](http
## Credits

Contributions from @stefanpenner, @krisselden, @chrislopresto, @lukemelia, @raycohen, @andrewhavens, @samselikoff and
others. [Yapp Labs](http://yapplabs.com) is an Ember.js consultancy based in NYC.
others. [Yapp Labs](http://yapplabs.com) was an Ember.js consultancy based in NYC, that has since been folded into [Yapp](https://www.yapp.us).
1 change: 1 addition & 0 deletions addon/components/in-place-dialog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
import Component from '@ember/component';
import { computed } from '@ember/object';
import layout from '../templates/components/in-place-dialog';
Expand Down
1 change: 1 addition & 0 deletions addon/components/liquid-dialog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
import BasicDialog from './basic-dialog';
import layout from '../templates/components/liquid-dialog';

Expand Down
3 changes: 3 additions & 0 deletions addon/components/modal-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export default Component.extend({
},
// onClose - set this from templates

/* eslint-disable ember/avoid-leaking-state-in-ember-objects */

// containerClass - set this from templates
containerClassNames: ['ember-modal-dialog'], // set this in a subclass definition

Expand All @@ -65,6 +67,7 @@ export default Component.extend({
wrapperClassNames: ['ember-modal-wrapper'], // set this in a subclass definition

concatenatedProperties: ['containerClassNames', 'overlayClassNames', 'wrapperClassNames'],
/* eslint-enable ember/avoid-leaking-state-in-ember-objects */

hasOverlay: true,
translucentOverlay: false,
Expand Down
20 changes: 13 additions & 7 deletions addon/components/tether-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import layout from '../templates/components/tether-dialog';

export default BasicDialog.extend({
layout,

init(){
this._super(...arguments);
this._ensureAttachments();
},
targetAttachmentClass: computed('targetAttachment', function() {
let targetAttachment = this.get('targetAttachment') || '';
return `ember-modal-dialog-target-attachment-${dasherize(targetAttachment)}`;
Expand All @@ -15,12 +18,7 @@ export default BasicDialog.extend({
attachment: null,
didReceiveAttrs() {
this._super(...arguments);
if (!this.get('attachment')) {
this.set('attachment', 'middle center');
}
if (!this.get('targetAttachment')) {
this.set('targetAttachment', 'middle center');
}
this._ensureAttachments();
},
tetherTarget: null, // element, css selector, view instance, 'viewport', or 'scroll-handle'
tetherClassPrefix: computed({
Expand All @@ -36,4 +34,12 @@ export default BasicDialog.extend({
// offset - passed in
// targetOffset - passed in
// targetModifier - passed in
_ensureAttachments() {
if (!this.get('attachment')) {
this.set('attachment', 'middle center');
}
if (!this.get('targetAttachment')) {
this.set('targetAttachment', 'middle center');
}
}
});
4 changes: 2 additions & 2 deletions addon/initializers/add-modals-container.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*globals document */
/*globals document, Ember */
let hasDOM = typeof document !== 'undefined';

function appendContainerElement(rootElementOrId, id) {
Expand All @@ -21,7 +21,7 @@ export default function(App) {
let modalContainerElId = emberModalDialog.modalRootElementId || 'modal-overlays';

App.register('config:modals-container-id',
modalContainerElId,
Ember.testing ? 'ember-testing' : modalContainerElId,
{ instantiate: false });

App.inject('service:modal-dialog',
Expand Down
33 changes: 22 additions & 11 deletions addon/templates/components/basic-dialog.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,44 @@
{{#if isOverlaySibling}}
<div class="{{wrapperClassNamesString}} {{wrapperClass}}">
{{#if hasOverlay}}
<div class={{overlayClassNamesString}} onclick={{action onClickOverlay}} tabindex="-1" data-emd-overlay></div>
<div
class={{overlayClassNamesString}}
onclick={{action onClickOverlay}}
tabindex="-1"
data-emd-overlay
>
</div>
{{/if}}
{{#ember-modal-dialog-positioned-container
class=containerClassNamesString
targetAttachment=targetAttachment
target=legacyTarget
class=containerClassNamesString
targetAttachment=targetAttachment
target=legacyTarget
}}
{{yield}}
{{/ember-modal-dialog-positioned-container}}
</div>
{{else}}
<div class="{{wrapperClassNamesString}} {{wrapperClass}}">
{{#if hasOverlay}}
<div class={{overlayClassNamesString}} onclick={{action (ignore-children onClickOverlay)}} tabindex="-1" data-emd-overlay>
<div
class={{overlayClassNamesString}}
onclick={{action (ignore-children onClickOverlay)}}
tabindex="-1"
data-emd-overlay
>
{{#ember-modal-dialog-positioned-container
class=containerClassNamesString
targetAttachment=targetAttachment
target=legacyTarget
class=containerClassNamesString
targetAttachment=targetAttachment
target=legacyTarget
}}
{{yield}}
{{/ember-modal-dialog-positioned-container}}
</div>
{{else}}
{{#ember-modal-dialog-positioned-container
class=containerClassNamesString
targetAttachment=targetAttachment
target=legacyTarget
class=containerClassNamesString
targetAttachment=targetAttachment
target=legacyTarget
}}
{{yield}}
{{/ember-modal-dialog-positioned-container}}
Expand Down
4 changes: 3 additions & 1 deletion addon/templates/components/in-place-dialog.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<div class={{concat containerClassNamesString ' ' attachmentClass ' ' containerClass}}>
<div
class={{concat containerClassNamesString " " attachmentClass " " containerClass}}
>
{{yield}}
</div>
27 changes: 23 additions & 4 deletions addon/templates/components/liquid-dialog.hbs
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
{{#if isOverlaySibling}}
{{#liquid-wormhole stack=stack value=value class=(concat 'liquid-dialog-container ' wrapperClassNamesString ' ' wrapperClass)}}
{{#liquid-wormhole
stack=stack
value=value
class=(concat "liquid-dialog-container " wrapperClassNamesString " " wrapperClass)
}}
<div class="{{wrapperClassNamesString}} {{wrapperClass}}">
{{#if hasOverlay}}
<div class={{overlayClassNamesString}} onclick={{action onClickOverlay}} tabindex="-1" data-emd-overlay></div>
<div
class={{overlayClassNamesString}}
onclick={{action onClickOverlay}}
tabindex="-1"
data-emd-overlay
>
</div>
{{/if}}
<div class={{containerClassNamesString}}>
{{yield}}
</div>
</div>
{{/liquid-wormhole}}
{{else}}
{{#liquid-wormhole stack=stack value=value class=(concat 'liquid-dialog-container ' wrapperClassNamesString ' ' wrapperClass)}}
{{#liquid-wormhole
stack=stack
value=value
class=(concat "liquid-dialog-container " wrapperClassNamesString " " wrapperClass)
}}
{{#if hasOverlay}}
<div class={{overlayClassNamesString}} onclick={{action (ignore-children onClickOverlay)}} tabindex="-1" data-emd-overlay>
<div
class={{overlayClassNamesString}}
onclick={{action (ignore-children onClickOverlay)}}
tabindex="-1"
data-emd-overlay
>
<div class={{containerClassNamesString}}>
{{yield}}
</div>
Expand Down
Loading

0 comments on commit c06573b

Please sign in to comment.