Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synchronize Course/Session objective description/parentObjectives FadeText status #8215

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7f4b9d2
course objective row description/parentObjectives FadeText expansion …
michaelchadwick Nov 6, 2024
5d55654
session objective row description/parentObjectives FadeText expansion…
michaelchadwick Nov 6, 2024
8b363c6
remove FadeText textWidthRounded() getter as it is not used
michaelchadwick Nov 6, 2024
68bc676
ObjectiveSortManager component works again; fixed icon style on non-e…
michaelchadwick Nov 6, 2024
7dd08fa
fixed objectives line-height for non-editors
michaelchadwick Nov 6, 2024
874ac42
fixed tests
michaelchadwick Nov 7, 2024
ad1c2fb
removed unnecessary getter
michaelchadwick Nov 7, 2024
f0e7610
added needed assert.expect() calls to because of nested assert.strict…
michaelchadwick Nov 7, 2024
6d99d67
fixed bug where description would not expand when editing a parentObj…
michaelchadwick Nov 7, 2024
d6c5aa9
fixed inconsistent course description expansion icon style
michaelchadwick Nov 7, 2024
5a3efb6
sort manager course descriptions' draggable icon and text display imp…
michaelchadwick Nov 7, 2024
ae0e552
fixed Session version of Course issues
michaelchadwick Nov 7, 2024
3221952
improved tests
michaelchadwick Nov 8, 2024
0455fc0
Session Objectives now display multiple items
michaelchadwick Nov 25, 2024
6fe88ff
fix session parentObjectives p element display to remove extra margin
michaelchadwick Nov 25, 2024
2dcd33a
fixed button style bug
michaelchadwick Nov 25, 2024
b7ad34a
refactor FadeText main flag name to be better descriptive of usage
michaelchadwick Nov 25, 2024
2939ded
Course Parent Objectives now handle multiple items like Sessions
michaelchadwick Nov 25, 2024
43aadb1
fixed p element margin in sort manager item display
michaelchadwick Nov 25, 2024
a8254ce
non-faded FadeText items no longer get a collapse arrow icon when a r…
michaelchadwick Nov 25, 2024
f74df13
fixed ProgramYear objective list item expansion bug
michaelchadwick Nov 25, 2024
9cc05fc
fixed session objective list item rows so optional classes display in…
michaelchadwick Nov 26, 2024
63e33ea
template markup refactor
michaelchadwick Nov 26, 2024
209e78c
fixed objective display bug for read-only users
michaelchadwick Nov 26, 2024
1655e8d
course/session objs now output as <ul> again
michaelchadwick Nov 26, 2024
a578986
fixed a11y issue with how multiple parent objs were being combined
michaelchadwick Nov 26, 2024
0002983
fixed tests
michaelchadwick Nov 26, 2024
04e0996
add max-height to grid-item elements that have faded text descendants
michaelchadwick Dec 3, 2024
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 @@ -27,6 +27,8 @@
@isSaveDisabled={{this.hasErrorForTitle}}
@save={{perform this.saveTitleChanges}}
@close={{this.revertTitleChanges}}
@fadeTextExpanded={{this.fadeTextExpanded}}
@onExpandAllFadeText={{this.expandAllFadeText}}
>
<HtmlEditor @content={{this.title}} @update={{this.changeTitle}} @autofocus={{true}} />
<ValidationError @validatable={{this}} @property="title" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class ProgramYearObjectiveListItemComponent extends Component {
@tracked isManagingTerms;
@tracked termsBuffer = [];
@tracked selectedVocabulary;
@tracked fadeTextExpanded = false;

constructor() {
super(...arguments);
Expand Down Expand Up @@ -155,6 +156,10 @@ export default class ProgramYearObjectiveListItemComponent extends Component {
this.highlightSave.perform();
});

@action
expandAllFadeText(isExpanded) {
this.fadeTextExpanded = isExpanded;
}
@action
revertTitleChanges() {
this.title = this.args.programYearObjective.title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module('Acceptance | Course - Competencies', function (hooks) {
details: true,
courseObjectiveDetails: true,
});
await page.details.objectives.objectiveList.objectives[1].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[1].parents.manage();
const m = page.details.objectives.objectiveList.objectives[1].parentManager;
await m.competencies[1].objectives[0].add();
assert.ok(m.competencies[0].objectives[0].notSelected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { setupApplicationTest } from 'frontend/tests/helpers';
import page from 'ilios-common/page-objects/course';
import percySnapshot from '@percy/ember';

module('Acceptance | Course - Multiple Objective Parents', function (hooks) {
module('Acceptance | Course - Multiple Objective Parents', function (hooks) {
setupApplicationTest(hooks);
hooks.beforeEach(async function () {
this.user = await setupAuthentication({}, true);
Expand Down Expand Up @@ -65,7 +65,7 @@ module('Acceptance | Course - Multiple Objective Parents', function (hooks) {
'program-year objective 1',
);

await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
const m = page.details.objectives.objectiveList.objectives[0].parentManager;

assert.strictEqual(m.selectedCohortTitle, 'program 0 cohort 0');
Expand All @@ -92,7 +92,7 @@ module('Acceptance | Course - Multiple Objective Parents', function (hooks) {
page.details.objectives.objectiveList.objectives[0].description.text,
'course objective 0',
);
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
const m = page.details.objectives.objectiveList.objectives[0].parentManager;

await m.competencies[0].objectives[2].add();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module('Acceptance | Course - Objective Inactive Parents', function (hooks) {
assert.strictEqual(objectives[0].parents.list.length, 1);
assert.strictEqual(objectives[0].parents.list[0].text, 'inactive selected');

await objectives[0].parents.list[0].manage();
await objectives[0].parents.manage();
const m = objectives[0].parentManager;

assert.strictEqual(m.selectedCohortTitle, 'program 0 cohort 0');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module('Acceptance | Course with multiple Cohorts - Objective Parents', function
page.details.objectives.objectiveList.objectives[0].parents.list[1].text,
'program-year objective 3',
);
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
const m = page.details.objectives.objectiveList.objectives[0].parentManager;

await m.selectCohort(1);
Expand Down Expand Up @@ -135,7 +135,7 @@ module('Acceptance | Course with multiple Cohorts - Objective Parents', function
page.details.objectives.objectiveList.objectives[0].parents.list[1].text,
'program-year objective 3',
);
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
const m = page.details.objectives.objectiveList.objectives[0].parentManager;

await m.selectCohort(1);
Expand Down Expand Up @@ -185,7 +185,7 @@ module('Acceptance | Course with multiple Cohorts - Objective Parents', function
page.details.objectives.objectiveList.objectives[0].parents.list[1].text,
'program-year objective 3',
);
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
const m = page.details.objectives.objectiveList.objectives[0].parentManager;

await m.selectCohort(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module('Acceptance | Course with no cohorts - Objective Parents', function (hook

assert.strictEqual(firstObjective.description.text, 'course objective 0');
assert.ok(firstObjective.parents.empty);
await firstObjective.parents.list[0].manage();
await firstObjective.parents.manage();
const m = firstObjective.parentManager;

assert.ok(m.hasNoCohortWarning);
Expand All @@ -50,7 +50,7 @@ module('Acceptance | Course with no cohorts - Objective Parents', function (hook
await page.details.cohorts.selectable[0].add();
await page.details.cohorts.save();
assert.strictEqual(page.details.cohorts.current.length, 1);
await firstObjective.parents.list[0].manage();
await firstObjective.parents.manage();

assert.strictEqual(m.selectedCohortTitle, 'program 0 cohort 0');
assert.strictEqual(m.competencies.length, 1);
Expand All @@ -64,7 +64,7 @@ module('Acceptance | Course with no cohorts - Objective Parents', function (hook
await page.details.cohorts.selected[0].remove();
await page.details.cohorts.save();
assert.strictEqual(page.details.cohorts.current.length, 0);
await firstObjective.parents.list[0].manage();
await firstObjective.parents.manage();
assert.ok(m.hasNoCohortWarning);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module('Acceptance | Course - Objective Parents', function (hooks) {
'program-year objective 0',
);

await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
const m = page.details.objectives.objectiveList.objectives[0].parentManager;

assert.strictEqual(m.selectedCohortTitle, 'program 0 cohort 0');
Expand Down Expand Up @@ -108,7 +108,7 @@ module('Acceptance | Course - Objective Parents', function (hooks) {
);

await percySnapshot(getUniqueName(assert, 'default background color'));
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
await percySnapshot(getUniqueName(assert, 'default background color'));

const m = page.details.objectives.objectiveList.objectives[0].parentManager;
Expand Down Expand Up @@ -152,7 +152,7 @@ module('Acceptance | Course - Objective Parents', function (hooks) {
);

await percySnapshot(getUniqueName(assert, 'default background color'));
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
await percySnapshot(getUniqueName(assert, 'managed background color'));

const m = page.details.objectives.objectiveList.objectives[0].parentManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module('Acceptance | Course - Publish All Sessions', function (hooks) {
assert.ok(page.publishAll.isVisible);
assert.ok(page.publishAll.hasUnlinkedWarning);

await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
const m = page.details.objectives.objectiveList.objectives[0].parentManager;
await m.competencies[0].objectives[0].add();
await page.details.objectives.objectiveList.objectives[0].parents.save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module('Acceptance | Session - Objective Parents', function (hooks) {
);

await percySnapshot(getUniqueName(assert, 'default background color'));
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
await percySnapshot(getUniqueName(assert, 'managed background color'));

const m = page.details.objectives.objectiveList.objectives[0].parentManager;
Expand Down Expand Up @@ -90,7 +90,7 @@ module('Acceptance | Session - Objective Parents', function (hooks) {
);

await percySnapshot(getUniqueName(assert, 'default background color'));
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
await percySnapshot(getUniqueName(assert, 'managed background color'));

const m = page.details.objectives.objectiveList.objectives[0].parentManager;
Expand Down Expand Up @@ -142,7 +142,7 @@ module('Acceptance | Session - Objective Parents', function (hooks) {
);

await percySnapshot(getUniqueName(assert, 'default background color'));
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
await percySnapshot(getUniqueName(assert, 'managed background color'));

const m = page.details.objectives.objectiveList.objectives[0].parentManager;
Expand Down Expand Up @@ -194,7 +194,7 @@ module('Acceptance | Session - Objective Parents', function (hooks) {
);

await percySnapshot(getUniqueName(assert, 'default background color'));
await page.details.objectives.objectiveList.objectives[0].parents.list[0].manage();
await page.details.objectives.objectiveList.objectives[0].parents.manage();
await percySnapshot(getUniqueName(assert, 'managed background color'));

const m = page.details.objectives.objectiveList.objectives[0].parentManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { clickable, create, collection, isHidden, isPresent } from 'ember-cli-pa

const definition = {
scope: '[data-test-objective-list-item-parents]',
list: collection('li', {
manage: clickable('[data-test-manage]'),
}),
list: collection('li'),
manage: clickable('[data-test-manage]'),
empty: isHidden('[data-test-parent]'),
saveParents: clickable('[data-test-save]'),
cancelParents: clickable('[data-test-cancel]'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { clickable, create, collection, isHidden, isPresent } from 'ember-cli-pa

const definition = {
scope: '[data-test-objective-list-item-parents]',
list: collection('li', {
manage: clickable('[data-test-manage]'),
}),
list: collection('li'),
manage: clickable('[data-test-manage]'),
empty: isHidden('[data-test-parent]'),
saveParents: clickable('[data-test-save]'),
cancelParents: clickable('[data-test-cancel]'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,86 +24,80 @@
<FaIcon @icon="arrow-rotate-left" />
</button>
{{else}}
<ul>
{{#each (sort-by "title" @parents) as |parent|}}
{{#if @parents}}
<FadeText
@text={{this.parents}}
@expanded={{@fadeTextExpanded}}
@onExpandAll={{@onExpandAllFadeText}}
as |displayText expand collapse updateTextDims shouldFade expanded|
>
{{#if @editable}}
<li data-test-parent>
<FadeText
@text={{html-safe (remove-html-tags parent.title)}}
as |displayText expand collapse updateTextDims isFaded expanded|
>
<button
type="button"
class="link-button"
{{on "click" @manage}}
data-test-manage
>
<div class="display-text-wrapper{{if isFaded ' is-faded'}}">
<div
class="display-text"
{{on-resize updateTextDims}}
>
{{displayText}}
</div>
</div>
{{#if @showIcon}}
<FaIcon
data-test-edit-icon
@icon="pen-to-square"
class="enabled"
/>
{{/if}}
</button>
{{#if isFaded}}
<div
class="fade-text-control"
data-test-fade-text-control
{{! template-lint-disable no-invalid-interactive}}
{{on "click" @manage}}
>
<button
class="expand-text-button"
type="button"
aria-label={{t "general.expand"}}
title={{t "general.expand"}}
data-test-expand
{{on "click" expand}}
>
<FaIcon @icon="angles-down" />
</button>
<span data-test-parent>
<button type="button" class="link-button" {{on "click" @manage}} data-test-manage>
<div class="display-text-wrapper{{if shouldFade ' faded'}}">
<div class="display-text" {{on-resize updateTextDims}}>
{{displayText}}
</div>
{{else}}
{{#if expanded}}
<button
class="expand-text-button"
aria-label={{t "general.collapse"}}
title={{t "general.collapse"}}
type="button"
data-test-collapse
{{on "click" collapse}}
>
<FaIcon @icon="angles-up" />
</button>
{{/if}}
</div>
{{#if @showIcon}}
<FaIcon
data-test-edit-icon
@icon="pen-to-square"
class="enabled"
/>
{{/if}}
</FadeText>
</li>
</button>
</span>
{{else}}
<li data-test-parent>
<FadeText @text={{html-safe (remove-html-tags parent.title)}} />
</li>
<span data-test-parent>
<div class="display-text-wrapper{{if shouldFade ' faded'}}">
<div class="display-text" {{on-resize updateTextDims}}>
{{displayText}}
</div>
</div>
</span>
{{/if}}
{{else}}
<li>
{{#if @editable}}
<button type="button" {{on "click" @manage}} data-test-manage>
{{t "general.addNew"}}
{{#if shouldFade}}
<div
class="fade-text-control"
data-test-fade-text-control
{{! template-lint-disable no-invalid-interactive}}
{{on "click" @manage}}
>
<button
class="expand-text-button"
type="button"
aria-label={{t "general.expand"}}
title={{t "general.expand"}}
data-test-expand
{{on "click" expand}}
>
<FaIcon @icon="angles-down" />
</button>
</div>
{{else}}
{{#if expanded}}
<button
class="expand-text-button"
aria-label={{t "general.collapse"}}
title={{t "general.collapse"}}
type="button"
data-test-collapse
{{on "click" collapse}}
>
<FaIcon @icon="angles-up" />
</button>
{{else}}
{{t "general.none"}}
{{/if}}
</li>
{{/each}}
</ul>
{{/if}}
</FadeText>
{{else}}
{{#if @editable}}
<button type="button" {{on "click" @manage}} data-test-manage>
{{t "general.addNew"}}
</button>
{{else}}
{{t "general.none"}}
{{/if}}
{{/if}}
{{/if}}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Component from '@glimmer/component';
import sortableByPosition from 'ilios-common/utils/sortable-by-position';

export default class CourseObjectiveListItemParentsComponent extends Component {
get parents() {
return this.args.parents
.slice()
.sort(sortableByPosition)
.map((t) => t.title);
}
}
Loading
Loading