MOBILE-2795 course: Fix disable download course
parent
987ff6ad43
commit
c5440811dd
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<div class="core-button-spinner" *ngIf="courseOptionMenuEnabled">
|
<div class="core-button-spinner" *ngIf="courseOptionMenuEnabled">
|
||||||
<!-- Download course spinner. -->
|
<!-- Download course spinner. -->
|
||||||
<ion-spinner *ngIf="prefetchCourseData.prefetchCourseIcon == 'spinner' || showSpinner"></ion-spinner>
|
<ion-spinner *ngIf="(downloadCourseEnabled && prefetchCourseData.prefetchCourseIcon == 'spinner') || showSpinner"></ion-spinner>
|
||||||
|
|
||||||
<!-- Options menu. -->
|
<!-- Options menu. -->
|
||||||
<button ion-button icon-only clear color="dark" (click)="showCourseOptionsMenu($event)" *ngIf="!showSpinner">
|
<button ion-button icon-only clear color="dark" (click)="showCourseOptionsMenu($event)" *ngIf="!showSpinner">
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<ion-icon name="search"></ion-icon>
|
<ion-icon name="search"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<core-context-menu>
|
<core-context-menu>
|
||||||
<core-context-menu-item *ngIf="downloadCourseEnabled" [priority]="1000" [content]="'core.settings.showdownloadoptions' | translate" (action)="toggleDownload()" [iconAction]="downloadEnabledIcon"></core-context-menu-item>
|
<core-context-menu-item *ngIf="downloadCourseEnabled || downloadCoursesEnabled" [priority]="1000" [content]="'core.settings.showdownloadoptions' | translate" (action)="toggleDownload()" [iconAction]="downloadEnabledIcon"></core-context-menu-item>
|
||||||
</core-context-menu>
|
</core-context-menu>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
|
|
|
@ -52,6 +52,7 @@ export class CoreCoursesDashboardPage implements OnDestroy {
|
||||||
downloadEnabled: boolean;
|
downloadEnabled: boolean;
|
||||||
downloadEnabledIcon = 'square-outline'; // Disabled by default.
|
downloadEnabledIcon = 'square-outline'; // Disabled by default.
|
||||||
downloadCourseEnabled: boolean;
|
downloadCourseEnabled: boolean;
|
||||||
|
downloadCoursesEnabled: boolean;
|
||||||
|
|
||||||
protected isDestroyed;
|
protected isDestroyed;
|
||||||
protected updateSiteObserver;
|
protected updateSiteObserver;
|
||||||
|
@ -69,11 +70,13 @@ export class CoreCoursesDashboardPage implements OnDestroy {
|
||||||
ionViewDidLoad(): void {
|
ionViewDidLoad(): void {
|
||||||
this.searchEnabled = !this.coursesProvider.isSearchCoursesDisabledInSite();
|
this.searchEnabled = !this.coursesProvider.isSearchCoursesDisabledInSite();
|
||||||
this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite();
|
this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite();
|
||||||
|
this.downloadCoursesEnabled = !this.coursesProvider.isDownloadCoursesDisabledInSite();
|
||||||
|
|
||||||
// Refresh the enabled flags if site is updated.
|
// Refresh the enabled flags if site is updated.
|
||||||
this.updateSiteObserver = this.eventsProvider.on(CoreEventsProvider.SITE_UPDATED, () => {
|
this.updateSiteObserver = this.eventsProvider.on(CoreEventsProvider.SITE_UPDATED, () => {
|
||||||
this.searchEnabled = !this.coursesProvider.isSearchCoursesDisabledInSite();
|
this.searchEnabled = !this.coursesProvider.isSearchCoursesDisabledInSite();
|
||||||
this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite();
|
this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite();
|
||||||
|
this.downloadCoursesEnabled = !this.coursesProvider.isDownloadCoursesDisabledInSite();
|
||||||
|
|
||||||
this.switchDownload(this.downloadEnabled);
|
this.switchDownload(this.downloadEnabled);
|
||||||
|
|
||||||
|
@ -196,7 +199,7 @@ export class CoreCoursesDashboardPage implements OnDestroy {
|
||||||
* @param {boolean} enable If enable or disable.
|
* @param {boolean} enable If enable or disable.
|
||||||
*/
|
*/
|
||||||
protected switchDownload(enable: boolean): void {
|
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.downloadEnabledIcon = this.downloadEnabled ? 'checkbox-outline' : 'square-outline';
|
||||||
this.eventsProvider.trigger(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, {enabled: this.downloadEnabled});
|
this.eventsProvider.trigger(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, {enabled: this.downloadEnabled});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue