From 222704a59befa87985bfca6ed84a84247ba81430 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 21 Nov 2022 16:18:56 +0100 Subject: [PATCH] MOBILE-4176 grades: Apply bold styles --- src/core/features/grades/pages/course/course.scss | 4 ++++ src/core/features/grades/services/grades-helper.ts | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/core/features/grades/pages/course/course.scss b/src/core/features/grades/pages/course/course.scss index 096eb096d..870b68b36 100644 --- a/src/core/features/grades/pages/course/course.scss +++ b/src/core/features/grades/pages/course/course.scss @@ -64,6 +64,10 @@ font-weight: normal; } + tbody tr.core-bold th { + font-weight: inherit; + } + tbody #gradeitem { @include padding(null, null, null, 4px); } diff --git a/src/core/features/grades/services/grades-helper.ts b/src/core/features/grades/services/grades-helper.ts index 720ae5c45..77b5f52ba 100644 --- a/src/core/features/grades/services/grades-helper.ts +++ b/src/core/features/grades/services/grades-helper.ts @@ -110,7 +110,7 @@ export class CoreGradesHelperProvider { rowspan: tableRow.leader?.rowspan, }; - this.setRowEvenOddClass(row, (tableRow.leader as CoreGradesTableLeaderColumn).class); + this.setRowStyleClasses(row, (tableRow.leader as CoreGradesTableLeaderColumn).class); return row; } @@ -132,7 +132,7 @@ export class CoreGradesHelperProvider { row.rowspan = tableRow.leader?.rowspan || 1; this.setRowIconAndType(row, content); - this.setRowEvenOddClass(row, itemNameColumn.class); + this.setRowStyleClasses(row, itemNameColumn.class); row.rowclass += itemNameColumn.class.indexOf('hidden') >= 0 ? ' hidden' : ''; row.rowclass += itemNameColumn.class.indexOf('dimmed_text') >= 0 ? ' dimmed_text' : ''; @@ -625,15 +625,19 @@ export class CoreGradesHelperProvider { } /** - * Set 'odd' or 'even' classes into a row. + * Set row style classes. * * @param row Row. - * @param classes Existing row classes. + * @param classes Unformatted classes. */ - protected setRowEvenOddClass(row: CoreGradesFormattedTableRow, classes: string): void { + protected setRowStyleClasses(row: CoreGradesFormattedTableRow, classes: string): void { const level = parseInt(classes.match(/(?:^|\s)level(\d+)(?:$|\s)/)?.[1] ?? '0'); row.rowclass = `${row.rowclass ?? ''} ${level % 2 === 0 ? 'even' : 'odd'}`.trim(); + + if (classes.match(/(^|\s)(category|bagg(b|t))($|\s)/)) { + row.rowclass += ' core-bold'; + } } /**