From 9108e76f8340f4cb9b7e4763f1e988dd64be92d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 9 Jan 2025 11:00:17 +0100 Subject: [PATCH] MOBILE-4733 courses: Add course-id data attribute to course --- .../components/myoverview/addon-block-myoverview.html | 4 ++-- .../addon-block-recentlyaccessedcourses.html | 2 +- .../starredcourses/addon-block-starredcourses.html | 2 +- .../components/events/addon-block-timeline-events.html | 2 +- src/addons/block/timeline/components/events/events.ts | 6 +++++- .../components/course-list-item/course-list-item.ts | 8 ++++++-- .../features/courses/pages/categories/categories.html | 10 +++++----- src/core/features/courses/pages/list/list.html | 2 +- src/theme/theme.base.scss | 6 ++++-- 9 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html index a204b78f6..b7a34cbaf 100644 --- a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html +++ b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html @@ -117,11 +117,11 @@ -
+
+ size-xl="3" [attr.data-course-id]="course.id"> diff --git a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html index 1b76456b0..384b2b797 100644 --- a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html +++ b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html @@ -12,7 +12,7 @@
-
+
diff --git a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html index f022f3e2c..be62d2b75 100644 --- a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html +++ b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html @@ -12,7 +12,7 @@
-
+
diff --git a/src/addons/block/timeline/components/events/addon-block-timeline-events.html b/src/addons/block/timeline/components/events/addon-block-timeline-events.html index 4068ea1ad..e9a6c41ec 100644 --- a/src/addons/block/timeline/components/events/addon-block-timeline-events.html +++ b/src/addons/block/timeline/components/events/addon-block-timeline-events.html @@ -14,7 +14,7 @@ + button lines="full" [attr.data-event-course-id]="event.course?.id"> diff --git a/src/addons/block/timeline/components/events/events.ts b/src/addons/block/timeline/components/events/events.ts index 141b8b917..c980dc591 100644 --- a/src/addons/block/timeline/components/events/events.ts +++ b/src/addons/block/timeline/components/events/events.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; +import { Component, Input, Output, EventEmitter, OnInit, HostBinding } from '@angular/core'; import { CoreSites } from '@services/sites'; import { CoreLoadings } from '@services/loadings'; import { CoreText } from '@singletons/text'; @@ -44,6 +44,10 @@ export class AddonBlockTimelineEventsComponent implements OnInit { colorizeIcons = false; + @HostBinding('attr.data-course-id') protected get courseId(): number | null { + return this.course?.id ?? null; + } + /** * @inheritdoc */ 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 c87a6e519..98810f867 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 @@ -13,7 +13,7 @@ // limitations under the License. import { DownloadStatus } from '@/core/constants'; -import { Component, ElementRef, Input, OnChanges, OnDestroy, OnInit } from '@angular/core'; +import { Component, ElementRef, HostBinding, Input, OnChanges, OnDestroy, OnInit } from '@angular/core'; import { CoreCourse } from '@features/course/services/course'; import { CoreCourseHelper, CorePrefetchStatusInfo } from '@features/course/services/course-helper'; import { CoreUser } from '@features/user/services/user'; @@ -43,7 +43,7 @@ import { CORE_COURSE_ALL_COURSES_CLEARED, CORE_COURSE_PROGRESS_UPDATED_EVENT } f * * Example usage: * - * + * */ @Component({ selector: 'core-courses-course-list-item', @@ -83,6 +83,10 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On protected element: HTMLElement; protected progressObserver: CoreEventObserver; + @HostBinding('attr.data-course-id') protected get courseId(): number { + return this.course.id; + } + constructor(element: ElementRef) { this.element = element.nativeElement; const siteId = CoreSites.getCurrentSiteId(); diff --git a/src/core/features/courses/pages/categories/categories.html b/src/core/features/courses/pages/categories/categories.html index 09e2de396..2cb43e48a 100644 --- a/src/core/features/courses/pages/categories/categories.html +++ b/src/core/features/courses/pages/categories/categories.html @@ -38,13 +38,13 @@ - +

{{ 'core.courses.categories' | translate }}

- + @@ -59,9 +59,9 @@ - +
- +

{{ 'core.courses.courses' | translate }}

@@ -69,7 +69,7 @@
- +
diff --git a/src/core/features/courses/pages/list/list.html b/src/core/features/courses/pages/list/list.html index b896132fb..d8478dd39 100644 --- a/src/core/features/courses/pages/list/list.html +++ b/src/core/features/courses/pages/list/list.html @@ -37,7 +37,7 @@
- + diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index f5f8d1d1e..bbf97167f 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -241,7 +241,8 @@ ion-content.limited-width > :not([slot]) { min-height: 100%; } -.core-anchor, core-format-text a { +.core-anchor, +core-format-text a { color: var(--core-link-color); cursor: pointer; text-decoration: underline; @@ -262,7 +263,8 @@ ion-content.limited-width > :not([slot]) { // Text formats. // Highlight text. -mark, .matchtext { +mark, +.matchtext { background-color: var(--text-hightlight-background-color); }