forked from moodlehq/moodleapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MOBILE-4653 html: Adapt new control flow on core components
Some changes left untouched because in implies type checking
- Loading branch information
1 parent
66a281f
commit 5dc6ae4
Showing
37 changed files
with
765 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
<ion-item class="ion-text-wrap"> | ||
<ion-label> | ||
<p *ngIf="html" [innerHTML]="content"></p> | ||
<p *ngIf="!html">{{content}}</p> | ||
@if (html) { | ||
<p [innerHTML]="content"></p> | ||
} @else { | ||
<p>{{content}}</p> | ||
} | ||
</ion-label> | ||
</ion-item> |
13 changes: 7 additions & 6 deletions
13
src/core/components/button-with-spinner/core-button-with-spinner.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<div *ngIf="!loading" @coreShowHideAnimation> | ||
<ng-content /> | ||
</div> | ||
|
||
<!-- Spinner. --> | ||
<ion-spinner *ngIf="loading" @coreShowHideAnimation [attr.aria-label]="loadingLabel | translate" /> | ||
@if (loading) { | ||
<ion-spinner @coreShowHideAnimation [attr.aria-label]="loadingLabel | translate" /> | ||
} @else { | ||
<div @coreShowHideAnimation> | ||
<ng-content /> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
<canvas #canvas [attr.height]="height"></canvas> | ||
|
||
<ion-list *ngIf="chart"> | ||
<ion-item *ngFor="let data of legendItems"> | ||
<ion-icon name="fas-square" slot="start" [style.color]="data.fillStyle" aria-hidden="true" /> | ||
<ion-label>{{data.text}}</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
@if (chart) { | ||
<ion-list> | ||
@for (data of legendItems; track data.text) { | ||
<ion-item> | ||
<ion-icon name="fas-square" slot="start" [style.color]="data.fillStyle" aria-hidden="true" /> | ||
<ion-label>{{data.text}}</ion-label> | ||
</ion-item> | ||
} | ||
</ion-list> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
<ion-select *ngIf="interface !== 'modal'" class="ion-text-start" [(ngModel)]="selection" (ngModelChange)="onValueChanged(selection)" | ||
interface="popover" [disabled]="disabled" [class.combobox-icon-only]="icon" | ||
[interfaceOptions]="{alignment: 'start', arrow: false, cssClass: 'core-combobox-select'}"> | ||
<div slot="label"> | ||
<span class="sr-only" *ngIf="label">{{ label }}</span> | ||
<ion-icon *ngIf="icon" [name]="icon" aria-hidden="true" /> | ||
</div> | ||
@if (interface !== 'modal') { | ||
<ion-select class="ion-text-start" [(ngModel)]="selection" (ngModelChange)="onValueChanged(selection)" interface="popover" | ||
[disabled]="disabled" [class.combobox-icon-only]="icon" | ||
[interfaceOptions]="{alignment: 'start', arrow: false, cssClass: 'core-combobox-select'}"> | ||
<div slot="label"> | ||
@if (label) { | ||
<span class="sr-only">{{ label }}</span> | ||
} | ||
@if (icon) { | ||
<ion-icon [name]="icon" aria-hidden="true" /> | ||
} | ||
</div> | ||
|
||
<ng-content /> | ||
</ion-select> | ||
<ng-content /> | ||
</ion-select> | ||
} @else { | ||
<ion-button aria-haspopup="listbox" [attr.aria-controls]="listboxId" [attr.aria-owns]="listboxId" [attr.aria-expanded]="expanded" | ||
(click)="openModal()" [disabled]="disabled" expand="block" role="combobox"> | ||
@if (icon) { | ||
<ion-icon [name]="icon" slot="start" aria-hidden="true" /> | ||
} | ||
|
||
<ion-button *ngIf="interface === 'modal'" aria-haspopup="listbox" [attr.aria-controls]="listboxId" [attr.aria-owns]="listboxId" | ||
[attr.aria-expanded]="expanded" (click)="openModal()" [disabled]="disabled" expand="block" role="combobox"> | ||
<ion-icon *ngIf="icon" [name]="icon" slot="start" aria-hidden="true" /> | ||
@if (label) { | ||
<span class="sr-only">{{ label }},</span> | ||
} | ||
<div class="select-text"> | ||
<slot name="text"><core-format-text [text]="selection" /></slot> | ||
</div> | ||
|
||
<span class="sr-only" *ngIf="label">{{ label }},</span> | ||
<div class="select-text"> | ||
<slot name="text"><core-format-text [text]="selection" /></slot> | ||
</div> | ||
|
||
<div class="select-icon" role="presentation" aria-hidden="true" slot="end"> | ||
<div class="select-icon-inner"></div> | ||
</div> | ||
</ion-button> | ||
<div class="select-icon" role="presentation" aria-hidden="true" slot="end"> | ||
<div class="select-icon-inner"></div> | ||
</div> | ||
</ion-button> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 34 additions & 24 deletions
58
src/core/components/context-menu/core-context-menu-popover.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
<ion-content> | ||
<ion-list [id]="uniqueId" role="menu"> | ||
<ion-item class="ion-text-wrap" lines="none" *ngFor="let item of items" core-link [capture]="item.captureLink" | ||
[autoLogin]="item.autoLogin" [href]="item.href" (click)="itemClicked($event, item)" [attr.aria-label]="item.ariaAction" | ||
[hidden]="item.hidden" [detail]="!!(item.href && !item.iconAction)" role="menuitem" [button]="!!(item.href && !item.iconAction)" | ||
[showBrowserWarning]="item.showBrowserWarning"> | ||
<ion-toggle *ngIf="item.iconAction === 'toggle'" [(ngModel)]="item.toggle" (ionChange)="item.toggleChanged($event)"> | ||
<p class="item-heading">{{ item.content }}</p> | ||
</ion-toggle> | ||
<ng-container *ngIf="item.iconAction !== 'toggle'"> | ||
<ion-label> | ||
<p class="item-heading">{{ item.content }}</p> | ||
</ion-label> | ||
<ng-container *ngIf="(item.href || item.action) && item.iconAction"> | ||
<ion-icon *ngIf="item.iconAction !== 'spinner'" [name]="item.iconAction" [class.icon-slash]="item.iconSlash" slot="end" | ||
aria-hidden="true" /> | ||
<ion-spinner *ngIf="item.iconAction === 'spinner'" slot="end" [attr.aria-label]="'core.loading' | translate" /> | ||
</ng-container> | ||
</ng-container> | ||
<ion-badge class="{{item.badgeClass}}" slot="end" *ngIf="item.badge"> | ||
<span [attr.ara-hidden]="!!item.badgeA11yText">{{item.badge}}</span> | ||
<span class="sr-only" *ngIf="item.badgeA11yText"> | ||
{{ item.badgeA11yText | translate: {$a : item.badge } }} | ||
</span> | ||
</ion-badge> | ||
</ion-item> | ||
@for (item of items; track item.uniqueId) { | ||
<ion-item class="ion-text-wrap" lines="none" core-link [capture]="item.captureLink" [autoLogin]="item.autoLogin" | ||
[href]="item.href" (click)="itemClicked($event, item)" [attr.aria-label]="item.ariaAction" [hidden]="item.hidden" | ||
[detail]="!!(item.href && !item.iconAction)" role="menuitem" [button]="!!(item.href && !item.iconAction)" | ||
[showBrowserWarning]="item.showBrowserWarning"> | ||
@if (item.iconAction === 'toggle') { | ||
<ion-toggle [(ngModel)]="item.toggle" (ionChange)="item.toggleChanged($event)"> | ||
<p class="item-heading">{{ item.content }}</p> | ||
</ion-toggle> | ||
} @else { | ||
<ion-label> | ||
<p class="item-heading">{{ item.content }}</p> | ||
</ion-label> | ||
@if ((item.href || item.action) && item.iconAction) { | ||
@if (item.iconAction === 'spinner') { | ||
<ion-spinner slot="end" [attr.aria-label]="'core.loading' | translate" /> | ||
} @else { | ||
<ion-icon [name]="item.iconAction" [class.icon-slash]="item.iconSlash" slot="end" aria-hidden="true" /> | ||
} | ||
} | ||
} | ||
|
||
@if (item.badge) { | ||
<ion-badge class="{{item.badgeClass}}" slot="end"> | ||
<span [attr.ara-hidden]="!!item.badgeA11yText">{{item.badge}}</span> | ||
@if (item.badgeA11yText) { | ||
<span class="sr-only"> | ||
{{ item.badgeA11yText | translate: {$a : item.badge } }} | ||
</span> | ||
} | ||
</ion-badge> | ||
} | ||
</ion-item> | ||
} | ||
</ion-list> | ||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<ion-icon *ngIf="!course().courseimage" name="fas-graduation-cap" slot="start" aria-hidden="true" /> | ||
<ion-avatar *ngIf="course().courseimage" slot="start"> | ||
<img [url]="course().courseimage" core-external-content alt="" (error)="loadFallbackCourseIcon()" /> | ||
</ion-avatar> | ||
@if (course().courseimage) { | ||
<ion-avatar slot="start"> | ||
<img [url]="course().courseimage" core-external-content alt="" (error)="loadFallbackCourseIcon()" /> | ||
</ion-avatar> | ||
} @else { | ||
<ion-icon name="fas-graduation-cap" slot="start" aria-hidden="true" /> | ||
} |
42 changes: 25 additions & 17 deletions
42
src/core/components/download-refresh/core-download-refresh.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
<ng-container *ngIf="enabled && !loading"> | ||
@if (enabled && !loading) { | ||
|
||
<!-- Download button. --> | ||
<ion-button *ngIf="status === statusNotDownloaded" fill="clear" (click)="download($event, false)" @coreShowHideAnimation | ||
[ariaLabel]="(statusTranslatable || translates.notdownloaded) | translate: { name : statusSubject }"> | ||
<ion-icon slot="icon-only" name="fas-cloud-arrow-down" aria-hidden="true" /> | ||
</ion-button> | ||
@if (status === statusNotDownloaded) { | ||
<ion-button fill="clear" (click)="download($event, false)" @coreShowHideAnimation | ||
[ariaLabel]="(statusTranslatable || translates.notdownloaded) | translate: { name : statusSubject }"> | ||
<ion-icon slot="icon-only" name="fas-cloud-arrow-down" aria-hidden="true" /> | ||
</ion-button> | ||
} | ||
|
||
<!-- Refresh button. --> | ||
<ion-button *ngIf="status === statusOutdated || (status === statusDownloaded && !canTrustDownload)" fill="clear" | ||
(click)="download($event, true)" @coreShowHideAnimation | ||
[ariaLabel]="(statusTranslatable || translates.outdated) | translate: { name : statusSubject }"> | ||
<ion-icon slot="icon-only" name="fam-cloud-refresh" aria-hidden="true" /> | ||
</ion-button> | ||
@if (status === statusOutdated || (status === statusDownloaded && !canTrustDownload)) { | ||
<ion-button fill="clear" (click)="download($event, true)" @coreShowHideAnimation | ||
[ariaLabel]="(statusTranslatable || translates.outdated) | translate: { name : statusSubject }"> | ||
<ion-icon slot="icon-only" name="fam-cloud-refresh" aria-hidden="true" /> | ||
</ion-button> | ||
} | ||
|
||
<!-- Downloaded status icon. --> | ||
<ion-icon *ngIf="status === statusDownloaded && canTrustDownload" class="core-icon-downloaded ion-padding-horizontal" color="success" | ||
name="fam-cloud-done" [attr.aria-label]="(statusTranslatable || translates.downloaded) | translate: { name : statusSubject }" | ||
role="status" /> | ||
@if (status === statusDownloaded && canTrustDownload) { | ||
<ion-icon class="core-icon-downloaded ion-padding-horizontal" color="success" name="fam-cloud-done" | ||
[attr.aria-label]="(statusTranslatable || translates.downloaded) | translate: { name : statusSubject }" role="status" /> | ||
} @else if (status === statusDownloading) { | ||
<ion-spinner @coreShowHideAnimation | ||
[attr.aria-label]="(statusTranslatable || translates.downloading) | translate: { name : statusSubject }" /> | ||
} | ||
|
||
<ion-spinner *ngIf="status === statusDownloading" @coreShowHideAnimation | ||
[attr.aria-label]="(statusTranslatable || translates.downloading) | translate: { name : statusSubject }" /> | ||
</ng-container> | ||
} | ||
|
||
<!-- Spinner. --> | ||
<ion-spinner *ngIf="loading" @coreShowHideAnimation [attr.aria-label]="translates.loading | translate: { name : statusSubject }" /> | ||
@if (loading) { | ||
<ion-spinner @coreShowHideAnimation [attr.aria-label]="translates.loading | translate: { name : statusSubject }" /> | ||
} |
4 changes: 3 additions & 1 deletion
4
src/core/components/dynamic-component/core-dynamic-component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<!-- Content to display if no dynamic component. --> | ||
<ng-content *ngIf="!instance" /> | ||
@if (!instance) { | ||
<ng-content /> | ||
} | ||
|
||
<!-- Container of the dynamic component --> | ||
<ng-container #dynamicComponent /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.