diff --git a/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html index 4275f04b3..bc00beb27 100644 --- a/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html +++ b/src/addon/block/myoverview/components/myoverview/addon-block-myoverview.html @@ -1,7 +1,7 @@

{{ 'addon.block_myoverview.pluginname' | translate }}

-
+
@@ -36,7 +36,7 @@ - + diff --git a/src/addon/block/myoverview/components/myoverview/myoverview.ts b/src/addon/block/myoverview/components/myoverview/myoverview.ts index ee4f77101..218866d5f 100644 --- a/src/addon/block/myoverview/components/myoverview/myoverview.ts +++ b/src/addon/block/myoverview/components/myoverview/myoverview.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnInit, OnDestroy, ViewChild, Injector } from '@angular/core'; +import { Component, OnInit, Input, OnDestroy, ViewChild, Injector } from '@angular/core'; import { Searchbar } from 'ionic-angular'; import { CoreEventsProvider } from '@providers/events'; import { CoreUtilsProvider } from '@providers/utils/utils'; @@ -34,6 +34,7 @@ import { CoreBlockBaseComponent } from '@core/block/classes/base-block-component }) export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implements OnInit, OnDestroy { @ViewChild('searchbar') searchbar: Searchbar; + @Input() downloadEnabled: boolean; courses = { filter: '', @@ -47,7 +48,6 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem selectedFilter = 'inprogress'; sort = 'fullname'; currentSite: any; - downloadAllCoursesEnabled: boolean; filteredCourses: any[]; prefetchCoursesData = { all: {}, @@ -86,11 +86,11 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem // Refresh the enabled flags if enabled. this.downloadButtonObserver = this.eventsProvider.on(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, (data) => { - const wasEnabled = this.downloadAllCoursesEnabled; + const wasEnabled = this.downloadEnabled; - this.downloadAllCoursesEnabled = data.enabled; + this.downloadEnabled = data.enabled; - if (!wasEnabled && this.downloadAllCoursesEnabled && this.loaded) { + if (!wasEnabled && this.downloadEnabled && this.loaded) { // Download all courses is enabled now, initialize it. this.initPrefetchCoursesIcons(); } @@ -198,7 +198,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Initialize the prefetch icon for selected courses. */ protected initPrefetchCoursesIcons(): void { - if (this.prefetchIconsInitialized || !this.downloadAllCoursesEnabled) { + if (this.prefetchIconsInitialized || !this.downloadEnabled) { // Already initialized. return; } diff --git a/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html b/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html index c890ad9f7..a7b89c595 100644 --- a/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html +++ b/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html @@ -1,6 +1,6 @@

{{ 'addon.block_recentlyaccessedcourses.pluginname' | translate }}

-
+
@@ -14,7 +14,7 @@
- +
diff --git a/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts b/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts index fe741aca6..2d962d17c 100644 --- a/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts +++ b/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnInit, OnDestroy, Injector } from '@angular/core'; +import { Component, OnInit, OnDestroy, Injector, Input } from '@angular/core'; import { CoreEventsProvider } from '@providers/events'; import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreSitesProvider } from '@providers/sites'; @@ -31,12 +31,13 @@ import { CoreBlockBaseComponent } from '@core/block/classes/base-block-component templateUrl: 'addon-block-recentlyaccessedcourses.html' }) export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseComponent implements OnInit, OnDestroy { + @Input() downloadEnabled: boolean; + courses = []; prefetchCoursesData = { icon: '', badge: '' }; - downloadAllCoursesEnabled: boolean; protected prefetchIconsInitialized = false; protected isDestroyed; @@ -61,11 +62,11 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom // Refresh the enabled flags if enabled. this.downloadButtonObserver = this.eventsProvider.on(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, (data) => { - const wasEnabled = this.downloadAllCoursesEnabled; + const wasEnabled = this.downloadEnabled; - this.downloadAllCoursesEnabled = data.enabled; + this.downloadEnabled = data.enabled; - if (!wasEnabled && this.downloadAllCoursesEnabled && this.loaded) { + if (!wasEnabled && this.downloadEnabled && this.loaded) { // Download all courses is enabled now, initialize it. this.initPrefetchCoursesIcons(); } @@ -120,7 +121,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom * Initialize the prefetch icon for selected courses. */ protected initPrefetchCoursesIcons(): void { - if (this.prefetchIconsInitialized || !this.downloadAllCoursesEnabled) { + if (this.prefetchIconsInitialized || !this.downloadEnabled) { // Already initialized. return; } diff --git a/src/addon/block/starredcourses/components/starredcourses/addon-block-starredcourses.html b/src/addon/block/starredcourses/components/starredcourses/addon-block-starredcourses.html index a88854ee1..6e6c4856a 100644 --- a/src/addon/block/starredcourses/components/starredcourses/addon-block-starredcourses.html +++ b/src/addon/block/starredcourses/components/starredcourses/addon-block-starredcourses.html @@ -1,6 +1,6 @@

{{ 'addon.block_starredcourses.pluginname' | translate }}

-
+
@@ -14,7 +14,7 @@
- +
diff --git a/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts b/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts index 651322c69..ffa235134 100644 --- a/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts +++ b/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnInit, OnDestroy, Injector } from '@angular/core'; +import { Component, OnInit, OnDestroy, Injector, Input } from '@angular/core'; import { CoreEventsProvider } from '@providers/events'; import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreSitesProvider } from '@providers/sites'; @@ -31,12 +31,13 @@ import { CoreBlockBaseComponent } from '@core/block/classes/base-block-component templateUrl: 'addon-block-starredcourses.html' }) export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent implements OnInit, OnDestroy { + @Input() downloadEnabled: boolean; + courses = []; prefetchCoursesData = { icon: '', badge: '' }; - downloadAllCoursesEnabled: boolean; protected prefetchIconsInitialized = false; protected isDestroyed; @@ -61,11 +62,11 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im // Refresh the enabled flags if enabled. this.downloadButtonObserver = this.eventsProvider.on(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, (data) => { - const wasEnabled = this.downloadAllCoursesEnabled; + const wasEnabled = this.downloadEnabled; - this.downloadAllCoursesEnabled = data.enabled; + this.downloadEnabled = data.enabled; - if (!wasEnabled && this.downloadAllCoursesEnabled && this.loaded) { + if (!wasEnabled && this.downloadEnabled && this.loaded) { // Download all courses is enabled now, initialize it. this.initPrefetchCoursesIcons(); } @@ -120,7 +121,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im * Initialize the prefetch icon for selected courses. */ protected initPrefetchCoursesIcons(): void { - if (this.prefetchIconsInitialized || !this.downloadAllCoursesEnabled) { + if (this.prefetchIconsInitialized || !this.downloadEnabled) { // Already initialized. return; } diff --git a/src/core/courses/pages/dashboard/dashboard.html b/src/core/courses/pages/dashboard/dashboard.html index 9d409ca54..2178209a4 100644 --- a/src/core/courses/pages/dashboard/dashboard.html +++ b/src/core/courses/pages/dashboard/dashboard.html @@ -37,7 +37,7 @@ - +