aboutsummaryrefslogtreecommitdiff
path: root/app/components/plan-list
diff options
context:
space:
mode:
authorRob McGinley <mcginleyr1@gmail.com>2016-06-04 10:39:56 -0400
committerRob McGinley <mcginleyr1@gmail.com>2016-06-04 10:39:56 -0400
commit8dc7986ada6631a491ff09f286a1a534e7b34a19 (patch)
tree75957a61c59ad06efcafa3ae04b622315e08dd36 /app/components/plan-list
parentffec797c18059bad36916c7593902e1906b991ce (diff)
parentd7bac26ce4a8618c4e0bba5335880c92d09acc32 (diff)
Merge branch 'master' of github.com:AlexTatiyants/pev
Diffstat (limited to 'app/components/plan-list')
-rw-r--r--app/components/plan-list/plan-list.html36
-rw-r--r--app/components/plan-list/plan-list.ts7
2 files changed, 23 insertions, 20 deletions
diff --git a/app/components/plan-list/plan-list.html b/app/components/plan-list/plan-list.html
index 28c95af..a16ffbe 100644
--- a/app/components/plan-list/plan-list.html
+++ b/app/components/plan-list/plan-list.html
@@ -3,28 +3,28 @@
Welcome to PEV! Please <a [routerLink]="['/PlanNew']">submit</a> a plan for visualization
</div>
- <table class="table">
+ <table class="table pad-bottom">
<tr *ngFor="#plan of plans">
+ <!-- this is a hack that should be converted to a proper dialog once that is available in angular 2-->
+ <div *ngIf="openDialog">
+ <div class="modal-backdrop"></div>
+ <div class="modal">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-body">You're about to delete plan "{{planToDelete.name}}". Are you sure?</div>
+ <div class="modal-footer">
+ <button class="btn btn-primary" (click)="deletePlan()">Yes</button>
+ <button class="btn btn-default" (click)="cancelDelete()">No</button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
<td width="30%"><a [routerLink]="['/PlanView', {id: plan.id}]">{{plan.name}}</a></td>
<td>created on {{plan.createdOn | momentDate }}</td>
- <td class="align-right"><button class="btn btn-danger" (click)="requestDelete()">
+ <td class="align-right"><button class="btn btn-danger" (click)="requestDelete(plan)">
<i class="fa fa-trash"></i>delete</button>
- <!-- this is a hack that should be converted to a proper dialog once that is available in angular 2-->
- <div *ngIf="openDialog">
- <div class="modal-backdrop"></div>
-
- <div class="modal">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-body">You're about to delete this plan. Are you sure?</div>
- <div class="modal-footer">
- <button class="btn btn-primary" (click)="deletePlan(plan)">Yes</button>
- <button class="btn btn-default" (click)="cancelDelete()">No</button>
- </div>
- </div>
- </div>
- </div>
- </div>
</td>
</tr>
</table>
diff --git a/app/components/plan-list/plan-list.ts b/app/components/plan-list/plan-list.ts
index 888e2e2..32583a3 100644
--- a/app/components/plan-list/plan-list.ts
+++ b/app/components/plan-list/plan-list.ts
@@ -20,6 +20,7 @@ export class PlanList {
newPlanContent: any;
newPlanId: string;
openDialog: boolean = false;
+ planToDelete: IPlan;
constructor(private _planService: PlanService) { }
@@ -27,13 +28,15 @@ export class PlanList {
this.plans = this._planService.getPlans();
}
- requestDelete() {
+ requestDelete(plan) {
this.openDialog = true;
+ this.planToDelete = plan;
}
deletePlan(plan) {
this.openDialog = false;
- this._planService.deletePlan(plan);
+ console.log(this.planToDelete);
+ this._planService.deletePlan(this.planToDelete);
this.plans = this._planService.getPlans();
}