diff --git a/src/core/grades/providers/helper.ts b/src/core/grades/providers/helper.ts index 764d6ee7f..958c187e6 100644 --- a/src/core/grades/providers/helper.ts +++ b/src/core/grades/providers/helper.ts @@ -85,6 +85,10 @@ export class CoreGradesHelperProvider { let content = String(tableRow[name].content); if (name == 'itemname') { + row['id'] = parseInt(tableRow[name].id.split('_')[1], 10); + row['colspan'] = tableRow[name].colspan; + row['rowspan'] = (tableRow['leader'] && tableRow['leader'].rowspan) || 1; + this.setRowIcon(row, content); row['rowclass'] = tableRow[name].class.indexOf('leveleven') < 0 ? 'odd' : 'even'; row['rowclass'] += tableRow[name].class.indexOf('hidden') >= 0 ? ' hidden' : ''; @@ -92,10 +96,6 @@ export class CoreGradesHelperProvider { content = content.replace(/<\/span>/gi, '\n'); content = this.textUtils.cleanTags(content); - - row['id'] = parseInt(tableRow[name].id.split('_')[1], 10); - row['colspan'] = tableRow[name].colspan; - row['rowspan'] = (tableRow['leader'] && tableRow['leader'].rowspan) || 1; name = 'gradeitem'; } else { content = this.textUtils.replaceNewLines(content, '
'); @@ -439,9 +439,17 @@ export class CoreGradesHelperProvider { row['image'] = this.courseProvider.getModuleIconSrc(module[1], this.domUtils.convertToElement(text).querySelector('img').getAttribute('src')); } - } else if (text.indexOf('src=') > -1) { - const src = text.match(/src="([^"]*)"/); - row['image'] = src[1]; + } else { + if (row['rowspan']) { + row['itemtype'] = 'category'; + row['icon'] = 'fa-folder'; + } else if (text.indexOf('src=') > -1) { + const src = text.match(/src="([^"]*)"/); + row['image'] = src[1]; + } else if (text.indexOf(' -1) { + const src = text.match(/class="fa-([^ ]*)"/); + row['icon'] = src[1]; + } } return row;