mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-27 09:29:59 -04:00
FEATURE: added rmac and cross refs to strongs cards/modal
This commit is contained in:
parent
75cd2ac4b3
commit
5a70080684
@ -11,7 +11,22 @@
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
|
<br>
|
||||||
|
<h2>Strongs Definitition</h2>
|
||||||
<p>
|
<p>
|
||||||
<b>{{item.def.tr}} ({{item.def.sn}})</b> - {{item.def.p}} - {{item.def.lemma}} - <span [innerHTML]="item.def.de"></span><br />
|
<b>{{item.def.tr}} ({{item.def.sn}})</b> - {{item.def.p}} - {{item.def.lemma}} - <span [innerHTML]="item.def.de"></span><br>
|
||||||
</p>
|
</p>
|
||||||
|
<h2>Robinsons Morphalogical Analysis Code</h2>
|
||||||
|
<b>{{item.rmac.id}}</b><br>
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let c of item.rmac.d">
|
||||||
|
{{c}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h2>Cross References</h2>
|
||||||
|
<dl>
|
||||||
|
<dd *ngFor="let wrd of item.crossrefs.ss">
|
||||||
|
{{wrd.w}}: <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
</ion-content>
|
</ion-content>
|
@ -1,5 +1,6 @@
|
|||||||
import {Component} from "@angular/core";
|
import { EventEmitter, Component, Input, Output } from "@angular/core";
|
||||||
import { Platform, NavParams, ViewController } from 'ionic-angular';
|
import { Platform, NavParams, ViewController } from 'ionic-angular';
|
||||||
|
import { Reference } from '../../Reference.ts';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "strongs-modal",
|
selector: "strongs-modal",
|
||||||
@ -8,15 +9,29 @@ import { Platform, NavParams, ViewController } from 'ionic-angular';
|
|||||||
export class StrongsModal {
|
export class StrongsModal {
|
||||||
item: StrongsResult;
|
item: StrongsResult;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
onPassageClicked = new EventEmitter<string>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public platform: Platform,
|
public platform: Platform,
|
||||||
public params: NavParams,
|
public params: NavParams,
|
||||||
public viewCtrl: ViewController
|
public viewCtrl: ViewController
|
||||||
) {
|
) {
|
||||||
this.item = this.params.get('strongsid') as StrongsResult;
|
this.item = this.params.get('strongsid') as StrongsResult;
|
||||||
|
this.onPassageClicked.subscribe(item =>
|
||||||
|
this.params.get('onPassageClicked').getItems(item)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
dismiss() {
|
dismiss() {
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
}
|
}
|
||||||
|
makePassage(p: string) {
|
||||||
|
return Reference.bookName(p.split(";")[0]) + ' ' + p.split(";")[1] + ":" + p.split(";")[2];
|
||||||
|
}
|
||||||
|
openPassage(p: string) {
|
||||||
|
let ref = this.makePassage(p);
|
||||||
|
//this.dismiss();
|
||||||
|
this.onPassageClicked.emit(ref);
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,7 +5,22 @@
|
|||||||
</button>
|
</button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
|
<br>
|
||||||
|
<h2>Strongs Definitition</h2>
|
||||||
<p>
|
<p>
|
||||||
<b>{{item.def.tr}} ({{item.def.sn}})</b> - {{item.def.p}} - {{item.def.lemma}} - <span [innerHTML]="item.def.de"></span><br />
|
<b>{{item.def.tr}} ({{item.def.sn}})</b> - {{item.def.p}} - {{item.def.lemma}} - <span [innerHTML]="item.def.de"></span><br>
|
||||||
</p>
|
</p>
|
||||||
|
<h2>Robinsons Morphalogical Analysis Code</h2>
|
||||||
|
<b>{{item.rmac.id}}</b><br>
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let c of item.rmac.d">
|
||||||
|
{{c}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h2>Cross References</h2>
|
||||||
|
<dl>
|
||||||
|
<dd *ngFor="let wrd of item.crossrefs.ss">
|
||||||
|
{{wrd.w}}: <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
@ -1,4 +1,5 @@
|
|||||||
import {EventEmitter, Component, Input, Output} from "@angular/core";
|
import { EventEmitter, Component, Input, Output } from "@angular/core";
|
||||||
|
import { Reference } from '../../Reference.ts';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "strongs",
|
selector: "strongs",
|
||||||
@ -8,6 +9,9 @@ export class Strongs {
|
|||||||
@Output()
|
@Output()
|
||||||
onClose = new EventEmitter<CardItem>();
|
onClose = new EventEmitter<CardItem>();
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
onPassageClicked = new EventEmitter<string>();
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
item: StrongsResult;
|
item: StrongsResult;
|
||||||
|
|
||||||
@ -20,4 +24,11 @@ export class Strongs {
|
|||||||
close() {
|
close() {
|
||||||
this.onClose.emit(this.cardItem);
|
this.onClose.emit(this.cardItem);
|
||||||
}
|
}
|
||||||
|
makePassage(p: string) {
|
||||||
|
return Reference.bookName(p.split(";")[0]) + ' ' + p.split(";")[1] + ":" + p.split(";")[2];
|
||||||
|
}
|
||||||
|
openPassage(p: string) {
|
||||||
|
let ref = this.makePassage(p);
|
||||||
|
this.onPassageClicked.emit(ref);
|
||||||
|
}
|
||||||
}
|
}
|
@ -9,7 +9,7 @@
|
|||||||
<ion-content padding class="search-card">
|
<ion-content padding class="search-card">
|
||||||
<ion-card *ngFor="let item of items">
|
<ion-card *ngFor="let item of items">
|
||||||
<passage *ngIf="isPassage(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" [dict]="item.dict" (onStrongsClicked)="getItems($event)"></passage>
|
<passage *ngIf="isPassage(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" [dict]="item.dict" (onStrongsClicked)="getItems($event)"></passage>
|
||||||
<strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)"></strongs>
|
<strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItems($event)"></strongs>
|
||||||
<button ion-button icon-left clear small (click)="removeItem(item)">
|
<button ion-button icon-left clear small (click)="removeItem(item)">
|
||||||
<ion-icon name="close-circle"></ion-icon>
|
<ion-icon name="close-circle"></ion-icon>
|
||||||
<div>Close</div>
|
<div>Close</div>
|
||||||
|
@ -24,3 +24,7 @@ body {
|
|||||||
-webkit-user-select: inherit;
|
-webkit-user-select: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-md h2 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
@ -51,7 +51,7 @@ export class SearchPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
presentStrongsModal(strongs: StrongsResult) {
|
presentStrongsModal(strongs: StrongsResult) {
|
||||||
let modal = this.modalCtrl.create(StrongsModal, { strongsid: strongs });
|
let modal = this.modalCtrl.create(StrongsModal, { strongsid: strongs, onPassageClicked: this });
|
||||||
modal.present();
|
modal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,12 +76,6 @@ export class SearchPage {
|
|||||||
|
|
||||||
getItems(search) {
|
getItems(search) {
|
||||||
try {
|
try {
|
||||||
let loader = this.loadingCtrl.create({
|
|
||||||
content: "Retrieving passage...",
|
|
||||||
dismissOnPageChange: true
|
|
||||||
});
|
|
||||||
loader.present();
|
|
||||||
|
|
||||||
let qs = search.split(";");
|
let qs = search.split(";");
|
||||||
for (let x in qs) {
|
for (let x in qs) {
|
||||||
if (qs.hasOwnProperty(x)) {
|
if (qs.hasOwnProperty(x)) {
|
||||||
@ -119,7 +113,7 @@ export class SearchPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loader.dismiss();
|
//loader.dismiss();
|
||||||
|
|
||||||
//Settings.SaveResults();
|
//Settings.SaveResults();
|
||||||
}
|
}
|
||||||
|
@ -4,35 +4,29 @@ import { Injectable } from "@angular/core";
|
|||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StrongsService
|
export class StrongsService {
|
||||||
{
|
|
||||||
result: StrongsResult;
|
result: StrongsResult;
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
constructor(private http: Http)
|
constructor(private http: Http) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
getStrongs(sn: number, dict: string): StrongsResult
|
getStrongs(sn: number, dict: string): StrongsResult {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
const self = this;
|
const self = this;
|
||||||
this.result = {
|
this.result = {
|
||||||
prefix: "",
|
prefix: "",
|
||||||
sn: -1,
|
sn: -1,
|
||||||
strongs: [],
|
strongs: [],
|
||||||
def: null,
|
def: null,
|
||||||
rmac: [],
|
rmac: null,
|
||||||
crossrefs: [],
|
crossrefs: null,
|
||||||
rmaccode: ""
|
rmaccode: ""
|
||||||
};
|
};
|
||||||
let url = dict + Math.ceil(sn / 100) + ".json";
|
let url = dict + Math.ceil(sn / 100) + ".json";
|
||||||
if (dict === "grk")
|
if (dict === "grk") {
|
||||||
{
|
|
||||||
self.result.prefix = "G";
|
self.result.prefix = "G";
|
||||||
if (sn > 5624) return this.result;
|
if (sn > 5624) return this.result;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
self.result.prefix = "H";
|
self.result.prefix = "H";
|
||||||
if (sn > 8674) return this.result;
|
if (sn > 8674) return this.result;
|
||||||
}
|
}
|
||||||
@ -43,12 +37,10 @@ export class StrongsService
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: `data/strongs/${url}`,
|
url: `data/strongs/${url}`,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: StrongsDefinition[], t, x)
|
success: function (d: StrongsDefinition[], t, x) {
|
||||||
{
|
|
||||||
self.result.strongs = d;
|
self.result.strongs = d;
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
//Util.HandleError(error);
|
//Util.HandleError(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -61,18 +53,20 @@ export class StrongsService
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: `data/strongscr/cr${url}`,
|
url: `data/strongscr/cr${url}`,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: StrongsCrossReference[], t, x)
|
success: function (d: StrongsCrossReference[], t, x) {
|
||||||
{
|
for (let cr of d) {
|
||||||
self.result.crossrefs = d;
|
if (cr.id.toUpperCase() == self.result.prefix + self.result.sn) {
|
||||||
|
self.result.crossrefs = cr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
//Util.HandleError(error);
|
//Util.HandleError(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (dict === "grk")
|
if (dict === "grk") {
|
||||||
{
|
|
||||||
url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`;
|
url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`;
|
||||||
let rmac_cross_references: RMACCrossReference[];
|
let rmac_cross_references: RMACCrossReference[];
|
||||||
|
|
||||||
@ -82,40 +76,39 @@ export class StrongsService
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: RMACCrossReference[], t, x)
|
success: function (d: RMACCrossReference[], t, x) {
|
||||||
{
|
|
||||||
rmac_cross_references = d;
|
rmac_cross_references = d;
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
//Util.HandleError(error);
|
//Util.HandleError(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// deal with RMAC
|
// deal with RMAC
|
||||||
this.result.rmaccode = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { if (el.i == sn + "") { return true; } else { return false; } })[0].r;
|
this.result.rmaccode = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { if (el.i == sn + "") { return true; } else { return false; } })[0].r;
|
||||||
if (this.result.rmaccode != undefined)
|
if (this.result.rmaccode != undefined) {
|
||||||
{
|
|
||||||
url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`;
|
url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: RMACDefinition[], t, x)
|
success: function (d: RMACDefinition[], t, x) {
|
||||||
{
|
for (let rmac of d) {
|
||||||
self.result.rmac = d;
|
if (rmac.id.toLowerCase() == self.result.rmaccode) {
|
||||||
|
self.result.rmac = rmac;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
//Util.HandleError(error);
|
//Util.HandleError(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.result;
|
return this.result;
|
||||||
} catch (err)
|
} catch (err) {
|
||||||
{
|
|
||||||
//Util.HandleError(err);
|
//Util.HandleError(err);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -49,8 +49,8 @@ type StrongsResult =
|
|||||||
sn: number,
|
sn: number,
|
||||||
strongs: StrongsDefinition[],
|
strongs: StrongsDefinition[],
|
||||||
def: StrongsDefinition,
|
def: StrongsDefinition,
|
||||||
rmac: RMACDefinition[],
|
rmac: RMACDefinition,
|
||||||
crossrefs: StrongsCrossReference[],
|
crossrefs: StrongsCrossReference,
|
||||||
rmaccode: string,
|
rmaccode: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user