Skip to content

Commit

Permalink
Merge pull request #694 from lblod/GN-4909-mandatee-sync
Browse files Browse the repository at this point in the history
GN-4909: inauguration meeting synchronization support
  • Loading branch information
abeforgit authored Sep 2, 2024
2 parents 2483c04 + 29acd50 commit 4c41159
Show file tree
Hide file tree
Showing 31 changed files with 1,351 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-mice-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': patch
---

Update `@lblod/ember-rdfa-editor` to version 10.3.0
5 changes: 5 additions & 0 deletions .changeset/thirty-elephants-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': minor
---

Addition of a generic `SimpleModal` component. This component is an extension of the `AuModal` component. It is less opinionated as the content can be completely configured (no predefined content).
5 changes: 5 additions & 0 deletions .changeset/wicked-ghosts-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': minor
---

Addition of a basic meeting synchronization flow which allows users to synchronize an inauguration meeting with a configured LMB endpoint.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {
rules: {
'ember/no-mixins': 'warn',
semi: 'error', // Remove this rule once Prettier is enabled
'getter-return': ['error', { allowImplicit: true }],
},
overrides: [
// node files
Expand Down
16 changes: 13 additions & 3 deletions app/components/behandeling-van-agendapunt.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{{#if this.editable}}
<div class='au-c-meeting-chrome-editable'>
<AuHeading id='behandeling-{{@behandeling.id}}' @level='3' @skin='4'>
{{limit-content @behandeling.onderwerp.titel 80}}
</AuHeading>
<div
class='au-u-flex au-u-flex--spaced-small au-u-flex--row au-u-flex--vertical-center'
>
<AuHeading id='behandeling-{{@behandeling.id}}' @level='3' @skin='4'>
{{limit-content @behandeling.onderwerp.titel 80}}
</AuHeading>
{{#if this.isInaugurationMeeting}}
<AuPill @icon='alert-triangle' @skin='warning'>
{{t 'behandeling-van-agendapunten.sync-warning'}}
</AuPill>
{{/if}}
</div>

<Common::MeetingSubSection
@title={{t 'behandeling-van-agendapunten.visibility'}}
>
Expand Down
5 changes: 5 additions & 0 deletions app/components/behandeling-van-agendapunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { service } from '@ember/service';
import { use } from 'ember-could-get-used-to-this';
import RelationshipResource from '../helpers/relationship-resource';
import { trackedFunction } from 'ember-resources/util/function';
import InstallatieVergaderingModel from '../models/installatievergadering';

/** @typedef {import("../models/mandataris").default} Mandataris */
/** @typedef {import("../models/behandeling-van-agendapunt").default} Behandeling */
Expand Down Expand Up @@ -131,6 +132,10 @@ export default class BehandelingVanAgendapuntComponent extends Component {
return this.meetingSecretaryData.value;
}

get isInaugurationMeeting() {
return this.args.meeting instanceof InstallatieVergaderingModel;
}

getStatus = task(async () => {
const container = await this.behandeling?.documentContainer;
if (container) {
Expand Down
30 changes: 30 additions & 0 deletions app/components/common/simple-modal.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{#if @modalOpen}}
{{#in-element this.destinationElement insertBefore=null}}
<div class='au-c-modal-backdrop {{if @modalOpen "is-visible"}}'></div>
<div
id='{{@id}}'
class={{class-names
'au-c-modal'
this.size
this.padding
this.overflow
(if @modalOpen 'is-visible')
}}
role='dialog'
tabindex='-1'
{{focus-trap
isActive=@modalOpen
additionalElements=this.additionalElements
focusTrapOptions=(hash
initialFocus=@initialFocus
fallbackFocus=this.fallbackFocus
escapeDeactivates=this.handleEscapePress
allowOutsideClick=true
)
}}
...attributes
>
{{yield}}
</div>
{{/in-element}}
{{/if}}
78 changes: 78 additions & 0 deletions app/components/common/simple-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* Based on https://github.com/appuniversum/ember-appuniversum/blob/3e2765ce76f4346876638f47e181aa69f193c401/addon/components/au-modal.gts
* The MIT License (MIT)
* Copyright (c) 2020
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import Component from '@glimmer/component';
import { action } from '@ember/object';

const FOCUS_TRAP_ADDITIONAL_ELEMENTS = ['#ember-basic-dropdown-wormhole'];
export default class SimpleModal extends Component {
destinationElement;

constructor(owner, args) {
super(owner, args);

this.destinationElement = document.querySelector(
'[data-au-modal-container]',
);
}

get size() {
if (this.args.size === 'fullscreen') return 'au-c-modal--fullscreen';
if (this.args.size === 'large') return 'au-c-modal--large';
else return '';
}

get padding() {
if (this.args.padding === 'none') return 'au-c-modal--flush';
else return '';
}

get overflow() {
if (this.args.overflow) return 'au-c-modal--overflow';
else return '';
}

get initialFocus() {
return this.args.initialFocus;
}

get fallbackFocus() {
return '.au-c-modal';
}

get additionalElements() {
return FOCUS_TRAP_ADDITIONAL_ELEMENTS.filter(
(element) => document.querySelector(element) !== null,
);
}

@action
handleCloseClick() {
if (this.isClosable) {
this.closeModal();
}
}

@action
handleEscapePress() {
if (this.isClosable) {
this.closeModal();
}

// escapeDeactivates should be set to false since we don't want the focus-trap to deactivate if the modal stays open
// which could happen if the consumer doesn't change the `@modalOpen` argument in the callback.
return false;
}

@action
closeModal() {
this.args.closeModal?.();
}
}
41 changes: 41 additions & 0 deletions app/components/inauguration-meeting/synchronization-toast.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{#if @options.success}}
<AuAlert
@skin='success'
@icon='check'
@size='small'
@closable={{true}}
@onClose={{@close}}
>
<p class='au-u-medium'>
{{t 'inauguration-meeting.synchronization.toast.success.title'}}
</p>
</AuAlert>
{{else}}
<AuAlert
@skin='warning'
@icon='alert-triangle'
@size='small'
@closable={{true}}
@onClose={{@close}}
>
<p class='au-u-medium'>{{t
'inauguration-meeting.synchronization.toast.failure.title'
}}</p>
<p>
{{html-safe
(t
'inauguration-meeting.synchronization.toast.failure.body.paragraph-1'
link=this.lmbEndpoint
)
}}
</p>
<p>
{{html-safe
(t
'inauguration-meeting.synchronization.toast.failure.body.paragraph-2'
email='[email protected]'
)
}}
</p>
</AuAlert>
{{/if}}
8 changes: 8 additions & 0 deletions app/components/inauguration-meeting/synchronization-toast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Component from '@glimmer/component';
import ENV from 'frontend-gelinkt-notuleren/config/environment';

export default class InaugurationMeetingSynchronizationToast extends Component {
get lmbEndpoint() {
return ENV.lmbEndpoint;
}
}
73 changes: 73 additions & 0 deletions app/components/inauguration-meeting/synchronization.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{#if this.synchronizationStatus.value}}
<AuButton
@icon={{this.buttonIcon}}
class={{this.buttonClass}}
{{on 'click' this.openModal}}
>
{{this.synchronizationStatus.value.label}}
</AuButton>
{{/if}}
<Common::SimpleModal @modalOpen={{this.modalOpen}} @closeModal={{this.cancel}}>
<AuToolbar class='au-u-padding meeting__sync-modal__header' as |Group|>
<Group>
<AuHeading @level='1' @skin='2'>
{{t 'inauguration-meeting.synchronization.modal.title'}}
</AuHeading>
</Group>
<Group>
<AuButton
{{on 'click' this.cancel}}
@skin='naked'
@disabled={{this.synchronize.isRunning}}
>
{{t 'inauguration-meeting.synchronization.modal.actions.cancel'}}
</AuButton>
<AuButton
{{on 'click' (perform this.synchronize)}}
@icon='synchronize'
@skin='primary'
@loading={{this.synchronize.isRunning}}
>
{{t 'inauguration-meeting.synchronization.modal.actions.synchronize'}}
</AuButton>
</Group>
</AuToolbar>

<div class='au-u-padding au-o-flow--small'>
<p>{{html-safe
(t
'inauguration-meeting.synchronization.modal.info.paragraph-1'
link=this.lmbEndpoint
)
}}</p>
<p>{{t 'inauguration-meeting.synchronization.modal.info.paragraph-2'}}</p>
<AuHeading @level='2' @skin='5'>
{{t 'inauguration-meeting.synchronization.modal.attendee-list.title'}}
</AuHeading>
<p class='au-u-italic'>
{{t
'inauguration-meeting.synchronization.modal.attendee-list.no-changes'
}}
</p>
<AuHeading @level='2' @skin='5'>
{{t 'inauguration-meeting.synchronization.modal.decisions.title'}}
</AuHeading>
{{#if this.treatments.isLoading}}
<AuLoader @padding='small' />
<AuHelpText>{{t 'participation-list.loading-loader'}}</AuHelpText>
{{else}}
<ol class='meeting__sync-modal__treatments'>
{{#each this.treatments.value as |treatment|}}
<li class='meeting__sync-modal__treatments__entry'>
<AuHeading @level='3' @skin='4'>
{{limit-content treatment.onderwerp.titel 80}}
</AuHeading>
<AuPill @icon='alert-triangle' @skin='warning'>
{{t 'behandeling-van-agendapunten.sync-warning'}}
</AuPill>
</li>
{{/each}}
</ol>
{{/if}}
</div>
</Common::SimpleModal>
Loading

0 comments on commit 4c41159

Please sign in to comment.