Skip to content

Commit

Permalink
Merge pull request #273 from severinbeauvais/PRC-734
Browse files Browse the repository at this point in the history
PRC-734: added Publishing Changes button + added new confirmations
  • Loading branch information
marklise authored Oct 10, 2018
2 parents b529e56 + 72d3915 commit 7ef47ec
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ <h1><span class="text-muted">Crown land File: {{application['clFile']}} &nbsp;&r
<span>{{isSubmitting ? 'Saving' : 'Save'}}</span>
</button>
<button class="btn btn-primary" type="button" title="Save application"
*ngIf="application._id" (click)="saveApplication()" [disabled]="isSaving">
*ngIf="application._id && application.isPublished === false" (click)="saveApplication()" [disabled]="isSaving">
<i class="spinner rotating" [hidden]="!isSaving"></i>
<span>{{isSaving ? 'Saving' : 'Save'}}</span>
</button>
<button class="btn btn-primary" type="button" title="Publish Changes"
*ngIf="application._id && application.isPublished === true" (click)="saveApplication()" [disabled]="isSaving">
<i class="spinner rotating" [hidden]="!isSaving"></i>
<span>{{isSaving ? 'Publishing Changes' : 'Publish Changes'}}</span>
</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,36 @@ export class ApplicationAddEditComponent implements OnInit, OnDestroy {
}

if (this.applicationForm.invalid) {
if (this.application.isPublished) {
this.dialogService.addDialog(ConfirmComponent,
{
title: 'Cannot Publish Changes',
message: 'Please check for required fields or errors.',
okOnly: true
}, {
backdropColor: 'rgba(0, 0, 0, 0.5)'
})
.takeUntil(this.ngUnsubscribe);
return;
} else {
this.dialogService.addDialog(ConfirmComponent,
{
title: 'Cannot Save Application',
message: 'Please check for required fields or errors.',
okOnly: true
}, {
backdropColor: 'rgba(0, 0, 0, 0.5)'
})
.takeUntil(this.ngUnsubscribe);
return;
}
}

if (this.application.isPublished && !this.application.description) {
this.dialogService.addDialog(ConfirmComponent,
{
title: 'Cannot Save Application',
message: 'Please check for required fields or errors.',
title: 'Cannot Publish Changes',
message: 'A description for this application is required to publish.',
okOnly: true
}, {
backdropColor: 'rgba(0, 0, 0, 0.5)'
Expand Down

0 comments on commit 7ef47ec

Please sign in to comment.