Skip to content

Commit

Permalink
Implemented comments in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellen-Wittingen committed Oct 21, 2023
1 parent 4378cbf commit b1cf259
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 149 deletions.
32 changes: 16 additions & 16 deletions app/components/cards/public-room-advert-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,52 @@
<div class="row">
<div class="pe-4 col-12 col-md-6 mb-3">
<div class="width-fit-content">
<h2 class="text-secondary me-5">{{roomAdvert.houseName}}</h2>
<h2 class="text-secondary me-5">{{@roomAdvert.houseName}}</h2>
<hr class="border border-secondary bg-secondary border-3 opacity-100 mt-0" />
</div>
<table>
{{#if roomAdvert.location}}
{{#if @roomAdvert.location}}
<tr>
<th class="pe-3 text-secondary">{{t 'component.public.roomForum.location'}}</th>
<td>
<a
href='https://maps.google.com/?q={{roomAdvert.location}}'
href='https://maps.google.com/?q={{@roomAdvert.location}}'
target='_blank'
>
{{roomAdvert.location}}
{{@roomAdvert.location}}
</a>
</td>
</tr>
{{/if}}
{{#if roomAdvert.availableFrom}}
{{#if @roomAdvert.availableFrom}}
<tr>
<th class="pe-3 text-secondary">{{t 'component.public.roomForum.availableFrom'}}</th>
<td>{{roomAdvert.availableFrom}}</td>
<td>{{@roomAdvert.availableFrom}}</td>
</tr>
{{/if}}
<tr>
<th class="pe-3 text-secondary">{{t 'component.public.roomForum.contact'}}</th>
<td>
{{#if (is-phone roomAdvert.contact)}}
<a href='tel:{{roomAdvert.contact}}'>{{roomAdvert.contact}}</a>
{{else if (is-email roomAdvert.contact)}}
<a href='mailto:{{roomAdvert.contact}}'>{{roomAdvert.contact}}</a>
{{else if (is-url roomAdvert.contact)}}
<a href='{{roomAdvert.contact}}' target='_blank'>{{roomAdvert.contact}}</a>
{{#if (is-phone @roomAdvert.contact)}}
<a href='tel:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a>
{{else if (is-email @roomAdvert.contact)}}
<a href='mailto:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a>
{{else if (is-url @roomAdvert.contact)}}
<a href='{{@roomAdvert.contact}}' target='_blank'>{{@roomAdvert.contact}}</a>
{{else}}
{{roomAdvert.contact}}
{{@roomAdvert.contact}}
{{/if}}
</td>
</tr>
</table>
</div>
{{#if roomAdvert.coverPhotoUrl}}
<img src={{roomAdvert.coverPhotoUrl}} class='col-12 col-md-6 mb-3 object-fit-cover'/>
{{#if @roomAdvert.coverPhotoUrl}}
<img src={{@roomAdvert.coverPhotoUrl}} class='col-12 col-md-6 mb-3 object-fit-cover'/>
{{/if}}
</div>
<p class='card-text' data-test-room-advert-description>
{{markdown-to-html
roomAdvert.descriptionCamofied
@roomAdvert.descriptionCamofied
extensions='youtubeEmbed bootstrapTable'
}}
</p>
Expand Down
9 changes: 0 additions & 9 deletions app/components/cards/public-room-advert-card.js

This file was deleted.

36 changes: 18 additions & 18 deletions app/components/cards/room-advert-card.hbs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<div class='card'>
<div class='card-header card-header--overlay'>
<img class='card-img-top' src={{roomAdvert.coverPhotoUrlOrDefault}} />
<img class='card-img-top' src={{@roomAdvert.coverPhotoUrlOrDefault}} />

<div class='card-title-bar gradient-overlay'>

<div class='card-titles'>
<h2 class='card-title' data-test-room-advert-house-name>
{{roomAdvert.houseName}}
{{@roomAdvert.houseName}}
</h2>
<h3 class='card-subtitle'>
<span class='subtitle-author' data-test-room-advert-author>
<LinkTo
@route='users.user'
roomAdvert={{roomAdvert.author.id}}
@model={{@roomAdvert.author.id}}
class='link-to card-subtitle-link'
>
{{roomAdvert.author.fullName}}
{{@roomAdvert.author.fullName}}
</LinkTo>
</span>
</h3>
Expand All @@ -24,47 +24,47 @@
</div>

<div class='row card-subheader-row ms-0 me-0'>
{{#if roomAdvert.location}}
{{#if @roomAdvert.location}}
<div class='col-12 col-md-6 card-subheader-item align-items-center p-3'>
<b>Locatie: </b>
<a
href='https://maps.google.com/?q={{roomAdvert.location}}'
href='https://maps.google.com/?q={{@roomAdvert.location}}'
target='_blank'
>
{{roomAdvert.location}}
{{@roomAdvert.location}}
</a>
</div>
{{/if}}

{{#if roomAdvert.availableFrom}}
{{#if @roomAdvert.availableFrom}}
<div class='col-12 col-md-6 card-subheader-item align-items-center p-3'>
<b>Beschikbaar vanaf: </b>
{{roomAdvert.availableFrom}}
{{@roomAdvert.availableFrom}}
</div>
{{/if}}
</div>

<div class='card-body'>
<p class='card-text' data-test-room-advert-description>
{{markdown-to-html
roomAdvert.descriptionCamofied
@roomAdvert.descriptionCamofied
extensions='youtubeEmbed bootstrapTable'
}}
</p>
</div>

{{#if roomAdvert.contact}}
{{#if @roomAdvert.contact}}
<div class='row card-sub-bottom-row ms-0 me-0'>
<div class='col-12 card-sub-item align-items-center p-3'>
<b>Contact: </b>
{{#if (is-phone roomAdvert.contact)}}
<a href='tel:{{roomAdvert.contact}}'>{{roomAdvert.contact}}</a>
{{else if (is-email roomAdvert.contact)}}
<a href='mailto:{{roomAdvert.contact}}'>{{roomAdvert.contact}}</a>
{{else if (is-url roomAdvert.contact)}}
<a href='{{roomAdvert.contact}}' target='_blank'>{{roomAdvert.contact}}</a>
{{#if (is-phone @roomAdvert.contact)}}
<a href='tel:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a>
{{else if (is-email @roomAdvert.contact)}}
<a href='mailto:{{@roomAdvert.contact}}'>{{@roomAdvert.contact}}</a>
{{else if (is-url @roomAdvert.contact)}}
<a href='{{@roomAdvert.contact}}' target='_blank'>{{@roomAdvert.contact}}</a>
{{else}}
{{roomAdvert.contact}}
{{@roomAdvert.contact}}
{{/if}}
</div>
</div>
Expand Down
9 changes: 0 additions & 9 deletions app/components/cards/room-advert-card.js

This file was deleted.

32 changes: 16 additions & 16 deletions app/components/header-nav.hbs
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<nav class='navbar pb-0 pt-0 {{if (not session.isAuthenticated) "public"}}' aria-label='breadcrumb'>
<nav class='header-nav navbar pb-0 pt-0 {{if (not this.session.isAuthenticated) "public"}}' aria-label='breadcrumb'>
<div class="container-fluid d-flex justify-content-between">
<span
class='{{if session.isAuthenticated "half-toggle" "pe-2"}} left-sidebar-toggle d-block d-md-none link'
class='{{if this.session.isAuthenticated "half-toggle" "pe-2"}} left-sidebar-toggle d-block d-md-none link'
{{action 'toggleLeftSidebar'}}
>
</span>

{{#if session.isAuthenticated }}
<span {{action 'handleLogoAction'}} class='navbar-brand'>
{{#if this.session.isAuthenticated }}
<span {{action this.handleLogoAction}} class='navbar-brand'>
<div class='header-logo'> </div>
</span>
{{else}}
<div class='public-header-logo'> </div>
{{/if}}

<div class='d-flex col ps-0 pe-0 navbar-contents-holder {{if (not session.isAuthenticated) "public"}}'>
<div class='d-flex col ps-0 pe-0 navbar-contents-holder {{if (not this.session.isAuthenticated) "public"}}'>
<div class='navbar-overflow-wrapper'>
<div class='navbar-nav col d-flex flex-row'>
{{#if session.isAuthenticated}}
{{#if this.session.isAuthenticated}}
<Breadcrumbs @routeInfos={{@routeInfos}} />
{{else if (not media.isMobile)}}
{{else if (not this.media.isMobile)}}
<LinkTo @route='index' class="page-actions-buttons">
<BsButton @type="primary" class="public-navbar-button {{if (eq router.currentRouteName 'index') 'selected'}}">Home</BsButton>
<BsButton @type="primary" class="public-navbar-button {{if (eq this.router.currentRouteName 'index') 'selected'}}">Home</BsButton>
</LinkTo>
<BsDropdown class="position-static" as |dd| {{did-insert (action 'setStaticPages')}}>
<BsDropdown class="position-static" as |dd| {{did-insert (action this.setStaticPages)}}>
<dd.button @type="primary" class="public-navbar-button {{if this.onAboutUsPage 'selected'}}">
{{t "component.headerNav.aboutUs"}}
</dd.button>
<dd.menu class="public-about-us-dropdown" @renderInPlace={{true}} as |ddm|>
{{#each-in staticPages as |id title|}}
{{#each-in this.staticPages as |id title|}}
<ddm.item>
<ddm.linkTo @route='static-pages.static-page' @model={{id}} class="btn btn-primary">
{{title}}
Expand All @@ -42,29 +42,29 @@
</dd.menu>
</BsDropdown>
<LinkTo @route='static-pages.static-page' @model='word-lid' class="page-actions-buttons">
<BsButton @type="primary" class="public-navbar-button {{if (eq router.currentURL '/static-pages/word-lid') 'selected'}}">{{t "component.headerNav.becomeMember"}}</BsButton>
<BsButton @type="primary" class="public-navbar-button {{if (eq this.router.currentURL '/static-pages/word-lid') 'selected'}}">{{t "component.headerNav.becomeMember"}}</BsButton>
</LinkTo>
<LinkTo @route='static-pages.static-page' @model='sponsoring' class="page-actions-buttons">
<BsButton @type="primary" class="public-navbar-button {{if (eq router.currentURL '/static-pages/sponsoring') 'selected'}}">{{t "component.headerNav.sponsoring"}}</BsButton>
<BsButton @type="primary" class="public-navbar-button {{if (eq this.router.currentURL '/static-pages/sponsoring') 'selected'}}">{{t "component.headerNav.sponsoring"}}</BsButton>
</LinkTo>
{{/if}}
</div>
</div>

<div id='navbar-wormhole'></div>

{{#unless session.isAuthenticated}}
{{#unless this.session.isAuthenticated}}
<LinkTo @route='login' class='d-none d-md-flex me-2'>
<button class='btn btn-primary public-navbar-button {{if (eq router.currentRouteName 'login') 'selected'}}' type='button'>
<button class='btn btn-primary public-navbar-button {{if (eq this.router.currentRouteName 'login') 'selected'}}' type='button'>
{{t 'tag.button.signin'}}
</button>
</LinkTo>
{{/unless}}
</div>

{{#unless session.isAuthenticated}}
{{#unless this.session.isAuthenticated}}
<button
class='btn btn-locale btn-inverse-locale-{{intl.locale}} me-2'
class='btn btn-locale btn-inverse-locale-{{this.intl.locale}} me-2'
title='{{t "component.headerNav.changeLocale"}}'
{{action 'toggleLocale'}}
type='button'>
Expand Down
127 changes: 68 additions & 59 deletions app/components/header-nav.js
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;
});
}
}
}
Loading

0 comments on commit b1cf259

Please sign in to comment.