MOBILE-3149 choice: Collapse list of users in results
parent
56e0ab629b
commit
8d540e6010
|
@ -96,7 +96,11 @@
|
||||||
</ion-col>
|
</ion-col>
|
||||||
<ion-col *ngIf="choice.publish && results" size="12" size-lg="7">
|
<ion-col *ngIf="choice.publish && results" size="12" size-lg="7">
|
||||||
<ion-item-group *ngFor="let result of results">
|
<ion-item-group *ngFor="let result of results">
|
||||||
<ion-item-divider class="ion-text-wrap">
|
<ion-item [button]="result.numberofuser > 0" class="divider ion-text-wrap" (click)="toggle(result)"
|
||||||
|
[attr.aria-label]="(result.expanded ? 'core.collapse' : 'core.expand') | translate" detail="false">
|
||||||
|
<ion-icon [name]="result.numberofuser > 0 ? 'fas-chevron-right' : ''" flip-rtl slot="start" aria-hidden="true"
|
||||||
|
class="expandable-status-icon" [class.expandable-status-icon-expanded]="result.expanded">
|
||||||
|
</ion-icon>
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h3 class="item-heading">
|
<h3 class="item-heading">
|
||||||
<core-format-text [text]="result.text" contextLevel="module" [contextInstanceId]="module.id"
|
<core-format-text [text]="result.text" contextLevel="module" [contextInstanceId]="module.id"
|
||||||
|
@ -111,14 +115,16 @@
|
||||||
{{ 'addon.mod_choice.limita' | translate:{$a: result.maxanswer} }}
|
{{ 'addon.mod_choice.limita' | translate:{$a: result.maxanswer} }}
|
||||||
</p>
|
</p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item-divider>
|
|
||||||
<ion-item *ngFor="let user of result.userresponses" core-user-link [courseId]="courseId" [userId]="user.userid"
|
|
||||||
[attr.aria-label]="user.fullname" class="ion-text-wrap">
|
|
||||||
<core-user-avatar [user]="user" slot="start" [courseId]="courseId"></core-user-avatar>
|
|
||||||
<ion-label>
|
|
||||||
<p>{{user.fullname}}</p>
|
|
||||||
</ion-label>
|
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
<ng-container *ngIf="result.expanded">
|
||||||
|
<ion-item *ngFor="let user of result.userresponses" core-user-link [courseId]="courseId" [userId]="user.userid"
|
||||||
|
[attr.aria-label]="user.fullname" class="ion-text-wrap">
|
||||||
|
<core-user-avatar [user]="user" slot="start" [courseId]="courseId"></core-user-avatar>
|
||||||
|
<ion-label>
|
||||||
|
<p>{{user.fullname}}</p>
|
||||||
|
</ion-label>
|
||||||
|
</ion-item>
|
||||||
|
</ng-container>
|
||||||
</ion-item-group>
|
</ion-item-group>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|
|
@ -446,6 +446,15 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle list of users in a result visible.
|
||||||
|
*
|
||||||
|
* @param result Result to expand.
|
||||||
|
*/
|
||||||
|
toggle(result: AddonModChoiceResultFormatted): void {
|
||||||
|
result.expanded = !result.expanded;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the sync of the activity.
|
* Performs the sync of the activity.
|
||||||
*
|
*
|
||||||
|
@ -472,4 +481,5 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
*/
|
*/
|
||||||
export type AddonModChoiceResultFormatted = AddonModChoiceResult & {
|
export type AddonModChoiceResultFormatted = AddonModChoiceResult & {
|
||||||
percentageamountfixed: string; // Percentage of users answers with fixed decimals.
|
percentageamountfixed: string; // Percentage of users answers with fixed decimals.
|
||||||
|
expanded?: boolean;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue