MOBILE-3833 my: Move search to empty box on my overview
This commit is contained in:
		
							parent
							
								
									6d13fdf6a7
								
							
						
					
					
						commit
						2ce808dfab
					
				| @ -70,6 +70,11 @@ | ||||
| 
 | ||||
|     <core-empty-box *ngIf="filteredCourses.length == 0" image="assets/img/icons/courses.svg" | ||||
|         [message]="'addon.block_myoverview.nocourses' | translate"> | ||||
|         <ion-button *ngIf="searchEnabled" (click)="openSearch()" fill="outline"> | ||||
|             <ion-icon name="fas-search" slot="start" aria-hidden="true"> | ||||
|             </ion-icon> | ||||
|             {{'core.courses.searchcourses' | translate}} | ||||
|         </ion-button> | ||||
|     </core-empty-box> | ||||
| 
 | ||||
|     <!-- List of courses. --> | ||||
|  | ||||
| @ -30,6 +30,7 @@ import { AddonCourseCompletion } from '@addons/coursecompletion/services/coursec | ||||
| import { AddonBlockMyOverviewFilterOptionsComponent } from '../filteroptions/filteroptions'; | ||||
| import { IonSearchbar } from '@ionic/angular'; | ||||
| import moment from 'moment'; | ||||
| import { CoreNavigator } from '@services/navigator'; | ||||
| 
 | ||||
| const FILTER_PRIORITY: AddonBlockMyOverviewTimeFilters[] = ['all', 'inprogress', 'future', 'past']; | ||||
| 
 | ||||
| @ -88,6 +89,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem | ||||
| 
 | ||||
|     textFilter = ''; | ||||
|     hasCourses = false; | ||||
|     searchEnabled = false; | ||||
| 
 | ||||
|     protected currentSite!: CoreSite; | ||||
|     protected allCourses: CoreEnrolledCourseDataWithOptions[] = []; | ||||
| @ -110,12 +112,13 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem | ||||
|         // Refresh the enabled flags if enabled.
 | ||||
|         this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); | ||||
|         this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
|         this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
| 
 | ||||
|         // Refresh the enabled flags if site is updated.
 | ||||
|         this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => { | ||||
|             this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); | ||||
|             this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
| 
 | ||||
|             this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
|         }, CoreSites.getCurrentSiteId()); | ||||
| 
 | ||||
|         this.coursesObserver = CoreEvents.on( | ||||
| @ -676,6 +679,13 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem | ||||
|         this.filterCourses(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Go to search courses. | ||||
|      */ | ||||
|     async openSearch(): Promise<void> { | ||||
|         CoreNavigator.navigateToSitePath('/list', { params : { mode: 'search' } }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @inheritdoc | ||||
|      */ | ||||
|  | ||||
| @ -11,9 +11,6 @@ | ||||
|             </h1> | ||||
|         </ion-title> | ||||
|         <ion-buttons slot="end"> | ||||
|             <ion-button *ngIf="searchEnabled" (click)="openSearch()" [attr.aria-label]="'core.courses.searchcourses' | translate"> | ||||
|                 <ion-icon name="fas-search" slot="icon-only" aria-hidden="true"></ion-icon> | ||||
|             </ion-button> | ||||
|             <core-user-menu-button></core-user-menu-button> | ||||
|         </ion-buttons> | ||||
|     </ion-toolbar> | ||||
|  | ||||
| @ -19,7 +19,6 @@ import { CoreCourseBlock } from '@features/course/services/course'; | ||||
| import { CoreCoursesDashboard, CoreCoursesDashboardProvider } from '@features/courses/services/dashboard'; | ||||
| import { CoreMainMenuDeepLinkManager } from '@features/mainmenu/classes/deep-link-manager'; | ||||
| import { IonRefresher } from '@ionic/angular'; | ||||
| import { CoreNavigator } from '@services/navigator'; | ||||
| import { CoreSites } from '@services/sites'; | ||||
| import { CoreUtils } from '@services/utils/utils'; | ||||
| import { CoreEventObserver, CoreEvents } from '@singletons/events'; | ||||
| @ -38,7 +37,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { | ||||
|     @ViewChild(CoreBlockComponent) block!: CoreBlockComponent; | ||||
| 
 | ||||
|     siteName = ''; | ||||
|     searchEnabled = false; | ||||
|     downloadCoursesEnabled = false; | ||||
|     userId: number; | ||||
|     loadedBlock?: Partial<CoreCourseBlock>; | ||||
| @ -50,7 +48,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { | ||||
|     constructor() { | ||||
|         // Refresh the enabled flags if site is updated.
 | ||||
|         this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => { | ||||
|             this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
|             this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
|             this.loadSiteName(); | ||||
| 
 | ||||
| @ -63,7 +60,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { | ||||
|      * @inheritdoc | ||||
|      */ | ||||
|     ngOnInit(): void { | ||||
|         this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
|         this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
| 
 | ||||
|         const deepLinkManager = new CoreMainMenuDeepLinkManager(); | ||||
| @ -122,13 +118,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Go to search courses. | ||||
|      */ | ||||
|     async openSearch(): Promise<void> { | ||||
|         CoreNavigator.navigateToSitePath('/list', { params : { mode: 'search' } }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Refresh the data. | ||||
|      * | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user