Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Removing ember-scroll-to addon #3852

Merged
merged 4 commits into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/components/public/side-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ export default Component.extend({
this.set('shouldShowCallforSpeakers',
speakersCall && speakersCall.announcement && (speakersCall.privacy === 'public'));
},
actions: {
scrollToTarget() {
document.querySelectorAll('.scroll').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});

document.querySelectorAll('.scroll').forEach(node => {
node.classList.remove('active');
});
e.target.classList.add('active');
});
});
}
snitin315 marked this conversation as resolved.
Show resolved Hide resolved
},
isSchedulePublished: computed('event.schedulePublishedOn', function() {
return this.get('event.schedulePublishedOn') && this.get('event.schedulePublishedOn').toISOString() !== moment(0).toISOString();
})
Expand Down
16 changes: 8 additions & 8 deletions app/templates/components/public/side-menu.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{#if (and (not-eq session.currentRouteName 'public.cfs.new-session') (not-eq session.currentRouteName 'public.cfs.new-speaker') (not-eq session.currentRouteName 'public.cfs.edit-speaker') (not-eq session.currentRouteName 'public.cfs.edit-session'))}}
<div class="ui fluid vertical {{unless device.isMobile 'pointing'}} menu">
{{#if (eq session.currentRouteName 'public.index')}}
{{#scroll-to href='#info' class='item active'}}
<a href='#info' {{action "scrollToTarget"}} class='item active scroll'>
{{t 'Info'}}
{{/scroll-to}}
</a>
{{#if event.tickets.length}}
{{#scroll-to href='#tickets' class='item'}}
<a href='#tickets' {{action "scrollToTarget"}} class='item scroll'>
{{t 'Tickets'}}
{{/scroll-to}}
</a>
{{/if}}
{{#if event.speakers.length}}
{{#link-to 'public.speakers' class='item'}}
Expand Down Expand Up @@ -46,19 +46,19 @@
{{/if}}
{{#if event.hasOwnerInfo}}
{{#if (eq session.currentRouteName 'public.index')}}
{{#scroll-to href='#owner' class='item'}}
<a href='#owner' {{action "scrollToTarget"}} class='item scroll'>
{{t 'Owner'}}
{{/scroll-to}}
</a>
{{else}}
<a class="item" href="{{href-to 'public.index'}}#owner">
{{t 'Owner'}}
</a>
{{/if}}
{{/if}}
{{#if (eq session.currentRouteName 'public.index')}}
{{#scroll-to href='#getting-here' class='item'}}
<a href='#getting-here' class='item scroll'>
{{t 'Getting here'}}
{{/scroll-to}}
</a>
{{else}}
<a class="item" href="{{href-to 'public.index'}}#getting-here">
{{t 'Getting here'}}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"ember-resolver": "^7.0.0",
"ember-route-action-helper": "^2.0.8",
"ember-router-scroll": "^2.0.0",
"ember-scroll-to": "^0.6.5",
"ember-simple-auth": "^2.1.1",
"ember-simple-auth-token": "^4.0.7",
"ember-source": "~3.16.1",
Expand Down
7 changes: 0 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6961,13 +6961,6 @@ ember-runtime-enumerable-includes-polyfill@^2.0.0:
ember-cli-babel "^6.9.0"
ember-cli-version-checker "^2.1.0"

ember-scroll-to@^0.6.5:
version "0.6.5"
resolved "https://registry.yarnpkg.com/ember-scroll-to/-/ember-scroll-to-0.6.5.tgz#d9a7658eed6b8ae0e3c71b93b03f59a8550b8a10"
dependencies:
ember-cli-babel "^6.3.0"
ember-cli-htmlbars "^2.0.1"

ember-simple-auth-token@^4.0.7:
version "4.0.7"
resolved "https://registry.yarnpkg.com/ember-simple-auth-token/-/ember-simple-auth-token-4.0.7.tgz#df4177d118b9f7a75a3879ceec04ab2c55e1cad2"
Expand Down