Merge pull request #1546 from dpalou/MOBILE-2641
MOBILE-2641 resource: Fix icons in sites older than 3.1main
commit
86501d3c4e
|
@ -129,18 +129,20 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler {
|
||||||
handlerData.buttons[0].hidden = hideOpenButton;
|
handlerData.buttons[0].hidden = hideOpenButton;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (this.resourceProvider.isGetResourceWSAvailable()) {
|
||||||
// Get the resource data.
|
// Get the resource data.
|
||||||
promises.push(this.resourceProvider.getResourceData(courseId, module.id).then((info) => {
|
promises.push(this.resourceProvider.getResourceData(courseId, module.id).then((info) => {
|
||||||
resourceInfo = info;
|
resourceInfo = info;
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.all(promises).then(() => {
|
return Promise.all(promises).then(() => {
|
||||||
const files = module.contents && module.contents.length ? module.contents : resourceInfo.contentfiles,
|
const files = module.contents && module.contents.length ? module.contents : resourceInfo && resourceInfo.contentfiles,
|
||||||
resourceData = {
|
resourceData = {
|
||||||
icon: '',
|
icon: '',
|
||||||
extra: ''
|
extra: ''
|
||||||
},
|
},
|
||||||
options = this.textUtils.unserialize(resourceInfo.displayoptions),
|
options = (resourceInfo && this.textUtils.unserialize(resourceInfo.displayoptions)) || {},
|
||||||
extra = [];
|
extra = [];
|
||||||
|
|
||||||
if (files && files.length) {
|
if (files && files.length) {
|
||||||
|
|
Loading…
Reference in New Issue