Skip to content

Commit

Permalink
Add various fixes for students lists #712 #713
Browse files Browse the repository at this point in the history
- Display & sort by lastname, firstname
- Remove heading margin
- Adjust margin after header
- Use ';' as emails separator in mailto link
- Show companies on class list as well
- Rename search placeholder
- Invert study course list sort arrow
- Visit dossier addresses instead of absences tab
- Switch presence control grid from breakpoints to CSS grid
  • Loading branch information
hupf committed Dec 16, 2024
1 parent b3a452e commit 5d356d9
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
></bkd-avatar>
<a
class="name"
[title]="name()"
[title]="entry().name"
[routerLink]="link()"
[queryParams]="linkParams()"
>{{ name() }}</a
>{{ entry().name }}</a
>
<div class="study-class">
{{ multipleStudyClasses() ? entry().studyClass : "" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ describe("EventsStudentsCourseEntryComponent", () => {

fixture.componentRef.setInput("entry", {
id: 1,
firstName: "Jane",
lastName: "Doe",
name: "Doe Jane",
email: "[email protected]",
studyClass: "26a",
company: "Coop Genossenschaft",
Expand All @@ -31,9 +30,9 @@ describe("EventsStudentsCourseEntryComponent", () => {

it("renders firstname/lastname with link to dossier including returnlink", () => {
const link = element.querySelector<HTMLAnchorElement>("a.name");
expect(link?.textContent).toContain("Jane Doe");
expect(link?.textContent).toContain("Doe Jane");
expect(link?.href).toContain(
"student/1/absences?returnparams=returnlink%3D%252Fevents%252Fcurrent",
"student/1/addresses?returnparams=returnlink%3D%252Fevents%252Fcurrent",
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ export class EventsStudentsCourseEntryComponent {
multipleStudyClasses = input(false);
returnLink = input<Option<string>>(null);

name = computed<string>(
() => `${this.entry().firstName} ${this.entry().lastName}`,
);

link = computed<RouterLink["routerLink"]>(() => [
"student",
this.entry().id,
"absences",
"addresses",
]);
linkParams = computed<Params>(() => {
const returnlink = this.returnLink();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

section.list {
width: calc(100% + 1px); // Hide right border
margin-top: 2 * $spacer;
margin-top: 1 * $spacer;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h1>{{ title() }}</h1>
<bkd-resettable-input
class="search"
[value]="searchTerm()"
[placeholder]="'events-students.search-by-name' | translate"
[placeholder]="'events-students.search-placeholder' | translate"
[label]="'events-students.search' | translate"
(valueChange)="searchTerm.set($event)"
></bkd-resettable-input>
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@import "../../../../bootstrap-variables";

h1 {
margin-bottom: 0;
}

.search {
margin-top: $spacer;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,28 @@ describe("EventsStudentsListComponent", () => {
const entries: ReadonlyArray<StudentEntry> = [
{
id: 10,
firstName: "Paul",
lastName: "McCartney",
name: "McCartney Paul",
email: "[email protected]",
studyClass: "26a",
company: "Apple Records – Abbey Road Studios",
},
{
id: 20,
firstName: "John",
lastName: "Lennon",
name: "Lennon John",
email: "[email protected]",
studyClass: "26a",
company: undefined,
},
{
id: 30,
firstName: "George",
lastName: "Harrison",
name: "Harrison George",
email: "[email protected]",
studyClass: "26c",
company: undefined,
},
{
id: 40,
firstName: "Ringo",
lastName: "Starr",
name: "Starr Ringo",
email: "[email protected]",
studyClass: "26c",
company: undefined,
Expand Down Expand Up @@ -104,10 +100,10 @@ describe("EventsStudentsListComponent", () => {
element.querySelector("bkd-events-students-course-list"),
).not.toBeNull();
expect(element.querySelector("h1")?.textContent).toContain("English-S3");
expect(element.textContent).toContain("Paul McCartney");
expect(element.textContent).toContain("John Lennon");
expect(element.textContent).toContain("George Harrison");
expect(element.textContent).toContain("Ringo Starr");
expect(element.textContent).toContain("McCartney Paul");
expect(element.textContent).toContain("Lennon John");
expect(element.textContent).toContain("Harrison George");
expect(element.textContent).toContain("Starr Ringo");
});

it("renders placeholder if no entries are available", () => {
Expand All @@ -129,10 +125,10 @@ describe("EventsStudentsListComponent", () => {
element.querySelector("bkd-events-students-study-course-list"),
).not.toBeNull();
expect(element.querySelector("h1")?.textContent).toContain("English-S3");
expect(element.textContent).toContain("Paul McCartney");
expect(element.textContent).toContain("John Lennon");
expect(element.textContent).toContain("George Harrison");
expect(element.textContent).toContain("Ringo Starr");
expect(element.textContent).toContain("McCartney Paul");
expect(element.textContent).toContain("Lennon John");
expect(element.textContent).toContain("Harrison George");
expect(element.textContent).toContain("Starr Ringo");
});

it("renders placeholder if no entries are available", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a class="name" [routerLink]="link()" [queryParams]="linkParams()">{{
name()
entry().name
}}</a>
<div class="status">{{ entry().status }}</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ describe("EventsStudentsStudyCourseEntryComponent", () => {
element = fixture.debugElement.nativeElement;
fixture.componentRef.setInput("entry", {
id: 1,
firstName: "Jane",
lastName: "Doe",
name: "Doe Jane",
email: "[email protected]",
studyClasses: ["26a", "26c"],
company: "Coop Genossenschaft",
Expand All @@ -33,7 +32,7 @@ describe("EventsStudentsStudyCourseEntryComponent", () => {

it("renders firstname/lastname with link to dossier including returnlink", () => {
const link = element.querySelector<HTMLAnchorElement>("a.name");
expect(link?.textContent).toBe("Jane Doe");
expect(link?.textContent).toBe("Doe Jane");
expect(link?.href).toContain(
"student/1/absences?returnparams=returnlink%3D%252Fevents%252Fcurrent",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export class EventsStudentsStudyCourseEntryComponent {
entry = input.required<StudentEntry>();
returnLink = input<Option<string>>(null);

name = computed<string>(
() => `${this.entry().firstName} ${this.entry().lastName}`,
);
link = computed<RouterLink["routerLink"]>(() => [
"student",
this.entry().id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@
cursor: pointer;
display: flex;
align-items: center;
border-top: 1px solid $border-color;
border-bottom: 2px solid $border-color;
}

section.list {
margin-top: 2 * $spacer;
}

.name {
padding: $spacer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ export class EventsStudentsStudyCourseListComponent {
getSortDirectionCharacter(
sortCriteria: SortCriteria<PrimarySortKey>,
): string {
return sortCriteria.ascending ? "" : "";
return sortCriteria.ascending ? "" : "";
}
}
Loading

0 comments on commit 5d356d9

Please sign in to comment.