forked from EVOgeek/Vmeda.Online
		
	MOBILE-4362 activitymodules: Fix activity modules block icons
This commit is contained in:
		
							parent
							
								
									2019283bd1
								
							
						
					
					
						commit
						14e56e82c5
					
				| @ -22,6 +22,7 @@ import { Translate } from '@singletons'; | ||||
| import { CoreUtils } from '@services/utils/utils'; | ||||
| import { CoreNavigator } from '@services/navigator'; | ||||
| import { CoreCourseHelper } from '@features/course/services/course-helper'; | ||||
| import { CoreUrlUtils } from '@services/utils/url'; | ||||
| 
 | ||||
| /** | ||||
|  * Component to render an "activity modules" block. | ||||
| @ -68,23 +69,22 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i | ||||
|             } | ||||
| 
 | ||||
|             section.modules.forEach((mod) => { | ||||
|                 if (!CoreCourseHelper.canUserViewModule(mod, section) || !CoreCourse.moduleHasView(mod) || | ||||
|                     modFullNames[mod.modname] !== undefined) { | ||||
|                 if (archetypes[mod.modname] !== undefined || | ||||
|                     !CoreCourseHelper.canUserViewModule(mod, section) || | ||||
|                     !CoreCourse.moduleHasView(mod)) { | ||||
|                     // Ignore this module.
 | ||||
|                     return; | ||||
|                 } | ||||
| 
 | ||||
|                 // Get the archetype of the module type.
 | ||||
|                 if (archetypes[mod.modname] === undefined) { | ||||
|                     archetypes[mod.modname] = CoreCourseModuleDelegate.supportsFeature<number>( | ||||
|                         mod.modname, | ||||
|                         CoreConstants.FEATURE_MOD_ARCHETYPE, | ||||
|                         CoreConstants.MOD_ARCHETYPE_OTHER, | ||||
|                     ); | ||||
|                 } | ||||
|                 archetypes[mod.modname] = CoreCourseModuleDelegate.supportsFeature<number>( | ||||
|                     mod.modname, | ||||
|                     CoreConstants.FEATURE_MOD_ARCHETYPE, | ||||
|                     CoreConstants.MOD_ARCHETYPE_OTHER, | ||||
|                 ); | ||||
| 
 | ||||
|                 // Get the full name of the module type.
 | ||||
|                 if (archetypes[mod.modname] == CoreConstants.MOD_ARCHETYPE_RESOURCE) { | ||||
|                 if (archetypes[mod.modname] === CoreConstants.MOD_ARCHETYPE_RESOURCE) { | ||||
|                     // All resources are gathered in a single "Resources" option.
 | ||||
|                     if (!modFullNames['resources']) { | ||||
|                         modFullNames['resources'] = Translate.instant('core.resources'); | ||||
| @ -92,7 +92,11 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i | ||||
|                 } else { | ||||
|                     modFullNames[mod.modname] = mod.modplural; | ||||
|                 } | ||||
|                 modIcons[mod.modname] = mod.modicon; | ||||
| 
 | ||||
|                 // If this is not a theme image, leave it undefined to avoid having specific activity icons.
 | ||||
|                 if (CoreUrlUtils.isThemeImageUrl(mod.modicon)) { | ||||
|                     modIcons[mod.modname] = mod.modicon; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|         // Sort the modnames alphabetically.
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user