forked from dose-amigos/dose-amigos-ionic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue dose-amigos#79: Added Swipe functionality and delete calls for …
…Dose Series Added the abilty to swipe over dose series and call delete. This triggers a delete on that dose series, publishes the delete event, which is then subscribed by the main list, causing a reload of the series.
- Loading branch information
Showing
5 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<ion-item-sliding #slidingItem *ngIf="doseSeries"> | ||
<ion-item> | ||
<h2>{{doseSeries.med.name}}</h2> | ||
<p>Take {{doseSeries.med.doseAmount}} {{doseSeries.med.doseUnit}}, {{doseSeries.med.doseInstructions}} </p> | ||
</ion-item> | ||
<ion-item-options> | ||
<button primary (click)="slidingDelete(slidingItem)"> | ||
<ion-icon name="Delete"></ion-icon> | ||
Delete | ||
</button> | ||
</ion-item-options> | ||
|
||
</ion-item-sliding> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {Component, Input} from "@angular/core"; | ||
import {DoseSeries} from "../dose-series/dose-series"; | ||
import {ItemSliding} from "ionic-angular/index"; | ||
import {DoseSeriesService} from "../dose-series-service/dose-series.service"; | ||
import {Events} from "ionic-angular/index"; | ||
|
||
/** | ||
* DoseEventSlider for rendering a dose-events. | ||
*/ | ||
@Component( | ||
{ | ||
selector: "dose-series-slider", | ||
templateUrl: "build/dose-series-slider/dose-series-slider.component.html" | ||
} | ||
) | ||
|
||
export class DoseSeriesSliderComponent { | ||
|
||
@Input() | ||
public doseSeries: DoseSeries; | ||
|
||
constructor( | ||
private doseSeriesService: DoseSeriesService, | ||
private events: Events | ||
) { | ||
} | ||
|
||
slidingDelete(slidingItem: ItemSliding) { | ||
this.doseSeriesService.delete(this.doseSeries.id).then( | ||
(doseSeries: DoseSeries) => { | ||
this.events.publish( | ||
"doseSeries:created", | ||
doseSeries as DoseSeries | ||
); | ||
} | ||
); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters