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 text-wrap *ngIf="item.typ != 'pagebreak'" [color]="item.dependitem > 0 ? 'light' : ''">
<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>
<p *ngIf="item.submittedValue"><core-format-text [component]="component" [componentId]="componentId" [text]=" item.submittedValue"></core-format-text></p>
</ion-item>

View File

@ -30,7 +30,9 @@ import { CoreTextUtilsProvider } from '@providers/utils/text';
export class AddonModFeedbackAttemptPage {
protected feedbackId: number;
protected courseId: number;
feedback: any;
attempt: any;
items: any;
componentId: number;
@ -41,6 +43,7 @@ export class AddonModFeedbackAttemptPage {
protected domUtils: CoreDomUtilsProvider, protected feedbackHelper: AddonModFeedbackHelperProvider,
protected textUtils: CoreTextUtilsProvider) {
this.feedbackId = navParams.get('feedbackId') || 0;
this.courseId = navParams.get('courseId');
this.attempt = navParams.get('attempt') || false;
this.componentId = navParams.get('moduleId');
}
@ -58,7 +61,12 @@ export class AddonModFeedbackAttemptPage {
* @return {Promise<any>} Promise resolved when done.
*/
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.
this.items = items.items.map((item) => {
if (item.typ == 'label') {

View File

@ -16,7 +16,7 @@
<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-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>
</ion-label>
<div item-content class="addon-mod_feedback-form-content" *ngIf="item.template">

View File

@ -165,7 +165,8 @@ export class AddonModFeedbackRespondentsPage {
attemptId: attempt.id,
attempt: attempt,
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,
attempt: attempt,
attemptId: attempt.id,
feedbackId: module.instance
feedbackId: module.instance,
courseId: module.course
};
return this.linkHelper.goInSite(navCtrl, 'AddonModFeedbackAttemptPage', stateParams, siteId);