From c5440811dd544f9fbee161365c9446bb3d85720f Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 4 Jan 2019 15:29:27 +0100 Subject: [PATCH] MOBILE-2795 course: Fix disable download course --- .../course-progress/core-courses-course-progress.html | 2 +- src/core/courses/pages/dashboard/dashboard.html | 2 +- src/core/courses/pages/dashboard/dashboard.ts | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/courses/components/course-progress/core-courses-course-progress.html b/src/core/courses/components/course-progress/core-courses-course-progress.html index 413d94520..4e2757ebb 100644 --- a/src/core/courses/components/course-progress/core-courses-course-progress.html +++ b/src/core/courses/components/course-progress/core-courses-course-progress.html @@ -22,7 +22,7 @@
- + - + diff --git a/src/core/courses/pages/dashboard/dashboard.ts b/src/core/courses/pages/dashboard/dashboard.ts index 150ad911a..fccd91e7b 100644 --- a/src/core/courses/pages/dashboard/dashboard.ts +++ b/src/core/courses/pages/dashboard/dashboard.ts @@ -52,6 +52,7 @@ export class CoreCoursesDashboardPage implements OnDestroy { downloadEnabled: boolean; downloadEnabledIcon = 'square-outline'; // Disabled by default. downloadCourseEnabled: boolean; + downloadCoursesEnabled: boolean; protected isDestroyed; protected updateSiteObserver; @@ -69,11 +70,13 @@ export class CoreCoursesDashboardPage implements OnDestroy { ionViewDidLoad(): void { this.searchEnabled = !this.coursesProvider.isSearchCoursesDisabledInSite(); this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite(); + this.downloadCoursesEnabled = !this.coursesProvider.isDownloadCoursesDisabledInSite(); // Refresh the enabled flags if site is updated. this.updateSiteObserver = this.eventsProvider.on(CoreEventsProvider.SITE_UPDATED, () => { this.searchEnabled = !this.coursesProvider.isSearchCoursesDisabledInSite(); this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite(); + this.downloadCoursesEnabled = !this.coursesProvider.isDownloadCoursesDisabledInSite(); this.switchDownload(this.downloadEnabled); @@ -196,7 +199,7 @@ export class CoreCoursesDashboardPage implements OnDestroy { * @param {boolean} enable If enable or disable. */ protected switchDownload(enable: boolean): void { - this.downloadEnabled = this.downloadCourseEnabled && enable; + this.downloadEnabled = (this.downloadCourseEnabled || this.downloadCoursesEnabled) && enable; this.downloadEnabledIcon = this.downloadEnabled ? 'checkbox-outline' : 'square-outline'; this.eventsProvider.trigger(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, {enabled: this.downloadEnabled}); }