commit
4d152f93c1
14
.eslintrc.js
14
.eslintrc.js
|
@ -103,12 +103,22 @@ const appConfig = {
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
selector: 'property',
|
selector: 'property',
|
||||||
modifiers: ['readonly'],
|
format: ['camelCase'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
selector: 'property',
|
||||||
|
modifiers: ['public', 'readonly'],
|
||||||
format: ['UPPER_CASE'],
|
format: ['UPPER_CASE'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
selector: 'property',
|
selector: 'property',
|
||||||
format: ['camelCase'],
|
modifiers: ['protected', 'readonly'],
|
||||||
|
format: ['UPPER_CASE'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
selector: 'property',
|
||||||
|
modifiers: ['private', 'readonly'],
|
||||||
|
format: ['UPPER_CASE'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
selector: 'property',
|
selector: 'property',
|
||||||
|
|
|
@ -50,6 +50,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
|
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
|
||||||
cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php
|
cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php
|
||||||
|
sed -i "61i\$CFG->behat_increasetimeout = 2;" $GITHUB_WORKSPACE/moodle/config.php
|
||||||
sed -i "61i\$CFG->behat_ionic_wwwroot = 'http://moodleapp';" $GITHUB_WORKSPACE/moodle/config.php
|
sed -i "61i\$CFG->behat_ionic_wwwroot = 'http://moodleapp';" $GITHUB_WORKSPACE/moodle/config.php
|
||||||
echo "define('TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER', 'http://bbbmockserver/hash' . sha1(\$CFG->behat_wwwroot));" >> $GITHUB_WORKSPACE/moodle/config.php
|
echo "define('TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER', 'http://bbbmockserver/hash' . sha1(\$CFG->behat_wwwroot));" >> $GITHUB_WORKSPACE/moodle/config.php
|
||||||
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull
|
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull
|
||||||
|
|
|
@ -30,6 +30,11 @@ import { CoreConstants } from '@/core/constants';
|
||||||
})
|
})
|
||||||
export class CoreFaIconDirective implements AfterViewInit, OnChanges {
|
export class CoreFaIconDirective implements AfterViewInit, OnChanges {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object used to store whether icons exist or not during development.
|
||||||
|
*/
|
||||||
|
private static readonly DEV_ICONS_STATUS: Record<string, Promise<boolean>> = {};
|
||||||
|
|
||||||
@Input() name = '';
|
@Input() name = '';
|
||||||
|
|
||||||
protected element: HTMLElement;
|
protected element: HTMLElement;
|
||||||
|
@ -89,14 +94,7 @@ export class CoreFaIconDirective implements AfterViewInit, OnChanges {
|
||||||
const src = `assets/fonts/${font}/${library}/${iconName}.svg`;
|
const src = `assets/fonts/${font}/${library}/${iconName}.svg`;
|
||||||
this.element.setAttribute('src', src);
|
this.element.setAttribute('src', src);
|
||||||
this.element.classList.add('faicon');
|
this.element.classList.add('faicon');
|
||||||
|
this.validateIcon(this.name, src);
|
||||||
if (CoreConstants.BUILD.isDevelopment || CoreConstants.BUILD.isTesting) {
|
|
||||||
try {
|
|
||||||
await Http.get(src, { responseType: 'text' }).toPromise();
|
|
||||||
} catch (error) {
|
|
||||||
this.logger.error(`Icon ${this.name} not found`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,4 +121,32 @@ export class CoreFaIconDirective implements AfterViewInit, OnChanges {
|
||||||
this.setIcon();
|
this.setIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate that an icon exists, or show warning otherwise (only in development and testing environments).
|
||||||
|
*
|
||||||
|
* @param name Icon name.
|
||||||
|
* @param src Icon source url.
|
||||||
|
*/
|
||||||
|
private validateIcon(name: string, src: string): void {
|
||||||
|
if (!CoreConstants.BUILD.isDevelopment && !CoreConstants.BUILD.isTesting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(src in CoreFaIconDirective.DEV_ICONS_STATUS)) {
|
||||||
|
CoreFaIconDirective.DEV_ICONS_STATUS[src] = Http.get(src, { responseType: 'text' })
|
||||||
|
.toPromise()
|
||||||
|
.then(() => true)
|
||||||
|
.catch(() => false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line promise/catch-or-return
|
||||||
|
CoreFaIconDirective.DEV_ICONS_STATUS[src].then(exists => {
|
||||||
|
if (exists) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.logger.error(`Icon ${name} not found`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import { CoreNavigator } from '@services/navigator';
|
||||||
import { makeSingleton, Translate } from '@singletons';
|
import { makeSingleton, Translate } from '@singletons';
|
||||||
import { CoreError } from '@classes/errors/error';
|
import { CoreError } from '@classes/errors/error';
|
||||||
import { CoreCourseHelper } from '@features/course/services/course-helper';
|
import { CoreCourseHelper } from '@features/course/services/course-helper';
|
||||||
|
import { CoreAppProvider } from '@services/app';
|
||||||
|
|
||||||
export const GRADES_PAGE_NAME = 'grades';
|
export const GRADES_PAGE_NAME = 'grades';
|
||||||
|
|
||||||
|
@ -136,8 +137,15 @@ export class CoreGradesHelperProvider {
|
||||||
row.rowclass += itemNameColumn.class.indexOf('hidden') >= 0 ? ' hidden' : '';
|
row.rowclass += itemNameColumn.class.indexOf('hidden') >= 0 ? ' hidden' : '';
|
||||||
row.rowclass += itemNameColumn.class.indexOf('dimmed_text') >= 0 ? ' dimmed_text' : '';
|
row.rowclass += itemNameColumn.class.indexOf('dimmed_text') >= 0 ? ' dimmed_text' : '';
|
||||||
|
|
||||||
content = content.replace(/<\/span>/gi, '\n');
|
if (useLegacyLayout) {
|
||||||
content = CoreTextUtils.cleanTags(content, true);
|
content = content.replace(/<\/span>/gi, '\n');
|
||||||
|
content = CoreTextUtils.cleanTags(content);
|
||||||
|
} else {
|
||||||
|
// The activity type won't be included in the webservice response if behat is running.
|
||||||
|
content = CoreAppProvider.isAutomated() ? content : content.replace(/<span[^>]+>.+?<\/span>/gi, '');
|
||||||
|
content = CoreTextUtils.cleanTags(content, true);
|
||||||
|
}
|
||||||
|
|
||||||
name = 'gradeitem';
|
name = 'gradeitem';
|
||||||
} else if (name === 'grade') {
|
} else if (name === 'grade') {
|
||||||
// Add the pass/fail class if present.
|
// Add the pass/fail class if present.
|
||||||
|
|
Loading…
Reference in New Issue