-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4378cbf
commit b1cf259
Showing
12 changed files
with
136 additions
and
149 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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,71 +1,80 @@ | ||
import { inject as service } from '@ember/service'; | ||
import Component from '@ember/component'; | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { computed } from '@ember/object'; | ||
import { action } from '@ember/object'; | ||
|
||
export default Component.extend({ | ||
tagName: 'nav', | ||
classNames: 'header-nav', | ||
session: service(), | ||
layoutManager: service('layout-manager'), | ||
media: service(), | ||
intl: service(), | ||
localStorage: service(), | ||
store: service(), | ||
router: service(), | ||
abilities: service(), | ||
staticPages: tracked(), | ||
export default class HeaderNav extends Component { | ||
tagName = 'nav'; | ||
classNames = 'header-nav'; | ||
@service session; | ||
@service('layout-manager') layoutManager; | ||
@service media; | ||
@service intl; | ||
@service localStorage; | ||
@service store; | ||
@service router; | ||
@service abilities; | ||
@tracked staticPages; | ||
|
||
onAboutUsPage: computed('router.{currentRouteName,currentURL}', function () { | ||
// computed('router.{currentRouteName,currentURL}' | ||
get onAboutUsPage() { | ||
return ( | ||
this.router.currentRouteName === 'public.room-forum' || | ||
(this.router.currentRouteName === 'static-pages.static-page.index' && | ||
this.router.currentURL !== '/static-pages/word-lid' && | ||
this.router.currentURL !== '/static-pages/sponsoring') | ||
); | ||
}), | ||
} | ||
|
||
actions: { | ||
handleLogoAction() { | ||
if (this.media.isMobile) { | ||
this.send('toggleLeftSidebar'); | ||
} else { | ||
this.router.transitionTo('index'); | ||
} | ||
}, | ||
toggleLeftSidebar() { | ||
this.layoutManager.toggleLeftSidebar(); | ||
}, | ||
toggleRightSidebar() { | ||
this.layoutManager.toggleRightSidebar(); | ||
}, | ||
closeSidebars() { | ||
this.layoutManager.closeSidebars(); | ||
}, | ||
toggleLocale() { | ||
const { locale } = this.intl; | ||
if (locale[0] === 'nl') { | ||
this.set('intl.locale', 'en'); | ||
localStorage.setItem('locale', 'en-'); | ||
} else { | ||
this.set('intl.locale', 'nl'); | ||
localStorage.setItem('locale', 'nl'); | ||
} | ||
console.log(this.router); | ||
}, | ||
setStaticPages() { | ||
if (!this.session.isAuthenticated && !this.media.isMobile) { | ||
this.store.findAll('static-page').then((pages) => { | ||
// make key-value pairs for all found static pages that do not appear by itself | ||
let staticPages = {}; | ||
pages.forEach((page) => { | ||
if (!['word-lid', 'sponsoring'].includes(page.id)) { | ||
staticPages[page.id] = page.title; | ||
} | ||
}); | ||
this.staticPages = staticPages; | ||
@action | ||
handleLogoAction() { | ||
if (this.media.isMobile) { | ||
this.send('toggleLeftSidebar'); | ||
} else { | ||
this.router.transitionTo('index'); | ||
} | ||
} | ||
|
||
@action | ||
toggleLeftSidebar() { | ||
this.layoutManager.toggleLeftSidebar(); | ||
} | ||
|
||
@action | ||
toggleRightSidebar() { | ||
this.layoutManager.toggleRightSidebar(); | ||
} | ||
|
||
@action | ||
closeSidebars() { | ||
this.layoutManager.closeSidebars(); | ||
} | ||
|
||
@action | ||
toggleLocale() { | ||
const { locale } = this.intl; | ||
if (locale[0] === 'nl') { | ||
this.intl.locale = 'en'; | ||
this.localStorage.setItem('locale', 'en-'); | ||
} else { | ||
this.intl.locale = 'nl'; | ||
this.localStorage.setItem('locale', 'nl'); | ||
} | ||
} | ||
|
||
@action | ||
setStaticPages() { | ||
if (!this.session.isAuthenticated && !this.media.isMobile) { | ||
this.store.findAll('static-page').then((pages) => { | ||
// make key-value pairs for all found static pages that do not appear by itself | ||
let staticPages = {}; | ||
pages.forEach((page) => { | ||
if (!['word-lid', 'sponsoring'].includes(page.id)) { | ||
staticPages[page.id] = page.title; | ||
} | ||
}); | ||
} | ||
}, | ||
}, | ||
}); | ||
this.staticPages = staticPages; | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.