mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-26 08:49:49 -04:00

* only load strongs into modals if you're clicking on a link * change size of strongs cross refs dynamically
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { EventEmitter, Component, Output, OnInit } from "@angular/core";
|
|
import { Platform, NavParams, ViewController } from 'ionic-angular';
|
|
import { Reference } from '../../libs/Reference';
|
|
import { StrongsResult, StrongsService } from '../../services/strongs-service';
|
|
|
|
@Component({
|
|
selector: "strongs-modal",
|
|
templateUrl: "strongs-modal.html",
|
|
providers: [StrongsService]
|
|
})
|
|
export class StrongsModal implements OnInit
|
|
{
|
|
sn: number;
|
|
dict: string;
|
|
item: StrongsResult;
|
|
|
|
@Output()
|
|
onItemClicked = new EventEmitter<string>();
|
|
|
|
constructor(private strongsService: StrongsService,
|
|
public platform: Platform,
|
|
public params: NavParams,
|
|
public viewCtrl: ViewController
|
|
)
|
|
{
|
|
this.sn = this.params.get('sn') as number;
|
|
this.dict = this.params.get('dict') as string;
|
|
this.onItemClicked.subscribe(item =>
|
|
this.params.get('onItemClicked').getItems(item)
|
|
)
|
|
}
|
|
|
|
ngOnInit(): void
|
|
{
|
|
this.strongsService.getResultAsPromise(this.sn, this.dict).then(data => this.item = data);
|
|
}
|
|
|
|
dismiss()
|
|
{
|
|
this.viewCtrl.dismiss();
|
|
}
|
|
|
|
openItem(p: string)
|
|
{
|
|
this.onItemClicked.emit(p);
|
|
this.dismiss();
|
|
}
|
|
|
|
makePassage(p: string)
|
|
{
|
|
return Reference.bookName(parseInt(p.split(";")[0])) + ' ' + p.split(";")[1] + ":" + p.split(";")[2];
|
|
}
|
|
|
|
openPassage(p: string)
|
|
{
|
|
let ref = this.makePassage(p);
|
|
this.onItemClicked.emit(ref);
|
|
}
|
|
} |