From 67ffec16a42c36cb30c1d4393e80730fa8bd8737 Mon Sep 17 00:00:00 2001 From: David Pett Date: Fri, 1 Apr 2016 16:39:28 -0500 Subject: [PATCH] fastboot ready --- .gitignore | 1 + addon/components/paper-autocomplete-list.js | 3 +++ addon/components/paper-grid-list.js | 13 ++++++++++++- addon/components/paper-menu-content-pane.js | 3 +++ addon/components/paper-menu.js | 3 +++ addon/components/paper-sidenav.js | 3 +++ index.js | 8 +++++--- package.json | 1 + 8 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9c0c380c8..9d317b2e7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # compiled output /dist +/fastboot-dist /tmp .idea diff --git a/addon/components/paper-autocomplete-list.js b/addon/components/paper-autocomplete-list.js index 552f2d487..52dbf9173 100644 --- a/addon/components/paper-autocomplete-list.js +++ b/addon/components/paper-autocomplete-list.js @@ -33,6 +33,9 @@ export default Ember.Component.extend({ //TODO reafactor into a computed property that binds directly to dropdown's `style` positionDropdown() { + if (typeof FastBoot !== 'undefined') { + return; + } var hrect = Ember.$('#' + this.get('wrapToElementId'))[0].getBoundingClientRect(), vrect = hrect, root = document.body.getBoundingClientRect(), diff --git a/addon/components/paper-grid-list.js b/addon/components/paper-grid-list.js index 3ff5aa295..ac9493e16 100644 --- a/addon/components/paper-grid-list.js +++ b/addon/components/paper-grid-list.js @@ -64,6 +64,9 @@ export default Ember.Component.extend({ }, layoutIfMediaMatch(mediaName) { + if (typeof FastBoot !== 'undefined') { + return; + } if (mediaName == null) { this.send('invalidateLayout'); } else if (window.matchMedia(mediaName)) { @@ -72,7 +75,9 @@ export default Ember.Component.extend({ }, _watchMedia() { - + if (typeof FastBoot !== 'undefined') { + return; + } const invalidateLayoutListener = this.get('_invalidateLayoutListener'); for (var mediaName in this.get('constants.MEDIA')) { @@ -113,6 +118,9 @@ export default Ember.Component.extend({ }, _unwatchMedia() { + if (typeof FastBoot !== 'undefined') { + return; + } const invalidateLayoutListener = this.get('_invalidateLayoutListener'); for(var mediaName in this.get('constants.MEDIA')) { var query = this.get('constants.MEDIA')[mediaName] || MEDIA(mediaName); @@ -121,6 +129,9 @@ export default Ember.Component.extend({ }, _getResponsiveAttribute(component, attrName) { + if (typeof FastBoot !== 'undefined') { + return; + } const mediaPriorities = this.get('constants.MEDIA_PRIORITY'); for (var i = 0; i < mediaPriorities.length; i++) { var mediaName = mediaPriorities[i], diff --git a/addon/components/paper-menu-content-pane.js b/addon/components/paper-menu-content-pane.js index 53b527ba1..15c91c9e8 100644 --- a/addon/components/paper-menu-content-pane.js +++ b/addon/components/paper-menu-content-pane.js @@ -64,6 +64,9 @@ export default Ember.Component.extend({ } }, attemptFocus(el) { + if (typeof FastBoot !== 'undefined') { + return; + } if (el && el.getAttribute('tabindex') !== -1) { el.focus(); if (document.activeElement === el) { diff --git a/addon/components/paper-menu.js b/addon/components/paper-menu.js index 104ac85e5..f7c0caab6 100644 --- a/addon/components/paper-menu.js +++ b/addon/components/paper-menu.js @@ -43,6 +43,9 @@ export default PaperMenuAbstract.extend({ }), positionMenu(el) { + if (typeof FastBoot !== 'undefined') { + return; + } // containerNode = wrapper var containerNode = el[0], // md-menu-content / any other child.z diff --git a/addon/components/paper-sidenav.js b/addon/components/paper-sidenav.js index 3ce534140..dd148906d 100644 --- a/addon/components/paper-sidenav.js +++ b/addon/components/paper-sidenav.js @@ -47,6 +47,9 @@ export default Ember.Component.extend({ }, matchMedia() { + if (typeof FastBoot !== 'undefined') { + return; + } var mediaQuery = this.get('constants').MEDIA[this.get('locked-open')]; this.set('isLockedOpen', window.matchMedia(mediaQuery).matches); if (this.get('isLockedOpen')) { diff --git a/index.js b/index.js index 22ce7b09c..04a00d132 100644 --- a/index.js +++ b/index.js @@ -12,9 +12,11 @@ module.exports = { included: function(app) { this._super.included(app); - app.import(app.bowerDirectory + '/hammerjs/hammer.js'); - app.import(app.bowerDirectory + '/matchMedia/matchMedia.js'); - app.import('vendor/propagating.js'); + if (!process.env.EMBER_CLI_FASTBOOT) { + app.import(app.bowerDirectory + '/hammerjs/hammer.js'); + app.import(app.bowerDirectory + '/matchMedia/matchMedia.js'); + app.import('vendor/propagating.js'); + } }, contentFor: function(type) { if (type === 'body') { diff --git a/package.json b/package.json index 15c6724d1..8506d85da 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "ember-cli-app-version": "^1.0.0", "ember-cli-content-security-policy": "0.4.0", "ember-cli-dependency-checker": "^1.1.0", + "ember-cli-fastboot": "0.6.0", "ember-cli-github-pages": "0.0.4", "ember-cli-htmlbars": "^1.0.1", "ember-cli-htmlbars-inline-precompile": "^0.3.1",