Skip to content

Commit

Permalink
MOBILE-4736 icons: Update icons due to MDL-83639
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Jan 15, 2025
1 parent 917e6fc commit 043df3f
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/addons/mod/scorm/services/scorm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const STATUSES = {
};
const STATUS_TO_ICON = {
asset: '', // Empty to show an space.
browsed: 'fas-book',
browsed: 'moodle-browsed',
completed: 'fas-check',
failed: 'fas-xmark',
incomplete: 'fas-pen-to-square',
Expand Down
2 changes: 1 addition & 1 deletion src/addons/qtype/ordering/component/ordering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class AddonQtypeOrderingComponent extends CoreQuestionBaseComponent<Addon
const itemContentEl = element.querySelector<HTMLElement>('[data-itemcontent]');
itemContentEl?.querySelector(
'.icon.fa-check, .icon.fa-remove, .icon.fa-check-square, .icon.fa-circle-check, .icon.fa-xmark, ' +
'.icon.fa-circle-xmark, .icon.fa-square-check, .icon.circle-half-stroke',
'.icon.fa-circle-xmark, .icon.fa-square-check, .icon.circle-half-stroke, img.icon[src*="grade_partiallycorrect"]',
)?.remove();

return {
Expand Down

This file was deleted.

4 changes: 4 additions & 0 deletions src/assets/fonts/moodle/moodle/browsed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/fonts/moodle/moodle/grade-partiallycorrect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/fonts/moodle/moodle/item.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/fonts/moodle/moodle/level.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/core/features/policy/pages/acceptances/acceptances.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ <h1>{{ 'core.policy.policiesagreements' | translate }}</h1>
<ng-template #policyTabletTemplate let-policy="policy" let-isPreviousVersion="isPreviousVersion">
<tr [class.core-policy-previous-version]="isPreviousVersion">
<td class="core-policy-title">
<ion-icon *ngIf="isPreviousVersion" name="fam-arrow-turn-down-right" aria-hidden="true" />
<ion-icon *ngIf="isPreviousVersion" name="moodle-level" aria-hidden="true" />
<ion-icon *ngIf="!isPreviousVersion && policy.previousVersions.length" name="fas-chevron-right" flip-rtl
(ariaButtonClick)="toggle($event, policy)" class="expandable-status-icon"
[class.expandable-status-icon-expanded]="policy.expanded" [attr.aria-expanded]="policy.expanded"
[attr.aria-label]="(policy.expanded ? 'core.collapse' : 'core.expand') | translate" />
<ion-icon *ngIf="!isPreviousVersion && !policy.previousVersions.length" name="fas-circle" color="secondary"
<ion-icon *ngIf="!isPreviousVersion && !policy.previousVersions.length" name="moodle-item" color="secondary"
class="core-policy-icon-bullet" aria-hidden="true" />

<a href="#" (click)="viewFullPolicy($event, policy)">{{ policy.name }}</a>
Expand Down Expand Up @@ -180,7 +180,7 @@ <h1>{{ 'core.policy.policiesagreements' | translate }}</h1>
<ng-template #policyMobileTemplate let-policy="policy" let-isPreviousVersion="isPreviousVersion">
<ion-item class="ion-text-wrap core-policy-title">
<div slot="start">
<ion-icon *ngIf="isPreviousVersion" name="fam-arrow-turn-down-right" aria-hidden="true" />
<ion-icon *ngIf="isPreviousVersion" name="moodle-level" aria-hidden="true" />
<ion-icon name="fas-chevron-right" flip-rtl (ariaButtonClick)="toggle($event, policy)" class="expandable-status-icon"
[class.expandable-status-icon-expanded]="policy.expanded" [attr.aria-expanded]="policy.expanded"
[attr.aria-label]="(policy.expanded ? 'core.collapse' : 'core.expand') | translate"
Expand Down
5 changes: 0 additions & 5 deletions src/core/features/policy/pages/acceptances/acceptances.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@
font-size: 1.125rem;
padding: 13px;
margin: 3px;

&.core-policy-icon-bullet {
font-size: #{dynamic-font(6px)};
width: 18px;
}
}

}
Expand Down
2 changes: 2 additions & 0 deletions src/core/features/question/question.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,7 @@
.questioncorrectnessicon,
.fa.icon.questioncorrectnessicon {
font-size: var(--mdl-typography-icon-fontSize-md);
vertical-align: middle;
margin: 4px;
}
}
28 changes: 23 additions & 5 deletions src/core/features/question/services/question-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,13 +810,15 @@ export class CoreQuestionHelperProvider {
getCorrectIcon(): IconData {
if (CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('4.5')) {
return {
font: 'font-awesome',
name: 'circle-check',
prefix: 'far',
library: 'regular',
fullName: 'far-circle-check',
};
} else {
return {
font: 'font-awesome',
name: 'check',
prefix: 'fas',
library: 'solid',
Expand All @@ -833,13 +835,15 @@ export class CoreQuestionHelperProvider {
getIncorrectIcon(): IconData {
if (CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('4.5')) {
return {
font: 'font-awesome',
name: 'circle-xmark',
prefix: 'far',
library: 'regular',
fullName: 'far-circle-xmark',
};
} else {
return {
font: 'font-awesome',
name: 'xmark',
prefix: 'fas',
library: 'solid',
Expand All @@ -855,15 +859,25 @@ export class CoreQuestionHelperProvider {
* @returns Icon data.
*/
getPartiallyCorrectIcon(): IconData {
if (CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('4.5')) {
if (CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('5.0')) {
return {
font: 'moodle',
name: 'grade-partiallycorrect',
prefix: 'moodle',
library: 'moodle',
fullName: 'moodle-grade-partiallycorrect',
};
} else if (CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('4.5')) {
return {
font: 'font-awesome',
name: 'circle-half-stroke',
prefix: 'fas',
library: 'solid',
fullName: 'fas-circle-half-stroke',
};
} else {
return {
font: 'font-awesome',
name: 'square-check',
prefix: 'fas',
library: 'solid',
Expand All @@ -887,12 +901,15 @@ export class CoreQuestionHelperProvider {
const incorrectIcon = this.getIncorrectIcon();
const partiallyCorrectIcon = this.getPartiallyCorrectIcon();
if ('src' in icon) {
if ((icon as HTMLImageElement).src.indexOf('correct') >= 0) {
iconData = correctIcon;
color = CoreIonicColorNames.SUCCESS;
if ((icon as HTMLImageElement).src.indexOf('grade_partiallycorrect') >= 0) {
iconData = partiallyCorrectIcon;
color = CoreIonicColorNames.WARNING;
} else if ((icon as HTMLImageElement).src.indexOf('incorrect') >= 0 ) {
iconData = incorrectIcon;
color = CoreIonicColorNames.DANGER;
} else if((icon as HTMLImageElement).src.indexOf('correct') >= 0) {
iconData = correctIcon;
color = CoreIonicColorNames.SUCCESS;
}
} else {
if (icon.classList.contains(`fa-${partiallyCorrectIcon.name}`)) {
Expand All @@ -915,7 +932,7 @@ export class CoreQuestionHelperProvider {
const newIcon: HTMLIonIconElement = document.createElement('ion-icon');

newIcon.setAttribute('name', iconData.fullName);
newIcon.setAttribute('src', CoreIcons.getIconSrc('font-awesome', iconData.library, iconData.name));
newIcon.setAttribute('src', CoreIcons.getIconSrc(iconData.font, iconData.library, iconData.name));
newIcon.className = `core-correct-icon ion-color ion-color-${color} questioncorrectnessicon`;
newIcon.title = icon.title;
newIcon.setAttribute('aria-label', icon.title);
Expand Down Expand Up @@ -1051,6 +1068,7 @@ export type CoreQuestionBehaviourCertaintyOption = CoreQuestionBehaviourButton &
*/
type IconData = {
name: string;
font: string;
prefix: string;
library: string;
fullName: string;
Expand Down

0 comments on commit 043df3f

Please sign in to comment.