2017-01-18 17:51:06 -05:00
|
|
|
import { EventEmitter, Component, Input, Output } from "@angular/core";
|
|
|
|
import { Reference } from '../../libs/Reference';
|
|
|
|
import { OpenData, CardItem } from "../../pages/search/search";
|
|
|
|
import { WordLookupResult } from "../../services/word-service"
|
2016-12-27 21:10:00 -05:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "words",
|
|
|
|
templateUrl: "words.html"
|
|
|
|
})
|
2017-01-18 17:51:06 -05:00
|
|
|
export class Words
|
|
|
|
{
|
2016-12-27 21:10:00 -05:00
|
|
|
@Output()
|
|
|
|
onClose = new EventEmitter<CardItem>();
|
|
|
|
|
|
|
|
@Output()
|
2016-12-28 16:57:40 -05:00
|
|
|
onPassageClicked = new EventEmitter<OpenData>();
|
2016-12-27 21:10:00 -05:00
|
|
|
|
|
|
|
@Input()
|
|
|
|
item: WordLookupResult;
|
|
|
|
|
|
|
|
@Input()
|
|
|
|
cardItem: CardItem;
|
|
|
|
|
2017-01-18 17:51:06 -05:00
|
|
|
constructor()
|
|
|
|
{
|
2016-12-27 21:10:00 -05:00
|
|
|
}
|
|
|
|
|
2017-01-18 17:51:06 -05:00
|
|
|
close()
|
|
|
|
{
|
2016-12-27 21:10:00 -05:00
|
|
|
this.onClose.emit(this.cardItem);
|
|
|
|
}
|
|
|
|
|
2017-01-16 21:36:22 -05:00
|
|
|
makePassage(p: string)
|
2016-12-27 21:10:00 -05:00
|
|
|
{
|
|
|
|
return Reference.bookName(parseInt(p.split(":")[0])) + ' ' + p.split(":")[1] + ":" + p.split(":")[2];
|
|
|
|
}
|
2017-01-16 21:36:22 -05:00
|
|
|
openPassage(p: string)
|
2016-12-27 21:10:00 -05:00
|
|
|
{
|
|
|
|
let ref = this.makePassage(p);
|
2016-12-28 16:57:40 -05:00
|
|
|
this.onPassageClicked.emit({ card: this.cardItem, qry: ref });
|
2016-12-27 21:10:00 -05:00
|
|
|
}
|
2017-01-18 17:51:06 -05:00
|
|
|
}
|