Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ const definition = {
title: text('> [data-test-title]'),
publishAllAsIs: {
scope: '[data-test-publish-all-as-is]',
isDisabled: property('disabled'),
isChecked: property('checked'),
},
markAllAsScheduled: {
scope: '[data-test-mark-all-as-scheduled]',
isDisabled: property('disabled'),
isChecked: property('checked'),
},
table: {
scope: 'table',
Expand Down
104 changes: 64 additions & 40 deletions packages/ilios-common/addon/components/publish-all-sessions.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default class PublishAllSessionsComponent extends Component {

@tracked totalSessionsToSave;
@tracked currentSessionsSaved;
@tracked bulkSelectedAction = '';

@tracked userSelectedSessionsToPublish = [];
@tracked userSelectedSessionsToSchedule = [];
Expand Down Expand Up @@ -75,6 +76,14 @@ export default class PublishAllSessionsComponent extends Component {
);
}

get sessionsToAllBePublished() {
return !this.sessionsToSchedule?.length;
}

get sessionsToAllBeScheduled() {
return !this.sessionsToPublish?.length;
}

get allSessionsScheduled() {
return this.sessionsToSchedule.length === this.overridableSessions.length;
}
Expand Down Expand Up @@ -239,18 +248,22 @@ export default class PublishAllSessionsComponent extends Component {
);
this.userSelectedSessionsToPublish = [...this.userSelectedSessionsToPublish, session];
}

this.bulkSelectedAction = '';
}

@action
publishAllAsIs() {
this.userSelectedSessionsToSchedule = [];
this.userSelectedSessionsToPublish = [...this.overridableSessions];
this.bulkSelectedAction = 'publishAllAsIs';
}

@action
scheduleAll() {
this.userSelectedSessionsToPublish = [];
this.userSelectedSessionsToSchedule = [...this.overridableSessions];
this.bulkSelectedAction = 'scheduleAll';
}

