Merge pull request #4209 from crazyserver/MOBILE-4616

MOBILE-4616 scorm: Update sco status icons to match LMS
main
Albert Gasset 2024-10-15 13:53:32 +02:00 committed by GitHub
commit ce7243b1ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 31 additions and 24 deletions

View File

@ -140,7 +140,7 @@
<p>{{ currentOrganization.title }}</p> <p>{{ currentOrganization.title }}</p>
<div *ngFor="let sco of toc" class="core-padding-{{sco.level}} addon-mod_scorm-type-{{sco.scormtype}}"> <div *ngFor="let sco of toc" class="core-padding-{{sco.level}} addon-mod_scorm-type-{{sco.scormtype}}">
<p *ngIf="sco.isvisible"> <p *ngIf="sco.isvisible">
<ion-icon *ngIf="sco.icon" [name]="sco.icon.icon" [attr.aria-label]="sco.icon.description" slot="start" /> <ion-icon *ngIf="sco.icon" [name]="sco.icon.icon" [attr.aria-label]="sco.icon.description" />
<button class="as-link" *ngIf="sco.prereq && sco.launch" (click)="open($event, false, sco.id)"> <button class="as-link" *ngIf="sco.prereq && sco.launch" (click)="open($event, false, sco.id)">
<core-format-text [text]="sco.title" contextLevel="module" [contextInstanceId]="module.id" <core-format-text [text]="sco.title" contextLevel="module" [contextInstanceId]="module.id"
[courseId]="courseId" /> [courseId]="courseId" />

View File

@ -5,15 +5,7 @@
font-size: var(--text-size); font-size: var(--text-size);
} }
.addon-mod_scorm-toc { .addon-mod_scorm-toc ion-icon {
// Hide all non sco icons using css to maintain padding. @include margin(4px, 8px, null, null);
ion-icon {
opacity: 0;
@include margin(5px, 8px, null, null);
}
.addon-mod_scorm-type-sco ion-icon {
opacity: 1
}
} }
} }

View File

@ -0,0 +1,5 @@
@use "theme/globals" as *;
.addon-mod_scorm-toc ion-icon {
@include margin(4px, 8px, null, null);
}

View File

@ -25,6 +25,7 @@ import { CoreSharedModule } from '@/core/shared.module';
@Component({ @Component({
selector: 'addon-mod-scorm-toc', selector: 'addon-mod-scorm-toc',
templateUrl: 'toc.html', templateUrl: 'toc.html',
styleUrl: 'toc.scss',
standalone: true, standalone: true,
imports: [ imports: [
CoreSharedModule, CoreSharedModule,

View File

@ -63,20 +63,14 @@ const STATUSES = {
'n': 'notattempted', 'n': 'notattempted',
}; };
const STATUS_TO_ICON = { const STATUS_TO_ICON = {
assetc: 'far-file-zipper', asset: '', // Empty to show an space.
asset: 'far-file-zipper',
browsed: 'fas-book', browsed: 'fas-book',
completed: 'far-square-check', completed: 'fas-check',
failed: 'fas-xmark', failed: 'fas-xmark',
incomplete: 'far-pen-to-square', incomplete: 'fas-pen-to-square',
minus: 'fas-minus',
notattempted: 'far-square', notattempted: 'far-square',
passed: 'fas-check', passed: 'fas-check-double',
plus: 'fas-plus',
popdown: 'far-rectangle-xmark',
popup: 'fas-window-restore',
suspend: 'fas-pause', suspend: 'fas-pause',
wait: 'far-clock',
}; };
/** /**
@ -1022,7 +1016,7 @@ export class AddonModScormProvider {
if (sco.isvisible) { if (sco.isvisible) {
if (VALID_STATUSES.indexOf(status) >= 0) { if (VALID_STATUSES.indexOf(status) >= 0) {
if (sco.scormtype == 'sco') { if (sco.scormtype === 'sco') {
imageName = status; imageName = status;
descName = status; descName = status;
} else { } else {
@ -1042,7 +1036,7 @@ export class AddonModScormProvider {
} else { } else {
incomplete = true; incomplete = true;
if (sco.scormtype == 'sco') { if (sco.scormtype === 'sco') {
// Status empty or not valid, use 'notattempted'. // Status empty or not valid, use 'notattempted'.
imageName = 'notattempted'; imageName = 'notattempted';
} else { } else {

View File

@ -17,6 +17,7 @@ import {
CoreUserProfileHandlerType, CoreUserProfileHandlerType,
CoreUserProfileHandler, CoreUserProfileHandler,
CoreUserProfileHandlerData, CoreUserProfileHandlerData,
CoreUserDelegateContext,
} from '@features/user/services/user-delegate'; } from '@features/user/services/user-delegate';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
@ -42,6 +43,18 @@ export class CoreReportBuilderHandlerService implements CoreUserProfileHandler {
return await CoreReportBuilder.isEnabled(); return await CoreReportBuilder.isEnabled();
} }
/**
* @inheritdoc
*/
async isEnabledForContext(context: CoreUserDelegateContext): Promise<boolean> {
// Custom reports only available in user menu.
if (context !== CoreUserDelegateContext.USER_MENU) {
return false;
}
return this.isEnabled();
}
/** /**
* @inheritdoc * @inheritdoc
*/ */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -180,6 +180,8 @@ core-split-view.menu-and-content {
[aria-current="page"], [aria-current="page"],
.item.item-current { .item.item-current {
@include safe-area-border-start(var(--selected-item-border-width), solid, var(--selected-item-color)); @include safe-area-border-start(var(--selected-item-border-width), solid, var(--selected-item-color));
--padding-start: calc(16px - var(--selected-item-border-width));
> * { > * {
--ion-safe-area-left: 0px; --ion-safe-area-left: 0px;
} }
@ -278,7 +280,7 @@ mark, .matchtext {
// Different levels of padding. // Different levels of padding.
@for $i from 0 through 15 { @for $i from 0 through 15 {
.core-padding-#{$i} { .core-padding-#{$i} {
@include padding(null, null, null, 15px * $i + 16px); @include padding(null, null, null, 16px * $i);
} }
} }