forked from EVOgeek/Vmeda.Online
		
	MOBILE-3371 search: Improve course search
This commit is contained in:
		
							parent
							
								
									1edc59f1c0
								
							
						
					
					
						commit
						af00e8e3c6
					
				| @ -41,14 +41,14 @@ export class AddonBlockGlobalSearchHandlerService extends CoreBlockBaseHandler { | ||||
|      * @inheritdoc | ||||
|      */ | ||||
|     getDisplayData(block: CoreCourseBlock, contextLevel: string, instanceId: number): CoreBlockHandlerData | undefined { | ||||
|         const isCourseSearch = contextLevel === 'course'; | ||||
| 
 | ||||
|         return { | ||||
|             title: 'addon.block_globalsearch.pluginname', | ||||
|             title: isCourseSearch ? 'core.search' : 'addon.block_globalsearch.pluginname', | ||||
|             class: 'addon-block-globalsearch', | ||||
|             component: CoreBlockOnlyTitleComponent, | ||||
|             link: CORE_SEARCH_PAGE_NAME, | ||||
|             linkParams: contextLevel === 'course' | ||||
|                 ? { courseId: instanceId } | ||||
|                 : {}, | ||||
|             linkParams: isCourseSearch ? { courseId: instanceId } : {}, | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -39,6 +39,7 @@ export class CoreSearchGlobalSearchFiltersComponent implements OnInit { | ||||
|     allCourses: boolean | null = true; | ||||
|     courses: Filter<CoreEnrolledCourseData>[] = []; | ||||
| 
 | ||||
|     @Input() hideCourses?: boolean; | ||||
|     @Input() filters?: CoreSearchGlobalSearchFilters; | ||||
| 
 | ||||
|     private newFilters: CoreSearchGlobalSearchFilters = {}; | ||||
|  | ||||
| @ -35,7 +35,7 @@ | ||||
|                     (ionChange)="onSearchAreaCategoryInputChanged(searchAreaCategory)"></ion-checkbox> | ||||
|             </ion-item> | ||||
|         </ng-container> | ||||
|         <ng-container *ngIf="courses.length > 0"> | ||||
|         <ng-container *ngIf="!hideCourses && courses.length > 0"> | ||||
|             <core-spacer></core-spacer> | ||||
|             <ion-item class="ion-text-wrap help"> | ||||
|                 <ion-label> | ||||
|  | ||||
| @ -4,7 +4,8 @@ | ||||
|             <ion-back-button [text]="'core.back' | translate"></ion-back-button> | ||||
|         </ion-buttons> | ||||
|         <ion-title> | ||||
|             <h1>{{ 'core.search.globalsearch' | translate }}</h1> | ||||
|             <h1 *ngIf="courseId">{{ 'core.search' | translate }}</h1> | ||||
|             <h1 *ngIf="!courseId">{{ 'core.search.globalsearch' | translate }}</h1> | ||||
|         </ion-title> | ||||
|         <ion-buttons slot="end"> | ||||
|             <core-user-menu-button></core-user-menu-button> | ||||
|  | ||||
| @ -36,6 +36,7 @@ import { CoreSearchBoxComponent } from '@features/search/components/search-box/s | ||||
| }) | ||||
| export class CoreSearchGlobalSearchPage implements OnInit, OnDestroy, AfterViewInit { | ||||
| 
 | ||||
|     courseId: number | null = null; | ||||
|     loadMoreError: string | null = null; | ||||
|     searchBanner: string | null = null; | ||||
|     resultsSource = new CoreSearchGlobalSearchResultsSource('', {}); | ||||
| @ -56,6 +57,7 @@ export class CoreSearchGlobalSearchPage implements OnInit, OnDestroy, AfterViewI | ||||
|         } | ||||
| 
 | ||||
|         if (courseId) { | ||||
|             this.courseId = courseId; | ||||
|             this.resultsSource.setFilters({ courseIds: [courseId] }); | ||||
|         } | ||||
| 
 | ||||
| @ -139,7 +141,10 @@ export class CoreSearchGlobalSearchPage implements OnInit, OnDestroy, AfterViewI | ||||
| 
 | ||||
|         await CoreDomUtils.openSideModal<CoreSearchGlobalSearchFilters>({ | ||||
|             component: CoreSearchGlobalSearchFiltersComponent, | ||||
|             componentProps: { filters: this.resultsSource.getFilters() }, | ||||
|             componentProps: { | ||||
|                 hideCourses: !!this.courseId, | ||||
|                 filters: this.resultsSource.getFilters(), | ||||
|             }, | ||||
|         }); | ||||
| 
 | ||||
|         if (!this.resultsSource.hasEmptyQuery() && this.resultsSource.isDirty()) { | ||||
|  | ||||
| @ -139,9 +139,9 @@ Feature: Test Global Search | ||||
|       | globalsearch | Course       | C1        | | ||||
|     And I entered the course "Course 1" as "student1" in the app | ||||
|     When I press "Open block drawer" in the app | ||||
|     And I press "Global search" in the app | ||||
|     And I press "Search" in the app | ||||
|     Then I should find "What are you searching for?" in the app | ||||
| 
 | ||||
|     When I press "Filter" in the app | ||||
|     Then "C1" should be selected in the app | ||||
|     But "C2" should not be selected in the app | ||||
|     Then I should find "Filter results by" in the app | ||||
|     But I should not find "Search in" in the app | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user