MOBILE-3686 dashboard: Fix dashboard download options
This commit is contained in:
		
							parent
							
								
									264309593f
								
							
						
					
					
						commit
						577aa3168f
					
				| @ -6,7 +6,7 @@ | ||||
|         <core-context-menu-item *ngIf="(downloadCourseEnabled || downloadCoursesEnabled)" [priority]="1000" | ||||
|         [content]="'core.settings.showdownloadoptions' | translate" (action)="switchDownload(!downloadEnabled)" | ||||
|         iconAction="toggle" [toggle]="downloadEnabled"></core-context-menu-item> | ||||
|         <core-context-menu-item *ngIf="(downloadCourseEnabled || downloadCoursesEnabled)" [priority]="500" | ||||
|         <core-context-menu-item [priority]="500" | ||||
|         [content]="'addon.storagemanager.managestorage' | translate" | ||||
|         (action)="manageCoursesStorage()" iconAction="fas-archive"></core-context-menu-item> | ||||
|     </core-context-menu> | ||||
|  | ||||
| @ -3,10 +3,10 @@ | ||||
|         <ion-icon name="fas-search" slot="icon-only" aria-hidden="true"></ion-icon> | ||||
|     </ion-button> | ||||
|     <core-context-menu> | ||||
|         <core-context-menu-item *ngIf="(downloadCourseEnabled || downloadCoursesEnabled)" [priority]="1000" | ||||
|         <core-context-menu-item [priority]="1000" | ||||
|         [content]="'core.settings.showdownloadoptions' | translate" (action)="switchDownload(!downloadEnabled)" | ||||
|         iconAction="toggle" [toggle]="downloadEnabled"></core-context-menu-item> | ||||
|         <core-context-menu-item *ngIf="(downloadCourseEnabled || downloadCoursesEnabled)" [priority]="500" | ||||
|         <core-context-menu-item [priority]="500" | ||||
|         [content]="'addon.storagemanager.managestorage' | translate" | ||||
|         (action)="manageCoursesStorage()" iconAction="fas-archive"></core-context-menu-item> | ||||
|     </core-context-menu> | ||||
|  | ||||
| @ -51,8 +51,6 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy { | ||||
|     currentSite!: CoreSite; | ||||
|     searchEnabled = false; | ||||
|     downloadEnabled = false; | ||||
|     downloadCourseEnabled = false; | ||||
|     downloadCoursesEnabled = false; | ||||
|     newsForumModule?: NewsForum; | ||||
| 
 | ||||
|     protected updateSiteObserver?: CoreEventObserver; | ||||
| @ -62,16 +60,10 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy { | ||||
|      */ | ||||
|     ngOnInit(): void { | ||||
|         this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
|         this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); | ||||
|         this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
| 
 | ||||
|         // Refresh the enabled flags if site is updated.
 | ||||
|         this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => { | ||||
|             this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
|             this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); | ||||
|             this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
| 
 | ||||
|             this.switchDownload(this.downloadEnabled && this.downloadCourseEnabled && this.downloadCoursesEnabled); | ||||
|         }, CoreSites.getCurrentSiteId()); | ||||
| 
 | ||||
|         this.currentSite = CoreSites.getRequiredCurrentSite(); | ||||
| @ -194,7 +186,7 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy { | ||||
|      * @param enable If enable or disable. | ||||
|      */ | ||||
|     protected switchDownload(enable: boolean): void { | ||||
|         this.downloadEnabled = (this.downloadCourseEnabled || this.downloadCoursesEnabled) && enable; | ||||
|         this.downloadEnabled = enable; | ||||
|         CoreEvents.trigger(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, { enabled: this.downloadEnabled }); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user