diff --git a/src/core/features/course/pages/course-summary/course-summary.html b/src/core/features/course/pages/course-summary/course-summary.html index 8816e13c9..d4ac2dd2d 100644 --- a/src/core/features/course/pages/course-summary/course-summary.html +++ b/src/core/features/course/pages/course-summary/course-summary.html @@ -18,7 +18,7 @@
- +
diff --git a/src/core/features/course/pages/course-summary/course-summary.page.ts b/src/core/features/course/pages/course-summary/course-summary.page.ts index 666d6bd57..502174240 100644 --- a/src/core/features/course/pages/course-summary/course-summary.page.ts +++ b/src/core/features/course/pages/course-summary/course-summary.page.ts @@ -466,6 +466,20 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { CoreNavigator.navigateToSitePath(item.data.page, { params }); } + /** + * Removes the course image set because it cannot be loaded and set the fallback icon color. + */ + loadFallbackCourseIcon(): void { + if (!this.course) { + return; + } + + this.course.courseimage = undefined; + + // Set the color because it won't be set at this point. + this.setCourseColor(); + } + /** * Set course color. */ diff --git a/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html b/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html index b58603c55..089600c54 100644 --- a/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html +++ b/src/core/features/courses/components/course-list-item/core-courses-course-list-item.html @@ -3,7 +3,7 @@ button [attr.aria-label]="course.displayname || course.fullname">
- +
@@ -34,7 +34,7 @@ aria-hidden="true"> - + diff --git a/src/core/features/courses/components/course-list-item/course-list-item.ts b/src/core/features/courses/components/course-list-item/course-list-item.ts index b648125ff..e38ecaf47 100644 --- a/src/core/features/courses/components/course-list-item/course-list-item.ts +++ b/src/core/features/courses/components/course-list-item/course-list-item.ts @@ -128,6 +128,16 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On } } + /** + * Removes the course image set because it cannot be loaded and set the fallback icon color. + */ + loadFallbackCourseIcon(): void { + this.course.courseimage = undefined; + + // Set the color because it won't be set at this point. + this.setCourseColor(); + } + /** * Set course color. */