forked from EVOgeek/Vmeda.Online
		
	MOBILE-4479 siteplugins: Only add default module-info if needed
This commit is contained in:
		
							parent
							
								
									1c967b7813
								
							
						
					
					
						commit
						fec29ecca1
					
				| @ -6,7 +6,8 @@ | |||||||
| </core-navbar-buttons> | </core-navbar-buttons> | ||||||
| 
 | 
 | ||||||
| <!-- Activity info. --> | <!-- Activity info. --> | ||||||
| <core-course-module-info [module]="module" [courseId]="courseId" [component]="component" [componentId]="module.id" /> | <core-course-module-info *ngIf="addDefaultModuleInfo" [module]="module" [courseId]="courseId" [component]="component" | ||||||
|  |     [componentId]="module.id" /> | ||||||
| 
 | 
 | ||||||
| <core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [method]="method" [args]="args" | <core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [method]="method" [args]="args" | ||||||
|     [initResult]="initResult" [data]="jsData" [pageTitle]="pageTitle" [preSets]="preSets" (onContentLoaded)="contentLoaded($event)" |     [initResult]="initResult" [data]="jsData" [pageTitle]="pageTitle" [preSets]="preSets" (onContentLoaded)="contentLoaded($event)" | ||||||
|  | |||||||
| @ -58,6 +58,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C | |||||||
|     description?: string; |     description?: string; | ||||||
| 
 | 
 | ||||||
|     collapsibleFooterAppearOnBottom = true; |     collapsibleFooterAppearOnBottom = true; | ||||||
|  |     addDefaultModuleInfo = false; | ||||||
| 
 | 
 | ||||||
|     displayOpenInBrowser = true; |     displayOpenInBrowser = true; | ||||||
|     displayDescription = true; |     displayDescription = true; | ||||||
| @ -133,6 +134,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C | |||||||
|      * Function called when the data of the site plugin content is loaded. |      * Function called when the data of the site plugin content is loaded. | ||||||
|      */ |      */ | ||||||
|     contentLoaded(data: CoreSitePluginsPluginContentLoadedData): void { |     contentLoaded(data: CoreSitePluginsPluginContentLoadedData): void { | ||||||
|  |         this.addDefaultModuleInfo = !data.content.includes('<core-course-module-info'); | ||||||
|         if (data.success) { |         if (data.success) { | ||||||
|             CoreCourse.storeModuleViewed(this.courseId, this.module.id, { |             CoreCourse.storeModuleViewed(this.courseId, this.module.id, { | ||||||
|                 sectionId: this.module.section, |                 sectionId: this.module.section, | ||||||
|  | |||||||
| @ -142,11 +142,11 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { | |||||||
|                 this.updateModuleCourseContent(cmId, alreadyFetched); |                 this.updateModuleCourseContent(cmId, alreadyFetched); | ||||||
|             this.jsData.updateCachedContent = () => this.updateCachedContent(); |             this.jsData.updateCachedContent = () => this.updateCachedContent(); | ||||||
| 
 | 
 | ||||||
|             this.onContentLoaded.emit({ refresh: !!refresh, success: true }); |             this.onContentLoaded.emit({ refresh: !!refresh, success: true, content: this.content }); | ||||||
|         } catch (error) { |         } catch (error) { | ||||||
|             // Make it think it's loaded - otherwise it sticks on 'loading' and stops navigation working.
 |             // Make it think it's loaded - otherwise it sticks on 'loading' and stops navigation working.
 | ||||||
|             this.content = '<div></div>'; |             this.content = '<div></div>'; | ||||||
|             this.onContentLoaded.emit({ refresh: !!refresh, success: false }); |             this.onContentLoaded.emit({ refresh: !!refresh, success: false, content: this.content }); | ||||||
| 
 | 
 | ||||||
|             CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true); |             CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true); | ||||||
|         } finally { |         } finally { | ||||||
| @ -282,4 +282,5 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { | |||||||
| export type CoreSitePluginsPluginContentLoadedData = { | export type CoreSitePluginsPluginContentLoadedData = { | ||||||
|     refresh: boolean; |     refresh: boolean; | ||||||
|     success: boolean; |     success: boolean; | ||||||
|  |     content: string; | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user