MOBILE-3213 workshop: Dimme submit task when not possible
parent
b74381c626
commit
34b6ab1fe1
|
@ -18,14 +18,14 @@
|
|||
<h2 stacked text-wrap>{{ phases[workshop.phase].title }}</h2>
|
||||
</a>
|
||||
<ng-container *ngIf="phases && phases[workshop.phase] && phases[workshop.phase].tasks && phases[workshop.phase].tasks.length">
|
||||
<a ion-item text-wrap *ngFor="let task of phases[workshop.phase].tasks" (click)="runTask(task)" detail-none>
|
||||
<a ion-item text-wrap *ngFor="let task of phases[workshop.phase].tasks" [class.item-dimmed]="task.code == 'submit' && !showSubmit" (click)="runTask(task)" detail-none>
|
||||
<ion-icon item-start name="radio-button-off" *ngIf="task.completed == null"></ion-icon>
|
||||
<ion-icon item-start name="close-circle" color="danger" *ngIf="task.completed == ''"></ion-icon>
|
||||
<ion-icon item-start name="information-circle" color="info" *ngIf="task.completed == 'info'"></ion-icon>
|
||||
<ion-icon item-start name="checkmark-circle" color="success" *ngIf="task.completed == '1'"></ion-icon>
|
||||
|
||||
<h2>{{task.title}}</h2>
|
||||
<p *ngIf="task.details">{{ task.details }}</p>
|
||||
<p *ngIf="task.details" [innerHTML]="task.details"></p>
|
||||
<ion-icon item-end *ngIf="task.link && task.code != 'submit'" name="open"></ion-icon>
|
||||
</a>
|
||||
</ng-container>
|
||||
|
@ -94,7 +94,7 @@
|
|||
|
||||
<!-- Show only on current phase -->
|
||||
<ng-container *ngIf="workshop.phase == workshopPhases.PHASE_SUBMISSION">
|
||||
<ion-item text-wrap *ngIf="canSubmit && ((access.creatingsubmissionallowed && !submission) || (access.modifyingsubmissionallowed && submission))">
|
||||
<ion-item text-wrap *ngIf="showSubmit">
|
||||
<button ion-button icon-start block *ngIf="access.creatingsubmissionallowed && !submission" (click)="gotoSubmit()">
|
||||
<ion-icon name="add"></ion-icon>
|
||||
{{ 'addon.mod_workshop.createsubmission' | translate }}
|
||||
|
|
|
@ -49,6 +49,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
|
|||
visibleGroups: false
|
||||
};
|
||||
canSubmit = false;
|
||||
showSubmit = false;
|
||||
canAssess = false;
|
||||
hasNextPage = false;
|
||||
|
||||
|
@ -303,7 +304,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
|
|||
const modal = this.modalCtrl.create('AddonModWorkshopPhaseInfoPage', {
|
||||
phases: this.utils.objectToArray(this.phases),
|
||||
workshopPhase: this.workshop.phase,
|
||||
externalUrl: this.externalUrl
|
||||
externalUrl: this.externalUrl,
|
||||
showSubmit: this.showSubmit
|
||||
});
|
||||
modal.onDidDismiss((goSubmit) => {
|
||||
goSubmit && this.gotoSubmit();
|
||||
|
@ -338,6 +340,10 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
|
|||
this.canSubmit = this.workshopHelper.canSubmit(this.workshop, this.access,
|
||||
this.phases[AddonModWorkshopProvider.PHASE_SUBMISSION].tasks);
|
||||
|
||||
this.showSubmit = this.workshop.phase == AddonModWorkshopProvider.PHASE_SUBMISSION && this.canSubmit &&
|
||||
((this.access.creatingsubmissionallowed && !this.submission) ||
|
||||
(this.access.modifyingsubmissionallowed && this.submission));
|
||||
|
||||
const promises = [];
|
||||
|
||||
if (this.canSubmit) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
{{ 'addon.mod_workshop.switchphase' + phase.code | translate }}
|
||||
<ion-icon item-end name="open"></ion-icon>
|
||||
</a>
|
||||
<a ion-item text-wrap *ngFor="let task of phase.tasks" [class.item-dimmed]="phase.code != workshopPhase" (click)="runTask(task)" detail-none>
|
||||
<a ion-item text-wrap *ngFor="let task of phase.tasks" [class.item-dimmed]="phase.code != workshopPhase || (task.code == 'submit' && !showSubmit)" (click)="runTask(task)" detail-none>
|
||||
<ion-icon item-start name="radio-button-off" *ngIf="task.completed == null"></ion-icon>
|
||||
<ion-icon item-start name="close-circle" color="danger" *ngIf="task.completed == ''"></ion-icon>
|
||||
<ion-icon item-start name="information-circle" color="info" *ngIf="task.completed == 'info'"></ion-icon>
|
||||
|
|
|
@ -27,10 +27,12 @@ import { CoreUtilsProvider } from '@providers/utils/utils';
|
|||
export class AddonModWorkshopPhaseInfoPage {
|
||||
phases: any;
|
||||
workshopPhase: number;
|
||||
showSubmit: boolean;
|
||||
|
||||
constructor(params: NavParams, private viewCtrl: ViewController, private utils: CoreUtilsProvider) {
|
||||
this.phases = params.get('phases');
|
||||
this.workshopPhase = params.get('workshopPhase');
|
||||
this.showSubmit = params.get('showSubmit');
|
||||
const externalUrl = params.get('externalUrl');
|
||||
|
||||
// Treat phases.
|
||||
|
|
Loading…
Reference in New Issue