Skip to content

Commit

Permalink
Merge branch 'DES/enhancement/css-refactor' into DES/enhancement/#705-…
Browse files Browse the repository at this point in the history
…vl-refactor
  • Loading branch information
brenner-company committed Feb 25, 2021
2 parents 61f9329 + 5d55101 commit f723356
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 187 deletions.
5 changes: 3 additions & 2 deletions app/pods/components/agenda/agenda-header/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default Component.extend(FileSaverMixin, {
/**
* @method CreateDesignAgenda
*
* Get the last approved agenda and change te status to approves (from final)
* Get the last approved agenda and change the status to approves (from final)
* Then approve that agenda using the agenda-approve service which yields a new design agenda
*/
async createDesignAgenda() {
Expand Down Expand Up @@ -401,6 +401,7 @@ export default Component.extend(FileSaverMixin, {

if (designAgenda) {
await this.agendaService.deleteAgenda(designAgenda);
// TODO is alle data uit de local store na deze actie ?
// After the agenda has been deleted, we want to update the agendaitems of activity
const agendaitems = await lastApprovedAgenda.get('agendaitems');
await this.reloadAgendaitemsOfAgendaActivities(agendaitems);
Expand Down Expand Up @@ -430,7 +431,7 @@ export default Component.extend(FileSaverMixin, {

// this could be previousVersion of agenda, but is not implemented
const previousAgenda = await this.get('sessionService').findPreviousAgendaOfSession(currentMeeting, currentAgenda);
currentMeeting.set('agenda', previousAgenda);
currentMeeting.set('agenda', previousAgenda); // TODO setting this here might result in a one-to-many with multiple on the "one" side on future agenda versions
await currentMeeting.save();

await this.agendaService.deleteAgenda(currentAgenda);
Expand Down
167 changes: 79 additions & 88 deletions app/pods/components/agenda/agenda-header/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,16 @@
<div class="vlc-toolbar__right">
<div class="vlc-toolbar__item">
<div class="vl-action-group">
{{#if (and currentAgenda.isDesignAgenda currentSessionService.isEditor)}}
{{#if currentSessionService.isEditor}}
<button type="button"
data-test-agenda-header-showAgendaOptions
class="vl-button vl-button--icon-before"
{{action "showAgendaActions"}}
>
{{t "agenda-approve"}}
{{#if (not isShowingAgendaActions)}}
<i class="vl-button__icon vl-button__icon--after ki-chevron-down"
{{t "agenda-actions"}}
<i class="vl-button__icon vl-button__icon--after {{if (not isShowingAgendaActions) "ki-chevron-down" "ki-chevron-up"}}"
{{action "showAgendaActions" bubbles=false}}
></i>
{{else}}
<i class="vl-button__icon vl-button__icon--after ki-chevron-up"
{{action "showAgendaActions" bubbles=false}}
></i>
{{/if}}
{{#attach-popover
renderInPlace=true
class="ember-attacher-popper vlc-hide-on-print"
Expand All @@ -62,30 +56,85 @@
as |attacher|
}}
<ul class="vlc-dropdown-menu">
{{#if (and currentSessionService.isEditor currentAgenda.isDesignAgenda)}}
{{#if currentSessionService.isEditor}}
{{#if currentAgenda.isDesignAgenda}}
<li class="vlc-dropdown-menu__item">
<button type="button" data-test-agenda-header-approveAgenda class="vl-link vl-link--block"
{{action attacher.hide}}
{{action "openConfirmApproveAgenda"}}
>
{{t "approve-design-agenda" serialnumber=currentAgenda.serialnumber}}
</button>
</li>
<li class="vlc-dropdown-menu__separator" aria-hidden="true"></li>
<li class="vlc-dropdown-menu__item">
<button type="button" data-test-agenda-header-approve-and-close-agenda class="vl-link vl-link--block"
{{action attacher.hide}}
{{action "openConfirmApproveAgendaAndCloseMeeting"}}
>
<span>
{{t "approve-agenda-and-close" serialnumber=currentAgenda.serialnumber}}
</span>
</button>
</li>
<li class="vlc-dropdown-menu__separator" aria-hidden="true"></li>
{{/if}}
<li class="vlc-dropdown-menu__item">
<button type="button" data-test-agenda-header-approveAgenda class="vl-link vl-link--block"
{{#if (not currentSession.isFinal)}}
{{#if (await isSessionClosable)}}
<a href=""
data-test-agenda-header-lockAgenda
class="vl-link vl-link--block vl-u-text--error"
{{action "openConfirmCloseMeeting"}}
{{action attacher.hide}}
>
{{t "agenda-close"}}
</a>
{{/if}}
{{else}}
<a href=""
data-test-agenda-header-unlockAgenda
class="vl-link vl-link--block"
{{action "unlockAgenda"}}
{{action attacher.hide}}
>
{{t "agenda-reopen"}}
</a>
{{/if}}
</li>

{{/if}}
{{!-- These actions check for isEditor/isAdmin themselves, so we put these outside the previous if statement --}}
{{#if (await canDeleteSelectedAgenda)}}
<li class="vlc-dropdown-menu__separator" aria-hidden="true"></li>
<li class="vlc-dropdown-menu__item vlc-dropdown-menu__item--action-danger">
<a href=""
data-test-agenda-header-deleteAgenda
class="vl-link vl-u-text--error"
{{action "openConfirmDeleteSelectedAgenda"}}
{{action attacher.hide}}
{{action "openConfirmApproveAgenda"}}
>
{{t "approve-design-agenda" serialnumber=currentAgenda.serialnumber}}
</button>
{{t "agenda-delete"}}
</a>
</li>

{{/if}}
{{#if (await canReopenPreviousAgenda)}}
<li class="vlc-dropdown-menu__separator" aria-hidden="true"></li>
<li class="vlc-dropdown-menu__item">
<button type="button" data-test-agenda-header-approve-and-close-agenda class="vl-link vl-link--block"
{{action attacher.hide}}
{{action "openConfirmApproveAgendaAndCloseMeeting"}}
<li class="vlc-dropdown-menu__item vlc-dropdown-menu__item--action-danger"
>
<span>
{{t "approve-agenda-and-close" serialnumber=currentAgenda.serialnumber}}
</span>
</button>
<a href=""
data-test-agenda-header-reopen-previous-version
class="vl-link vl-link--block vl-u-text--error"
{{action "openConfirmReopenPreviousAgenda"}}
{{action attacher.hide}}
>
{{t "agenda-reopen-previous-version"}}
</a>
</li>
{{/if}}
</ul>
{{/attach-popover}}

</button>
{{/if}}
<button type="button"
Expand All @@ -94,15 +143,9 @@
{{action "showMultipleOptions"}}
>
{{t "actions"}}
{{#if (not isShowingOptions)}}
<i class="vl-button__icon vl-button__icon--after ki-chevron-down"
{{action "showMultipleOptions" bubbles=false}}
></i>
{{else}}
<i class="vl-button__icon vl-button__icon--after ki-chevron-up"
{{action "showMultipleOptions" bubbles=false}}
></i>
{{/if}}
<i class="vl-button__icon vl-button__icon--after {{if (not isShowingOptions) "ki-chevron-down" "ki-chevron-up"}}"
{{action "showMultipleOptions" bubbles=false}}
></i>
{{#attach-popover
renderInPlace=true
class="ember-attacher-popper vlc-hide-on-print"
Expand Down Expand Up @@ -233,29 +276,6 @@
{{/if}}
{{#if currentSessionService.isEditor}}
<li class="vlc-dropdown-menu__separator" aria-hidden="true"></li>
<li class="vlc-dropdown-menu__item">
{{#if (not currentSession.isFinal)}}
{{#if (await isSessionClosable)}}
<a href=""
data-test-agenda-header-lockAgenda
class="vl-link vl-link--block vl-u-text--error"
{{action "openConfirmCloseMeeting"}}
{{action attacher.hide}}
>
{{t "agenda-close"}}
</a>
{{/if}}
{{else}}
<a href=""
data-test-agenda-header-unlockAgenda
class="vl-link vl-link--block"
{{action "unlockAgenda"}}
{{action attacher.hide}}
>
{{t "agenda-reopen"}}
</a>
{{/if}}
</li>
<li class="vlc-dropdown-menu__item">
{{#if currentSession.canReleaseDecisions}}
<a href=""
Expand All @@ -277,27 +297,13 @@
</a>
{{/if}}
</li>
<li class="vlc-dropdown-menu__item vlc-dropdown-menu__item--action-danger"
>
{{#if (await canDeleteSelectedAgenda)}}
<a href=""
data-test-agenda-header-deleteAgenda
class="vl-link vl-u-text--error"
{{action "openConfirmDeleteSelectedAgenda"}}
{{action attacher.hide}}
>
{{t "agenda-delete"}}
</a>
{{/if}}
</li>
{{#if
(and
(not (await designAgendaPresent))
(not (await currentSession.isFinal))
)
}}
<li class="vlc-dropdown-menu__item vlc-dropdown-menu__item--action-danger"
>
<li class="vlc-dropdown-menu__item vlc-dropdown-menu__item--action-danger">
<a href=""
data-test-agenda-header-create-new-design
class="vl-link vl-link--block"
Expand All @@ -308,21 +314,6 @@
</a>
</li>
{{/if}}


{{#if (await canReopenPreviousAgenda)}}
<li class="vlc-dropdown-menu__item vlc-dropdown-menu__item--action-danger"
>
<a href=""
data-test-agenda-header-reopen-previous-version
class="vl-link vl-link--block vl-u-text--error"
{{action "openConfirmReopenPreviousAgenda"}}
{{action attacher.hide}}
>
{{t "agenda-reopen-previous-version"}}
</a>
</li>
{{/if}}
{{/if}}
</ul>
{{/attach-popover}}
Expand Down Expand Up @@ -477,7 +468,7 @@
{{/if}}

{{#if this.showConfirmForClosingMeeting}}
<WebComponents::AuModal>
<WebComponents::AuModal @size={{if (await this.currentSession.latestAgenda.isDesignAgenda) "large" "small"}}>
<WebComponents::AuModal::Header
@title={{t "agenda-close"}}
@closeModal={{action "cancelCloseMeeting"}}
Expand Down Expand Up @@ -511,7 +502,7 @@
{{/if}}

{{#if this.showConfirmForDeletingSelectedAgenda}}
<WebComponents::AuModal>
<WebComponents::AuModal @size={{if (eq this.agendas.length 1) "large" "small"}}>
<WebComponents::AuModal::Header
@title={{t "agenda-delete"}}
@closeModal={{action "cancelDeleteSelectedAgenda"}}
Expand All @@ -525,7 +516,7 @@
{{/if}}
<div>
{{t
"delete-design-agenda-close-meeting-message"
"delete-agenda-message"
agenda=this.currentSession.latestAgenda.agendaName
}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class AgendaOverviewItem extends Component {
@action
async startPublication() {
this.showLoader = true;
const _case = await this.args.agendaitem.get('case');
const _case = await this.subcase.get('case');
const newPublicationNumber = await this.publicationService.getNewPublicationNextNumber();
const newPublication = await this.publicationService.createNewPublication(newPublicationNumber, _case.id);
this.showLoader = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { alias } from '@ember/object/computed';

export default class AgendaitemTitles extends Component {
classNames = ['auk-u-mb-8']; // @brenner-company: since this is a glimmer component, this can be removed?

@alias('args.agendaitem.agendaActivity.subcase') subcase;

@tracked showLoader = false;

@service currentSession;
Expand All @@ -22,8 +25,9 @@ export default class AgendaitemTitles extends Component {
@action
async startPublication() {
this.showLoader = true;
const _case = await this.args.agendaitem.get('case');
const newPublication = await this.publicationService.createNewPublication(0, _case.id);
const _case = await this.subcase.get('case');
const newPublicationNumber = await this.publicationService.getNewPublicationNextNumber();
const newPublication = await this.publicationService.createNewPublication(newPublicationNumber, _case.id);
this.showLoader = false;
this.router.transitionTo('publications.publication.case', newPublication.id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export default class AbbreviatedText extends Component {

// Should show ellipsis?
get textTooLong() {
return this.text().length > this.getMaxSize();
if (this.text()) {
return this.text().length > this.getMaxSize();
}
return false;
}

// Abbreviated version of title.
Expand Down
28 changes: 14 additions & 14 deletions app/pods/publications/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ export default class PublicationsController extends Controller {

@action
async search() {
const filter = {};
const filter = {
':has:publicationFlowNumber': 1,
};
if (this.searchText.length === 0 || this.searchText === '') {
filter[':sqs:title'] = '*'; // search without filter
this.showSearchResults = false;
} else {
this.textSearchFields = ['title', 'publicationFlowNumber', 'publicationFlowRemark', 'shortTitle', 'subcaseTitle'];
const searchModifier = ':sqs:';
this.textSearchFields = ['title', 'publicationFlowNumber', 'publicationFlowRemark', 'shortTitle', 'subcaseTitle', 'subcaseSubTitle', 'publicationFlowNumacNumbers', 'publicationFlowId'];
const searchModifier = ':phrase_prefix:';
const textSearchKey = this.textSearchFields.join(',');
filter[`${searchModifier}${textSearchKey}`] = this.searchText;
filter[`${searchModifier}${textSearchKey}`] = `${this.searchText}*`;
this.showSearchResults = true;
}

this.searchResults = await search('cases', 0, 10, null, filter, (item) => {
const entry = item.attributes;
entry.id = item.id;
return entry;
});
if (this.searchResults.length === 0) {
this.searchResults = false;
this.searchResults = await search('cases', 0, 10, null, filter, (item) => {
const entry = item.attributes;
entry.id = item.id;
return entry;
});
if (this.searchResults.length === 0) {
this.searchResults = false;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/pods/publications/publication/documents/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
Offering this as an option should be very restrictive --}}
{{#if (not (gt (await piece.agendaitems.length) 0))}}
<WebComponents::AuDropdown::Item {{on "click" (fn this.editExistingPiece piece)}}>
{{t "document-edit"}}
{{t "edit"}}
</WebComponents::AuDropdown::Item>
{{/if}}
{{#if (not (gt (await piece.agendaitems.length) 0))}}
Expand Down
Loading

0 comments on commit f723356

Please sign in to comment.