Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile 4406 - Hide download icon in resources type label #3778

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/addons/storagemanager/pages/course-storage/course-storage.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ <h1>{{ 'addon.storagemanager.coursedownloads' | translate }}</h1>

<ion-card class="wholecourse">
<ion-card-header>
<ion-card-title>{{ title }}</ion-card-title>
<ion-card-title>
<core-format-text [text]="title" contextLevel="course" [contextInstanceId]="courseId">
</core-format-text>
</ion-card-title>
<ion-item class="size ion-text-wrap ion-no-padding">
<ion-label>
<p class="item-heading ion-text-wrap">{{ 'addon.storagemanager.totaldownloads' | translate }}</p>
Expand Down Expand Up @@ -77,7 +80,7 @@ <h1>{{ 'addon.storagemanager.coursedownloads' | translate }}</h1>
</ion-label>
<div class="storage-buttons" slot="end"
*ngIf="(!section.calculatingSize && section.totalSize > 0) || downloadEnabled">
<div *ngIf="downloadEnabled" slot="end" class="core-button-spinner">
<div *ngIf="downloadEnabled && canDownloadSection(section)" slot="end" class="core-button-spinner">
<core-download-refresh *ngIf="!section.isDownloading && section.downloadStatus != statusDownloaded"
[status]="section.downloadStatus" [enabled]="true" (action)="prefecthSection(section)"
[loading]="section.isDownloading || section.isCalculating" [canTrustDownload]="true">
Expand Down Expand Up @@ -126,17 +129,18 @@ <h1>{{ 'addon.storagemanager.coursedownloads' | translate }}</h1>

<div class="storage-buttons" slot="end">
<core-download-refresh *ngIf="downloadEnabled && module.handlerData?.showDownloadButton &&
module.downloadStatus != statusDownloaded" [status]="module.downloadStatus" [enabled]="true"
[canTrustDownload]="true" [loading]="module.spinner || module.handlerData.spinner"
(action)="prefetchModule(module)">
module.downloadStatus != statusDownloaded && module.modname !== 'label'"
[status]="module.downloadStatus" [enabled]="true" [canTrustDownload]="true"
[loading]="module.spinner || module.handlerData.spinner" (action)="prefetchModule(module)">
</core-download-refresh>
<ion-button fill="clear" (click)="deleteForModule($event, module, section)"
*ngIf="!module.calculatingSize && module.totalSize > 0" color="danger">
<ion-icon name="fas-trash" slot="icon-only"
[attr.aria-label]="'addon.storagemanager.deletedatafrom' | translate: { name: module.name }">
</ion-icon>
</ion-button>
<p *ngIf="!downloadEnabled || !module.handlerData?.showDownloadButton" class="sr-only">
<p *ngIf="(!downloadEnabled || !module.handlerData?.showDownloadButton) && module.modname === 'label'"
class="sr-only">
{{ 'core.notdownloadable' | translate }}
</p>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/addons/storagemanager/pages/course-storage/course-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,16 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy {
}
}

/**
* Check if the provided section can be downloaded.
*
* @param section Section to check.
* @returns Can be downloaded or not.
*/
canDownloadSection(section: AddonStorageManagerCourseSection): boolean {
return section.modules.some(module => module.modname !== 'label');
}

/**
* Toggle expand status.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
</core-format-text>
<ion-icon name="fas-lock" *ngIf="module.visible === 0 || module.uservisible === false"
[attr.aria-label]="'core.restricted' | translate"></ion-icon>
<ion-icon *ngIf="prefetchStatusIcon$ | async as prefetchStatusIcon" [name]="prefetchStatusIcon" color="success"
[attr.aria-label]="((prefetchStatusText$ | async) || '') | translate"></ion-icon>
<ng-container *ngIf="module.modname !== 'label'">
<ion-icon *ngIf="prefetchStatusIcon$ | async as prefetchStatusIcon" [name]="prefetchStatusIcon" color="success"
[attr.aria-label]="((prefetchStatusText$ | async) || '') | translate">
</ion-icon>
</ng-container>
</p>

<div class="core-module-additional-info">
Expand Down
Loading