MOBILE-2503 feedback: Don't show question numbers if no autonumber

main
Dani Palou 2018-08-03 08:08:22 +02:00
parent e6c5607463
commit c2c606b629
5 changed files with 15 additions and 5 deletions

View File

@ -23,7 +23,7 @@
<ion-item-divider *ngIf="item.typ == 'pagebreak'" color="light"></ion-item-divider> <ion-item-divider *ngIf="item.typ == 'pagebreak'" color="light"></ion-item-divider>
<ion-item text-wrap *ngIf="item.typ != 'pagebreak'" [color]="item.dependitem > 0 ? 'light' : ''"> <ion-item text-wrap *ngIf="item.typ != 'pagebreak'" [color]="item.dependitem > 0 ? 'light' : ''">
<h2 *ngIf="item.name" [core-mark-required]="item.required"> <h2 *ngIf="item.name" [core-mark-required]="item.required">
<span *ngIf="item.itemnumber">{{item.itemnumber}}. </span><core-format-text [component]="component" [componentId]="componentId" [text]="item.name"></core-format-text> <span *ngIf="feedback.autonumbering && item.itemnumber">{{item.itemnumber}}. </span><core-format-text [component]="component" [componentId]="componentId" [text]="item.name"></core-format-text>
</h2> </h2>
<p *ngIf="item.submittedValue"><core-format-text [component]="component" [componentId]="componentId" [text]=" item.submittedValue"></core-format-text></p> <p *ngIf="item.submittedValue"><core-format-text [component]="component" [componentId]="componentId" [text]=" item.submittedValue"></core-format-text></p>
</ion-item> </ion-item>

View File

@ -30,7 +30,9 @@ import { CoreTextUtilsProvider } from '@providers/utils/text';
export class AddonModFeedbackAttemptPage { export class AddonModFeedbackAttemptPage {
protected feedbackId: number; protected feedbackId: number;
protected courseId: number;
feedback: any;
attempt: any; attempt: any;
items: any; items: any;
componentId: number; componentId: number;
@ -41,6 +43,7 @@ export class AddonModFeedbackAttemptPage {
protected domUtils: CoreDomUtilsProvider, protected feedbackHelper: AddonModFeedbackHelperProvider, protected domUtils: CoreDomUtilsProvider, protected feedbackHelper: AddonModFeedbackHelperProvider,
protected textUtils: CoreTextUtilsProvider) { protected textUtils: CoreTextUtilsProvider) {
this.feedbackId = navParams.get('feedbackId') || 0; this.feedbackId = navParams.get('feedbackId') || 0;
this.courseId = navParams.get('courseId');
this.attempt = navParams.get('attempt') || false; this.attempt = navParams.get('attempt') || false;
this.componentId = navParams.get('moduleId'); this.componentId = navParams.get('moduleId');
} }
@ -58,7 +61,12 @@ export class AddonModFeedbackAttemptPage {
* @return {Promise<any>} Promise resolved when done. * @return {Promise<any>} Promise resolved when done.
*/ */
fetchData(): Promise<any> { fetchData(): Promise<any> {
return this.feedbackProvider.getItems(this.feedbackId).then((items) => { // Get the feedback to be able to now if questions should be autonumbered.
return this.feedbackProvider.getFeedbackById(this.courseId, this.feedbackId).then((feedback) => {
this.feedback = feedback;
return this.feedbackProvider.getItems(this.feedbackId);
}).then((items) => {
// Add responses and format items. // Add responses and format items.
this.items = items.items.map((item) => { this.items = items.items.map((item) => {
if (item.typ == 'label') { if (item.typ == 'label') {

View File

@ -16,7 +16,7 @@
<ion-item-divider *ngIf="item.typ == 'pagebreak'" color="light"></ion-item-divider> <ion-item-divider *ngIf="item.typ == 'pagebreak'" color="light"></ion-item-divider>
<ion-item text-wrap *ngIf="item.typ != 'pagebreak'" [color]="item.dependitem > 0 ? 'light' : ''" [class.core-danger-item]="item.isEmpty || item.hasError"> <ion-item text-wrap *ngIf="item.typ != 'pagebreak'" [color]="item.dependitem > 0 ? 'light' : ''" [class.core-danger-item]="item.isEmpty || item.hasError">
<ion-label *ngIf="item.name" [core-mark-required]="item.required" stacked> <ion-label *ngIf="item.name" [core-mark-required]="item.required" stacked>
<span *ngIf="item.itemnumber">{{item.itemnumber}}. </span> <span *ngIf="feedback.autonumbering && item.itemnumber">{{item.itemnumber}}. </span>
<core-format-text [component]="component" [componentId]="componentId" [text]="item.name"></core-format-text> <core-format-text [component]="component" [componentId]="componentId" [text]="item.name"></core-format-text>
</ion-label> </ion-label>
<div item-content class="addon-mod_feedback-form-content" *ngIf="item.template"> <div item-content class="addon-mod_feedback-form-content" *ngIf="item.template">

View File

@ -165,7 +165,8 @@ export class AddonModFeedbackRespondentsPage {
attemptId: attempt.id, attemptId: attempt.id,
attempt: attempt, attempt: attempt,
feedbackId: this.feedbackId, feedbackId: this.feedbackId,
moduleId: this.moduleId moduleId: this.moduleId,
courseId: this.courseId
}); });
} }

View File

@ -70,7 +70,8 @@ export class AddonModFeedbackShowEntriesLinkHandler extends CoreContentLinksHand
moduleId: module.id, moduleId: module.id,
attempt: attempt, attempt: attempt,
attemptId: attempt.id, attemptId: attempt.id,
feedbackId: module.instance feedbackId: module.instance,
courseId: module.course
}; };
return this.linkHelper.goInSite(navCtrl, 'AddonModFeedbackAttemptPage', stateParams, siteId); return this.linkHelper.goInSite(navCtrl, 'AddonModFeedbackAttemptPage', stateParams, siteId);