Skip to content

Commit

Permalink
Merge branch 'development' into DES/enhancement/#732-vlc-refactor
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
  • Loading branch information
brenner-company committed May 12, 2021
2 parents 824a324 + 93b5c8c commit 70ddfb7
Show file tree
Hide file tree
Showing 53 changed files with 1,266 additions and 1,381 deletions.
194 changes: 112 additions & 82 deletions app/components/m-header.hbs
Original file line number Diff line number Diff line change
@@ -1,87 +1,117 @@
<div class="auk-navbar auk-navbar--bordered-bottom auk-navbar--no-pad auk-navbar--auto l-main-header"
id="c-main-nav">
<div class="auk-toolbar-complex auk-toolbar-complex--auto l-main-header__toolbar">
<div class="auk-toolbar-complex__left">
<div class="auk-toolbar-complex__item">
<ul class="auk-tabs">
{{#if hasPublicationsEnabled}}
<li class="auk-tabs__tab" data-test-m-header-publications>
{{#link-to
"publications"
}}
<span class="auk-tabs__tab-inner">{{t "publications"}}</span>
{{/link-to}}
</li>
<WebComponents::AuNavbar @border="bottom" @skin="white" @noPadding="true" id="c-main-nav">
<WebComponents::AuToolbar>
<WebComponents::AuToolbar::Group @position="left">
<WebComponents::AuToolbar::Item>
<WebComponents::AuBrand @logotype="Kaleidos"/>
</WebComponents::AuToolbar::Item>
<WebComponents::AuToolbar::Item>
<WebComponents::AuTabs>
{{#if this.hasPublicationsEnabled}}
<WebComponents::AuTab @route="publications" data-test-m-header-publications>{{t "publications"}}</WebComponents::AuTab>
{{/if}}
<li class="auk-tabs__tab" data-test-m-header-agendas>
{{#link-to
"agendas.overview"
current-when="agendas agenda print-overviews.decisions print-overviews.press-agenda"
}}
<span class="auk-tabs__tab-inner">{{t "agendas"}}</span>
{{/link-to}}
</li>
<li class="auk-tabs__tab" data-test-m-header-cases>
{{#link-to "cases"}}
<span class="auk-tabs__tab-inner">{{t "cases"}}</span>
{{/link-to}}
</li>
{{#if currentSession.isViewer }}
<li class="auk-tabs__tab" data-test-m-header-newsletters>
{{#link-to
"newsletters"
current-when="newsletters newsletter print-overviews.newsletter"
}}
<span class="auk-tabs__tab-inner">{{t "newsletter"}}</span>
{{/link-to}}
</li>
<WebComponents::AuTab @route="agendas.overview"
@currentWhen="agendas agenda print-overviews.decisions print-overviews.press-agenda"
data-test-m-header-agendas>
{{t "agendas"}}
</WebComponents::AuTab>
<WebComponents::AuTab @route="cases" data-test-m-header-cases>{{t "cases"}}</WebComponents::AuTab>
{{#if this.currentSession.isViewer}}
<WebComponents::AuTab @route="newsletters"
@currentWhen="newsletters newsletter print-overviews.newsletter"
data-test-m-header-newsletters>
{{t "newsletter"}}
</WebComponents::AuTab>
{{/if}}
<li class="auk-tabs__tab" data-test-m-header-search>
<LinkTo
@route="search.index"
@current-when="search"
>
{{!-- TODO: magnifying glass icon --}}
<span class="auk-tabs__tab-inner">{{capitalize (t "search")}}</span>
</LinkTo>
</li>
{{#if currentSession.isEditor}}
<li class="auk-tabs__tab" data-test-m-header-settings>
{{#link-to "settings.overview"}}
<span class="auk-tabs__tab-inner">{{t "settings"}}</span>
{{/link-to}}
</li>
<WebComponents::AuTab @route="search.index"
@currentWhen="search"
data-test-m-header-search>
<WebComponents::AuIcon @name="search" class="auk-icon--search" />
{{capitalize (t "search")}}
</WebComponents::AuTab>
{{#if this.currentSession.isEditor}}
<WebComponents::AuTab @route="settings.overview" data-test-m-header-settings>{{t "settings"}}</WebComponents::AuTab>
{{/if}}
</ul>
</div>
</div>
<div class="auk-toolbar-complex__right">
<div class="auk-toolbar-complex__right">
{{#if showEnvironmentName}}
<div class="vlc-environment-pill {{environmentClass}}">
{{environmentName}}
{{capitalize (t "environment")}}
</WebComponents::AuTabs>
</WebComponents::AuToolbar::Item>
</WebComponents::AuToolbar::Group>
<WebComponents::AuToolbar::Group @position="right">
{{#if this.showEnvironmentName}}
<WebComponents::AuToolbar::Item class="auk-u-mr-3" >
<div class="vlc-environment-pill {{this.environmentClass}}">
{{this.environmentName}}
</div>
</WebComponents::AuToolbar::Item>
{{/if}}
<WebComponents::AuToolbar::Item>
<WebComponents::AuButtonLink
@skin="muted"
@padded="padded"
@icon="circle-question">
{{t "help"}}
</WebComponents::AuButtonLink>
<AttachPopover
@renderInPlace={{true}}
@class="ember-attacher-popper"
@hideOn="clickout click"
@showOn="click"
@animation="shift"
@placement="bottom-end"
>
<WebComponents::AuDropdown>
<WebComponents::AuDropdown::Item @href="https://kaleidos.vlaanderen.be/Kaleidos_Raadplegen_20200629.pdf"
target="_blank">
{{t "look-at-documentation"}}
</WebComponents::AuDropdown::Item>
<WebComponents::AuDropdown::Item @href="mailto:[email protected]">
<div>
<span>{{t "contact-us"}}</span>
<span class="auk-u-muted auk-u-text-small">{{t "email-servicedesk"}}</span>
</div>
</WebComponents::AuDropdown::Item>
</WebComponents::AuDropdown>
</AttachPopover>
</WebComponents::AuToolbar::Item>
<WebComponents::AuToolbar::Item class="auk-u-mr-3" >
{{#if this.currentSession.userContent}}
<WebComponents::AuButtonLink
data-test-m-header-user-actions
@skin="muted"
@icon="chevron-down"
@layout="icon-right">
{{this.currentSession.userContent.firstName}}
</WebComponents::AuButtonLink>
<AttachPopover
@renderInPlace={{true}}
@class="ember-attacher-popper"
@hideOn="clickout click"
@showOn="click"
@animation="shift"
@placement="bottom-end"
>
<WebComponents::AuDropdown>
<WebComponents::AuDropdown::Item @textOnly={{true}}>
<WebComponents::AuAvatar @icon="user" @name="{{this.getFullUserName}}">
<p>{{this.getFullUserName}}</p>
<p class="auk-u-muted auk-u-text-small">{{this.currentSession.userRole}}</p>
</WebComponents::AuAvatar>
</WebComponents::AuDropdown::Item>
<WebComponents::AuDropdown::Divider/>
<WebComponents::AuDropdown::Item {{on "click" this.logout}} data-test-m-header-user-action-logout>
{{t "sign-out"}}
</WebComponents::AuDropdown::Item>
</WebComponents::AuDropdown>
</AttachPopover>
{{else}}
<WebComponents::AuButtonLink
@route="login"
@skin="muted"
@data-menu-samewidth="true"
>
{{t "login"}}
</WebComponents::AuButtonLink>
{{/if}}
</div>
<div class="auk-toolbar-complex__item">
<div class="auk-u-flex auk-u-flex--vertical-center auk-u-text-small auk-u-mx-2">
{{#if currentSession.userContent}}
<div class="auk-u-mr">
{{currentSession.userContent.firstName}}
{{currentSession.userContent.lastName}}
({{currentSession.userRole}})
</div>
<a href="" {{action "logout"}}>
{{t "sign-out"}}
</a>
{{else}}
{{#link-to "login"}}
{{t "login"}}
{{/link-to}}
{{/if}}
</div>
</div>
</div>
</div>
</div>
</WebComponents::AuToolbar::Item>
</WebComponents::AuToolbar::Group>
</WebComponents::AuToolbar>
</WebComponents::AuNavbar>

58 changes: 32 additions & 26 deletions app/components/m-header.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
import Component from '@ember/component';
import ENV from 'frontend-kaleidos/config/environment';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
import { action } from '@ember/object';
import { isEmpty } from '@ember/utils';
import Component from '@glimmer/component';

export default Component.extend({
currentSession: service(),
classNames: ['auk-u-block'],

init() {
this._super(...arguments);
export default class MHeader extends Component {
@service currentSession;
@service router;

constructor() {
super(...arguments);
if (window.location.href.indexOf('http://localhost') === 0) {
this.set('environmentName', 'LOCAL');
this.set('environmentClass', 'vlc-environment-pill--local');
this.environmentName = 'LOCAL';
this.environmentClass = 'vlc-environment-pill--local';
}

if (window.location.href.indexOf('https://kaleidos-dev.vlaanderen.be') === 0) {
this.set('environmentName', 'DEV');
this.set('environmentClass', 'vlc-environment-pill--dev');
this.environmentName = 'DEV';
this.environmentClass = 'vlc-environment-pill--dev';
}

if (window.location.href.indexOf('https://kaleidos-test.vlaanderen.be') === 0) {
this.set('environmentName', 'TEST');
this.set('environmentClass', 'vlc-environment-pill--test');
this.environmentName = 'TEST';
this.environmentClass = 'vlc-environment-pill--test';
}

if (window.location.href.indexOf('https://kaleidos.vlaanderen.be') === 0
&& this.currentSession.checkIsDeveloper()) {
this.set('environmentName', 'PROD');
this.set('environmentClass', 'vlc-environment-pill--prod');
this.environmentName = 'PROD';
this.environmentClass = 'vlc-environment-pill--prod';
}
},
}

get hasPublicationsEnabled() {
return !isEmpty(ENV.APP.ENABLE_PUBLICATIONS_TAB);
}

hasPublicationsEnabled: !isEmpty(ENV.APP.ENABLE_PUBLICATIONS_TAB),
get getFullUserName() {
return `${this.currentSession.userContent.firstName} ${this.currentSession.userContent.lastName}`;
}

showEnvironmentName: computed('environmentName', function() {
get showEnvironmentName() {
return ['TEST', 'LOCAL', 'DEV'].indexOf(this.environmentName) >= 0;
}),

actions: {
async logout() {
await this.currentSession.logout();
},
},
});
}

@action
async logout() {
await this.currentSession.logout();
}
}
12 changes: 7 additions & 5 deletions app/components/publications/new-publication-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Component from '@glimmer/component';
import { action } from '@ember/object';
import { task } from 'ember-concurrency-decorators';
import { tracked } from '@glimmer/tracking';
import { isBlank } from '@ember/utils';

export default class NewPublicationModal extends Component {
@service publicationService;
Expand Down Expand Up @@ -39,14 +40,15 @@ export default class NewPublicationModal extends Component {

@task
*initPublicationNumber() {
// Deze query possibly breaks if publication-flows without number exist
const latestPublication = yield this.store.queryOne('publication-flow', {
sort: '-publication-number',
sort: '-identification.structured-identifier.local-identifier',
include: 'identification.structured-identifier',
});
if (latestPublication) {
this.number = latestPublication.publicationNumber + 1;
const identification = yield latestPublication.identification;
const structuredIdentifier = yield identification.structuredIdentifier;
this.number = structuredIdentifier.localIdentifier + 1;
} else {
// This should only be a "no-data" issue, in that case we have to default to number 1
this.number = 1;
}
}
Expand All @@ -59,7 +61,7 @@ export default class NewPublicationModal extends Component {
yield this.args.onSave(
{
number: this.number,
suffix: this.suffix,
suffix: isBlank(this.suffix) ? undefined : this.suffix,
shortTitle: this.shortTitle,
longTitle: this.longTitle,
});
Expand Down
12 changes: 6 additions & 6 deletions app/components/publications/publication-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<div class="auk-u-m-3">
<div class="auk-form-group {{if this.numberIsAlreadyUsed "auk-form-group--error"}}">
<WebComponents::AuLabel>{{t 'publications-number'}}</WebComponents::AuLabel>
<WebComponents::AuInput type="number" value={{@publicationFlow.publicationNumber}}
<WebComponents::AuInput type="number" value={{@publicationFlow.identification.structuredIdentifier.localIdentifier}}
{{on "input" (perform this.setPublicationNumber)}} />
<WebComponents::AuInput size="5" type="text" value={{@publicationFlow.publicationSuffix}}
{{on "input" (perform this.setPublicationSuffix)}} />
<WebComponents::AuInput size="5" type="text" value={{@publicationFlow.identification.structuredIdentifier.versionIdentifier}}
{{on "input" (perform this.setPublicationNumberSuffix)}} />

{{#if this.numberIsAlreadyUsed}}
<div class="auk-form-help-text auk-form-help-text--danger">
Expand Down Expand Up @@ -99,14 +99,14 @@
{{#each @publicationFlow.numacNumbers as |numac|}}
<div class="vlc-numac-number-wrapper">
<div class="vlc-numac-number">
<span>{{ numac.name }}</span>
<span>{{ numac.idName }}</span>
</div>
<div class="vlc-numac-number-delete-button-wrapper">
<WebComponents::AuButton class="auk-button--nopadding"
@skin="borderless"
@icon="close"
@layout="icon-only"
{{on "click" (perform this.unlinkNumacNumber numac)}}
{{on "click" (fn this.deleteNumacNumber numac)}}
data-test-cases-backlink/>
</div>
</div>
Expand All @@ -121,7 +121,7 @@

<WebComponents::AuButton
@skin="borderless"
{{on "click" (perform this.addNumacNumber)}}
{{on "click" this.addNumacNumber}}
>
{{t "add"}}
</WebComponents::AuButton>
Expand Down
Loading

0 comments on commit 70ddfb7

Please sign in to comment.