diff --git a/scripts/langindex.json b/scripts/langindex.json index af83bf1ca..6899fcdff 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1734,6 +1734,7 @@ "core.grades.calculatedgrade": "grades", "core.grades.category": "grades", "core.grades.contributiontocoursetotal": "grades", + "core.grades.fail": "grades", "core.grades.feedback": "grades", "core.grades.grade": "grades", "core.grades.gradeitem": "grades", @@ -1744,6 +1745,7 @@ "core.grades.nogradesreturned": "grades", "core.grades.nooutcome": "grades", "core.grades.outcome": "grades", + "core.grades.pass": "grades", "core.grades.percentage": "grades", "core.grades.range": "grades", "core.grades.rank": "grades", diff --git a/src/core/features/grades/lang.json b/src/core/features/grades/lang.json index 1084e7782..504a4ae34 100644 --- a/src/core/features/grades/lang.json +++ b/src/core/features/grades/lang.json @@ -6,6 +6,7 @@ "calculatedgrade": "Calculated grade", "category": "Category", "contributiontocoursetotal": "Contribution to course total", + "fail": "Fail", "feedback": "Feedback", "grade": "Grade", "gradeitem": "Grade item", @@ -16,6 +17,7 @@ "nogradesreturned": "No grades returned", "nooutcome": "No outcome", "outcome": "Outcome", + "pass": "Pass", "percentage": "Percentage", "range": "Range", "rank": "Rank", diff --git a/src/core/features/grades/pages/course/course.html b/src/core/features/grades/pages/course/course.html index 497f485a6..053b16cd1 100644 --- a/src/core/features/grades/pages/course/course.html +++ b/src/core/features/grades/pages/course/course.html @@ -49,8 +49,8 @@ - + + + + + diff --git a/src/core/features/grades/pages/course/course.scss b/src/core/features/grades/pages/course/course.scss index 9068aaba0..dec25329c 100644 --- a/src/core/features/grades/pages/course/course.scss +++ b/src/core/features/grades/pages/course/course.scss @@ -42,7 +42,7 @@ } th, td { - @include padding(10px, 10px, 10px, null); + @include padding(8px, 8px, 8px, null); vertical-align: top; white-space: normal; text-align: start; @@ -55,7 +55,7 @@ } thead #gradeitem { - @include padding(null, null, null, 23px); + @include padding(null, null, null, 24px); } tbody th { @@ -63,11 +63,11 @@ } tbody #gradeitem { - @include padding(null, null, null, 5px); + @include padding(null, null, null, 4px); } .core-grades-table-gradeitem { - @include padding(null, null, null, 5px); + @include padding(null, null, null, 4px); font-weight: bold; &.column-itemname { @@ -90,7 +90,7 @@ } span { - @include margin(null, null, null, 5px); + @include margin(null, null, null, 4px); } .expandable-status-icon { @@ -101,7 +101,7 @@ } .core-grades-table-feedback { - @include padding(null, null, null, 5px); + @include padding(null, null, null, 4px); .no-overflow { overflow: auto; @@ -109,6 +109,12 @@ } + .core-grades-table-grade { + ion-icon { + @include padding(null, 4px, null, null); + } + } + .dimmed_text, .hidden { opacity: .7; diff --git a/src/core/features/grades/services/grades-helper.ts b/src/core/features/grades/services/grades-helper.ts index cf83ea121..c343c2c71 100644 --- a/src/core/features/grades/services/grades-helper.ts +++ b/src/core/features/grades/services/grades-helper.ts @@ -108,7 +108,7 @@ export class CoreGradesHelperProvider { let content = String(column.content); - if (name == 'itemname') { + if (name === 'itemname') { const itemNameColumn = column; row.id = parseInt(itemNameColumn.id.split('_')[1], 10); @@ -123,6 +123,20 @@ export class CoreGradesHelperProvider { content = content.replace(/<\/span>/gi, '\n'); content = CoreTextUtils.cleanTags(content); name = 'gradeitem'; + } else if (name === 'grade') { + // Add the pass/fail class if present. + row.gradeClass = column.class.includes('gradepass') ? 'text-success' : + (column.class.includes('gradefail') ? 'text-danger' : ''); + + if (content.includes('fa-check')) { + row.gradeIcon = 'fas-check'; + row.gradeIconAlt = Translate.instant('core.grades.pass'); + content = CoreTextUtils.cleanTags(content); + } else if (content.includes('fa-times')) { + row.gradeIcon = 'fas-times'; + row.gradeIconAlt = Translate.instant('core.grades.fail'); + content = CoreTextUtils.cleanTags(content); + } } else { content = CoreTextUtils.replaceNewLines(content, '
'); } @@ -721,6 +735,9 @@ export type CoreGradesFormattedTableRow = CoreGradesFormattedRowCommonData & { ariaLabel?: string; expandable?: boolean; expanded?: boolean; + gradeClass?: string; + gradeIcon?: string; + gradeIconAlt?: string; }; export type CoreGradesFormattedTableColumn = {