@action
Expand Down Expand Up @@ -561,22 +574,35 @@ export default class PublishAllSessionsComponent extends Component {
</div>
<div class="content">
{{#if this.overridableSessions.length}}
<button
type="button"
disabled={{this.allSessionsPublished}}
{{on "click" this.publishAllAsIs}}
data-test-publish-all-as-is
>
{{t "general.publishAsIs"}}
</button>
<button
type="button"
disabled={{this.allSessionsScheduled}}
{{on "click" this.scheduleAll}}
data-test-mark-all-as-scheduled
>
{{t "general.markAsScheduled"}}
</button>
<fieldset data-test-bulk-selection-actions>
<label class="publish-all-as-is">
<input
type="radio"
name="bulk-selection-action"
checked={{or
(eq this.bulkSelectedAction "publishAllAsIs")
this.sessionsToAllBePublished
}}
{{on "click" this.publishAllAsIs}}
data-test-publish-all-as-is
/>
{{t "general.publishAllAsIs"}}
</label>
<label class="mark-all-as-scheduled">
<input
type="radio"
name="bulk-selection-action"
checked={{or
(eq this.bulkSelectedAction "scheduleAll")
this.sessionsToAllBeScheduled
}}
{{on "click" this.scheduleAll}}
data-test-mark-all-as-scheduled
/>
{{t "general.markAllAsScheduled"}}
</label>
</fieldset>

<table class="ilios-table ilios-table-colors sticky-header">
<thead>
<tr>
Expand Down Expand Up @@ -633,30 +659,28 @@ export default class PublishAllSessionsComponent extends Component {
{{#each this.orderedOverridableSessions as |session|}}
<tr>
<td>
<ul>
<li>
<label>
<input
type="checkbox"
checked={{includes session.id (mapBy "id" this.sessionsToPublish)}}
{{on "click" (fn this.toggleSession session)}}
data-test-publish-as-is
/>
{{t "general.publishAsIs"}}
</label>
</li>
<li>
<label>
<input
type="checkbox"
checked={{includes session.id (mapBy "id" this.sessionsToSchedule)}}
{{on "click" (fn this.toggleSession session)}}
data-test-mark-as-scheduled
/>
{{t "general.markAsScheduled"}}
</label>
</li>
</ul>
<fieldset data-test-session-action>
<label>
<input
type="radio"
name="session-action{{session.id}}"
checked={{includes session.id (mapBy "id" this.sessionsToPublish)}}
{{on "click" (fn this.toggleSession session)}}
data-test-publish-as-is
/>
{{t "general.publishAsIs"}}
</label>
<label>
<input
type="radio"
name="session-action{{session.id}}"
checked={{includes session.id (mapBy "id" this.sessionsToSchedule)}}
{{on "click" (fn this.toggleSession session)}}
data-test-mark-as-scheduled
/>
{{t "general.markAsScheduled"}}
</label>
</fieldset>
</td>
<td colspan="2" data-test-title>
<LinkTo @route="session" @model={{session}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@
td {
vertical-align: top;

@include m.for-tablet-and-up {
padding-right: 0.5em;
fieldset {
border: none;
padding: 0;

label {
display: block;
padding-bottom: 0.5em;
}
}
}
}
Expand All @@ -65,10 +71,13 @@
border-bottom: none;
padding-bottom: 0;

ul {
list-style-type: none;
margin: 0;
fieldset {
border: none;
padding: 0;

label {
padding-right: 0.5em;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/ilios-common/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ general:
makeRecurring: Make Recurring
manageLeadership: Manage Leadership
manageLearners: Manage Learners
markAllAsScheduled: Mark All as Scheduled
markAsScheduled: Mark as Scheduled
markedAccessible: Accessible
materials: Materials
Expand Down Expand Up @@ -286,6 +287,7 @@ general:
publicationReview: Publication Review
publicationStatus: Publication Status
publishAllConfirmation: "Publish {publishCount}, schedule {scheduleCount}, and ignore {ignoreCount} sessions"
publishAllAsIs: Publish All As-is
publishAsIs: Publish As-is
publishCourse: Publish Course
published: Published
Expand Down
2 changes: 2 additions & 0 deletions packages/ilios-common/translations/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ general:
makeRecurring: Hacer Recurrente
manageLeadership: Maneje el Liderazgo
manageLearners: Administrar Aprendedores
markAllAsScheduled: Marque Todo Como Programado
markAsScheduled: Marque Como Programado
markedAccessible: Accesible
materials: Materiales
Expand Down Expand Up @@ -286,6 +287,7 @@ general:
publicationReview: Revisión de Publicación
publicationStatus: Estado de Publicación
publishAllConfirmation: "Publique {publishCount}, Programe {scheduleCount}, y ignore {ignoreCount} sesiónes"
publishAllAsIs: Publique Todo Como Es
publishAsIs: Publique Como Es
publishCourse: Publique Curso
published: Publicado
Expand Down
2 changes: 2 additions & 0 deletions packages/ilios-common/translations/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ general:
makeRecurring: Activité Récurrente
manageLeadership: Gérer Dirigeants
manageLearners: Manager Étudiants
markAllAsScheduled: Faire tout à prévu
markAsScheduled: Faire à prévu
markedAccessible: Accessible
materials: Matériels
Expand Down Expand Up @@ -286,6 +287,7 @@ general:
publicationReview: Revue de Publication
publicationStatus: Statut de Publication
publishAllConfirmation: "Publier {publishCount}, réserver {scheduleCount}, et ignorer des {ignoreCount} séances"
publishAllAsIs: 'Publier tout "as-is"'
publishAsIs: 'Publier "as-is"'
publishCourse: Publier Cours
published: Publié
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,73 @@ module('Integration | Component | publish all sessions', function (hooks) {
'Publish 1, schedule 2, and ignore 1 sessions',
);
});

test('publish/schedule individual sessions', async function (assert) {
this.set('course', this.course);

await render(
<template>
<PublishAllSessions
@course={{this.course}}
@setExpandCompleteSessions={{(noop)}}
@setExpandIncompleteSessions={{(noop)}}
@sortIncompleteBy={{this.sortColumn}}
@setSortIncompleteBy={{(noop)}}
@sortCompleteBy={{this.sortColumn}}
@setSortCompleteBy={{(noop)}}
@sortUnpublishedBy={{this.sortColumn}}
@setSortUnpublishedBy={{(noop)}}
/>
</template>,
);
assert.strictEqual(
component.review.confirmation,
'Publish 2, schedule 1, and ignore 1 sessions',
);
assert.strictEqual(component.overridableSessions.title, 'Unpublished Sessions: for review (2)');
assert.ok(component.overridableSessions.markAllAsScheduled.isVisible);
assert.ok(component.overridableSessions.publishAllAsIs.isVisible);
const { sessions: list } = component.overridableSessions;

assert.strictEqual(list.length, 2);
assert.notOk(component.overridableSessions.publishAllAsIs.isChecked);
assert.notOk(component.overridableSessions.markAllAsScheduled.isChecked);
assert.notOk(list[0].publishAsIs.isChecked);
assert.ok(list[0].markAsScheduled.isChecked);
assert.ok(list[1].publishAsIs.isChecked);
assert.notOk(list[1].markAsScheduled.isChecked);
await component.overridableSessions.publishAllAsIs.click();
assert.ok(component.overridableSessions.publishAllAsIs.isChecked);
assert.notOk(component.overridableSessions.markAllAsScheduled.isChecked);
assert.ok(list[0].publishAsIs.isChecked);
assert.notOk(list[0].markAsScheduled.isChecked);
assert.ok(list[1].publishAsIs.isChecked);
assert.notOk(list[1].markAsScheduled.isChecked);
await list[0].markAsScheduled.click();
assert.notOk(component.overridableSessions.publishAllAsIs.isChecked);
assert.notOk(component.overridableSessions.markAllAsScheduled.isChecked);
assert.notOk(list[0].publishAsIs.isChecked);
assert.ok(list[0].markAsScheduled.isChecked);
assert.ok(list[1].publishAsIs.isChecked);
assert.notOk(list[1].markAsScheduled.isChecked);
await list[1].markAsScheduled.click();
assert.notOk(component.overridableSessions.publishAllAsIs.isChecked);
assert.ok(component.overridableSessions.markAllAsScheduled.isChecked);
assert.notOk(list[0].publishAsIs.isChecked);
assert.ok(list[0].markAsScheduled.isChecked);
assert.notOk(list[1].publishAsIs.isChecked);
assert.ok(list[1].markAsScheduled.isChecked);
await component.overridableSessions.publishAllAsIs.click();
assert.ok(component.overridableSessions.publishAllAsIs.isChecked);
assert.notOk(component.overridableSessions.markAllAsScheduled.isChecked);
assert.ok(list[0].publishAsIs.isChecked);
assert.notOk(list[0].markAsScheduled.isChecked);
assert.ok(list[1].publishAsIs.isChecked);
assert.notOk(list[1].markAsScheduled.isChecked);

assert.strictEqual(
component.review.confirmation,
'Publish 3, schedule 0, and ignore 1 sessions',
);
});
});