Skip to content

Commit

Permalink
Merge pull request #4209 from crazyserver/MOBILE-4616
Browse files Browse the repository at this point in the history
MOBILE-4616 scorm: Update sco status icons to match LMS
  • Loading branch information
albertgasset authored Oct 15, 2024
2 parents f663b86 + c6f73af commit ce7243b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ <h3 class="item-heading">{{'core.grades.grades' | translate}}</h3>
<p>{{ currentOrganization.title }}</p>
<div *ngFor="let sco of toc" class="core-padding-{{sco.level}} addon-mod_scorm-type-{{sco.scormtype}}">
<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)">
<core-format-text [text]="sco.title" contextLevel="module" [contextInstanceId]="module.id"
[courseId]="courseId" />
Expand Down
12 changes: 2 additions & 10 deletions src/addons/mod/scorm/components/index/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
font-size: var(--text-size);
}

.addon-mod_scorm-toc {
// Hide all non sco icons using css to maintain padding.
ion-icon {
opacity: 0;
@include margin(5px, 8px, null, null);
}

.addon-mod_scorm-type-sco ion-icon {
opacity: 1
}
.addon-mod_scorm-toc ion-icon {
@include margin(4px, 8px, null, null);
}
}
5 changes: 5 additions & 0 deletions src/addons/mod/scorm/components/toc/toc.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use "theme/globals" as *;

.addon-mod_scorm-toc ion-icon {
@include margin(4px, 8px, null, null);
}
1 change: 1 addition & 0 deletions src/addons/mod/scorm/components/toc/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { CoreSharedModule } from '@/core/shared.module';
@Component({
selector: 'addon-mod-scorm-toc',
templateUrl: 'toc.html',
styleUrl: 'toc.scss',
standalone: true,
imports: [
CoreSharedModule,
Expand Down
18 changes: 6 additions & 12 deletions src/addons/mod/scorm/services/scorm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,14 @@ const STATUSES = {
'n': 'notattempted',
};
const STATUS_TO_ICON = {
assetc: 'far-file-zipper',
asset: 'far-file-zipper',
asset: '', // Empty to show an space.
browsed: 'fas-book',
completed: 'far-square-check',
completed: 'fas-check',
failed: 'fas-xmark',
incomplete: 'far-pen-to-square',
minus: 'fas-minus',
incomplete: 'fas-pen-to-square',
notattempted: 'far-square',
passed: 'fas-check',
plus: 'fas-plus',
popdown: 'far-rectangle-xmark',
popup: 'fas-window-restore',
passed: 'fas-check-double',
suspend: 'fas-pause',
wait: 'far-clock',
};

/**
Expand Down Expand Up @@ -1022,7 +1016,7 @@ export class AddonModScormProvider {

if (sco.isvisible) {
if (VALID_STATUSES.indexOf(status) >= 0) {
if (sco.scormtype == 'sco') {
if (sco.scormtype === 'sco') {
imageName = status;
descName = status;
} else {
Expand All @@ -1042,7 +1036,7 @@ export class AddonModScormProvider {
} else {
incomplete = true;

if (sco.scormtype == 'sco') {
if (sco.scormtype === 'sco') {
// Status empty or not valid, use 'notattempted'.
imageName = 'notattempted';
} else {
Expand Down
13 changes: 13 additions & 0 deletions src/core/features/reportbuilder/services/handlers/reportbuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
CoreUserProfileHandlerType,
CoreUserProfileHandler,
CoreUserProfileHandlerData,
CoreUserDelegateContext,
} from '@features/user/services/user-delegate';
import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons';
Expand All @@ -42,6 +43,18 @@ export class CoreReportBuilderHandlerService implements CoreUserProfileHandler {
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
*/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/theme/theme.base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ core-split-view.menu-and-content {
[aria-current="page"],
.item.item-current {
@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;
}
Expand Down Expand Up @@ -278,7 +280,7 @@ mark, .matchtext {
// Different levels of padding.
@for $i from 0 through 15 {
.core-padding-#{$i} {
@include padding(null, null, null, 15px * $i + 16px);
@include padding(null, null, null, 16px * $i);
}
}

Expand Down

0 comments on commit ce7243b

Please sign in to comment.