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

fix visual layer display bug when editing session offering #7915

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
3 changes: 3 additions & 0 deletions packages/ilios-common/addon/components/course-sessions.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
(gt this.sessionsWithOfferings.length 0)
}}
@toggleExpandAll={{this.toggleExpandAll}}
@headerIsLocked={{this.tableHeadersLocked}}
/>
{{#if this.sessions}}
<SessionsGrid
Expand All @@ -72,6 +73,8 @@
@expandedSessionIds={{this.expandedSessionIds}}
@closeSession={{perform this.closeSession}}
@expandSession={{perform this.expandSession}}
@headerIsLocked={{this.tableHeadersLocked}}
@setHeaderLockedStatus={{this.setHeaderLockedStatus}}
/>
{{else}}
<SessionsGridLoading @count={{this.sessionsCount}} />
Expand Down
7 changes: 7 additions & 0 deletions packages/ilios-common/addon/components/course-sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export default class CourseSessionsComponent extends Component {
@tracked filterByLocalCache = [];
@tracked showNewSessionForm = false;

@tracked tableHeadersLocked = true;

@action
setHeaderLockedStatus(isEditing) {
this.tableHeadersLocked = !isEditing;
}

@cached
get loadedCourseSessionsData() {
return new TrackedAsyncData(this.dataLoader.loadCourseSessions(this.args.course.id));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="sessions-grid-header" data-test-sessions-grid-header>
<div class="sessions-grid-header{{if @headerIsLocked " locked"}}" data-test-sessions-grid-header>
<span class="expand-collapse-control" data-test-expand-collapse-all>
{{#if @showExpandAll}}
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
@startTime={{format-date @offeringTimeBlock.startDate hour="2-digit" minute="2-digit"}}
@durationHours={{@offeringTimeBlock.durationHours}}
@durationMinutes={{@offeringTimeBlock.durationMinutes}}
@setHeaderLockedStatus={{@setHeaderLockedStatus}}
/>
{{/each}}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<table class="sessions-grid-offering-table" data-test-sessions-grid-offering-table>
<thead>
<thead class={{if @headerIsLocked 'locked'}}>
<tr>
<th colspan="2">
{{t "general.when"}}
Expand Down Expand Up @@ -43,6 +43,7 @@
<SessionsGridOfferingTableOfferings
@offeringTimeBlock={{offeringTimeBlock}}
@canUpdate={{this.canUpdate}}
@setHeaderLockedStatus={{@setHeaderLockedStatus}}
/>
{{/each}}
{{/each}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
class="link-button"
data-test-edit
type="button"
{{on "click" (set this.isEditing (not this.isEditing))}}>
{{on "click" this.toggleEditing}}
>
<FaIcon
@icon="pencil"
@title={{t "general.edit"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default class SessionsGridOffering extends Component {
@action
close() {
this.isEditing = false;
this.args.setHeaderLockedStatus(this.isEditing);
scrollIntoView(this.row);
}

Expand Down Expand Up @@ -97,6 +98,7 @@ export default class SessionsGridOffering extends Component {
instructorGroups,
instructors,
});
this.toggleEditing();
await this.args.offering.save();
this.updateUi.perform();
},
Expand All @@ -109,4 +111,9 @@ export default class SessionsGridOffering extends Component {
await timeout(4000);
this.wasUpdated = false;
});

toggleEditing = () => {
this.isEditing = !this.isEditing;
this.args.setHeaderLockedStatus(this.isEditing);
};
}
2 changes: 2 additions & 0 deletions packages/ilios-common/addon/components/sessions-grid.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<SessionsGridLastUpdated @session={{session}} />
<SessionsGridOfferingTable
@session={{session}}
@headerIsLocked={{@headerIsLocked}}
@setHeaderLockedStatus={{@setHeaderLockedStatus}}
/>
{{/if}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
color: c.$white;
@include m.font-size("small");
font-weight: normal;
position: sticky;
top: 0;
z-index: 1;

&.locked {
position: sticky;
}

.sortable-heading {
padding: 0.5rem 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

thead {
color: c.$white;
position: sticky;
top: 2rem;

&.locked {
position: sticky;
}

th {
@include m.font-size("small");
font-weight: normal;
Expand Down