-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[update] adds linting updates (removes
;
😁)
- Loading branch information
1 parent
d41d7b5
commit fb0846c
Showing
20 changed files
with
333 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ module.exports = { | |
], | ||
env: { | ||
browser: true | ||
} | ||
}, | ||
root: true | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
import Mixin from '@ember/object/mixin'; | ||
import { get, computed } from '@ember/object'; | ||
import { inject } from '@ember/service'; | ||
import { getOwner } from '@ember/application'; | ||
import Mixin from '@ember/object/mixin' | ||
import { get, computed } from '@ember/object' | ||
import { inject } from '@ember/service' | ||
import { getOwner } from '@ember/application' | ||
|
||
export default Mixin.create({ | ||
scheduler: inject('scheduler'), | ||
service: inject('router-scroll'), | ||
|
||
isFastBoot: computed(function() { | ||
const fastboot = getOwner(this).lookup('service:fastboot'); | ||
return fastboot ? fastboot.get('isFastBoot') : false; | ||
isFastBoot: computed(function () { | ||
const fastboot = getOwner(this).lookup('service:fastboot') | ||
return fastboot ? fastboot.get('isFastBoot') : false | ||
}), | ||
|
||
willTransition(...args) { | ||
this._super(...args); | ||
willTransition (...args) { | ||
this._super(...args) | ||
|
||
if (get(this, 'isFastBoot')) { return; } | ||
if (get(this, 'isFastBoot')) { return } | ||
|
||
get(this, 'service').update(); | ||
get(this, 'service').update() | ||
}, | ||
|
||
didTransition(transitions, ...args) { | ||
this._super(transitions, ...args); | ||
didTransition (transitions, ...args) { | ||
this._super(transitions, ...args) | ||
|
||
if (get(this, 'isFastBoot')) { return; } | ||
if (get(this, 'isFastBoot')) { return } | ||
|
||
this.get('scheduler').scheduleWork('afterContentPaint', () => { | ||
this.updateScrollPosition(transitions); | ||
}); | ||
this.updateScrollPosition(transitions) | ||
}) | ||
}, | ||
|
||
updateScrollPosition(transitions) { | ||
const lastTransition = transitions[transitions.length - 1]; | ||
const url = get(lastTransition, 'handler.router.currentURL'); | ||
const hashElement = url ? document.getElementById(url.split('#').pop()) : null; | ||
updateScrollPosition (transitions) { | ||
const lastTransition = transitions[transitions.length - 1] | ||
const url = get(lastTransition, 'handler.router.currentURL') | ||
const hashElement = url ? document.getElementById(url.split('#').pop()) : null | ||
|
||
let scrollPosition; | ||
let scrollPosition | ||
|
||
if(url && url.indexOf('#') > -1 && hashElement) { | ||
scrollPosition = { x: hashElement.offsetLeft, y: hashElement.offsetTop }; | ||
if (url && url.indexOf('#') > -1 && hashElement) { | ||
scrollPosition = { x: hashElement.offsetLeft, y: hashElement.offsetTop } | ||
} else { | ||
scrollPosition = get(this, 'service.position'); | ||
scrollPosition = get(this, 'service.position') | ||
} | ||
const scrollElement = get(this, 'service.scrollElement'); | ||
const scrollElement = get(this, 'service.scrollElement') | ||
|
||
const preserveScrollPosition = get(lastTransition, 'handler.controller.preserveScrollPosition'); | ||
const preserveScrollPosition = get(lastTransition, 'handler.controller.preserveScrollPosition') | ||
|
||
if (!preserveScrollPosition) { | ||
if ('window' === scrollElement) { | ||
window.scrollTo(scrollPosition.x, scrollPosition.y); | ||
} else if ('#' === scrollElement.charAt(0)) { | ||
const element = document.getElementById(scrollElement.substring(1)); | ||
if (scrollElement === 'window') { | ||
window.scrollTo(scrollPosition.x, scrollPosition.y) | ||
} else if (scrollElement.charAt(0) === '#') { | ||
const element = document.getElementById(scrollElement.substring(1)) | ||
|
||
if (element) { | ||
element.scrollLeft = scrollPosition.x; | ||
element.scrollTop = scrollPosition.y; | ||
element.scrollLeft = scrollPosition.x | ||
element.scrollTop = scrollPosition.y | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
module.exports = function(/* environment, appConfig */) { | ||
return { }; | ||
}; | ||
module.exports = function (/* environment, appConfig */) { | ||
return { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
module.exports = { | ||
name: 'ember-router-scroll' | ||
}; | ||
name: 'ember-router-scroll', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit, click, currentURL } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit' | ||
import { setupApplicationTest } from 'ember-qunit' | ||
import { visit, click, currentURL } from '@ember/test-helpers' | ||
|
||
module('Acceptance | basic functionality', function(hooks) { | ||
setupApplicationTest(hooks); | ||
module('Acceptance | basic functionality', function (hooks) { | ||
setupApplicationTest(hooks) | ||
|
||
test('The application should work when loading a page and clicking a link', async function(assert) { | ||
await visit('/'); | ||
test('The application should work when loading a page and clicking a link', async function (assert) { | ||
await visit('/') | ||
|
||
await click('a[href="/next-page"]'); | ||
await click('a[href="/next-page"]') | ||
|
||
assert.equal(currentURL(), '/next-page'); | ||
}); | ||
}); | ||
assert.equal(currentURL(), '/next-page') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import Application from '@ember/application'; | ||
import Resolver from './resolver'; | ||
import loadInitializers from 'ember-load-initializers'; | ||
import config from './config/environment'; | ||
import Application from '@ember/application' | ||
import Resolver from './resolver' | ||
import loadInitializers from 'ember-load-initializers' | ||
import config from './config/environment' | ||
|
||
const App = Application.extend({ | ||
modulePrefix: config.modulePrefix, | ||
podModulePrefix: config.podModulePrefix, | ||
Resolver | ||
}); | ||
Resolver, | ||
}) | ||
|
||
loadInitializers(App, config.modulePrefix); | ||
loadInitializers(App, config.modulePrefix) | ||
|
||
export default App; | ||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import Resolver from 'ember-resolver'; | ||
import Resolver from 'ember-resolver' | ||
|
||
export default Resolver; | ||
export default Resolver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import EmberRouter from '@ember/routing/router'; | ||
import RouterScroll from 'ember-router-scroll'; | ||
import config from './config/environment'; | ||
import EmberRouter from '@ember/routing/router' | ||
import RouterScroll from 'ember-router-scroll' | ||
import config from './config/environment' | ||
|
||
const Router = EmberRouter.extend(RouterScroll, { | ||
location: config.locationType, | ||
rootURL: config.rootURL | ||
}); | ||
rootURL: config.rootURL, | ||
}) | ||
|
||
Router.map(function () { | ||
this.route('next-page'); | ||
}); | ||
this.route('next-page') | ||
}) | ||
|
||
export default Router; | ||
export default Router |
Oops, something went wrong.