mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -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-header>
|
||||
<ion-content padding>
|
||||
<br>
|
||||
<h2>Strongs Definitition</h2>
|
||||
<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>
|
||||
<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>
|
@ -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 { Reference } from '../../Reference.ts';
|
||||
|
||||
@Component({
|
||||
selector: "strongs-modal",
|
||||
@ -8,15 +9,29 @@ import { Platform, NavParams, ViewController } from 'ionic-angular';
|
||||
export class StrongsModal {
|
||||
item: StrongsResult;
|
||||
|
||||
constructor(
|
||||
public platform: Platform,
|
||||
public params: NavParams,
|
||||
public viewCtrl: ViewController
|
||||
@Output()
|
||||
onPassageClicked = new EventEmitter<string>();
|
||||
|
||||
constructor(
|
||||
public platform: Platform,
|
||||
public params: NavParams,
|
||||
public viewCtrl: ViewController
|
||||
) {
|
||||
this.item = this.params.get('strongsid') as StrongsResult;
|
||||
this.onPassageClicked.subscribe(item =>
|
||||
this.params.get('onPassageClicked').getItems(item)
|
||||
)
|
||||
}
|
||||
|
||||
dismiss() {
|
||||
this.viewCtrl.dismiss();
|
||||
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>
|
||||
</ion-item>
|
||||
<ion-card-content>
|
||||
<br>
|
||||
<h2>Strongs Definitition</h2>
|
||||
<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>
|
||||
<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>
|
@ -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({
|
||||
selector: "strongs",
|
||||
@ -8,6 +9,9 @@ export class Strongs {
|
||||
@Output()
|
||||
onClose = new EventEmitter<CardItem>();
|
||||
|
||||
@Output()
|
||||
onPassageClicked = new EventEmitter<string>();
|
||||
|
||||
@Input()
|
||||
item: StrongsResult;
|
||||
|
||||
@ -20,4 +24,11 @@ export class Strongs {
|
||||
close() {
|
||||
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-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>
|
||||
<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)">
|
||||
<ion-icon name="close-circle"></ion-icon>
|
||||
<div>Close</div>
|
||||
|
@ -23,4 +23,8 @@ body {
|
||||
.scroll {
|
||||
-webkit-user-select: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.card-md h2 {
|
||||
font-size: 2rem;
|
||||
}
|
@ -51,7 +51,7 @@ export class SearchPage {
|
||||
}
|
||||
|
||||
presentStrongsModal(strongs: StrongsResult) {
|
||||
let modal = this.modalCtrl.create(StrongsModal, { strongsid: strongs });
|
||||
let modal = this.modalCtrl.create(StrongsModal, { strongsid: strongs, onPassageClicked: this });
|
||||
modal.present();
|
||||
}
|
||||
|
||||
@ -76,12 +76,6 @@ export class SearchPage {
|
||||
|
||||
getItems(search) {
|
||||
try {
|
||||
let loader = this.loadingCtrl.create({
|
||||
content: "Retrieving passage...",
|
||||
dismissOnPageChange: true
|
||||
});
|
||||
loader.present();
|
||||
|
||||
let qs = search.split(";");
|
||||
for (let x in qs) {
|
||||
if (qs.hasOwnProperty(x)) {
|
||||
@ -119,7 +113,7 @@ export class SearchPage {
|
||||
}
|
||||
}
|
||||
}
|
||||
loader.dismiss();
|
||||
//loader.dismiss();
|
||||
|
||||
//Settings.SaveResults();
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
/// <reference path="../../types.ts" />
|
||||
import { Component } from '@angular/core';
|
||||
import { NavController } from 'ionic-angular';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'settings',
|
||||
templateUrl: 'settings.html'
|
||||
})
|
||||
export class SettingsPage {
|
||||
user: User = { strongs_modal: true };
|
||||
constructor(public navCtrl: NavController, public local: Storage) {
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { NavController } from 'ionic-angular';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
@Component({
|
||||
selector: 'settings',
|
||||
templateUrl: 'settings.html'
|
||||
})
|
||||
export class SettingsPage {
|
||||
user: User = { strongs_modal: true };
|
||||
constructor(public navCtrl: NavController, public local: Storage) {
|
||||
|
||||
// Check if there is a profile saved in local storage
|
||||
this.local.get('profile').then(profile => {
|
||||
if (profile === null) {
|
||||
@ -20,14 +20,14 @@ export class SettingsPage {
|
||||
this.user = JSON.parse(profile);
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
save() {
|
||||
this.local.set('profile', JSON.stringify(this.user));
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('Hello SettingsPage Page');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
save() {
|
||||
this.local.set('profile', JSON.stringify(this.user));
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
console.log('Hello SettingsPage Page');
|
||||
}
|
||||
}
|
@ -4,35 +4,29 @@ import { Injectable } from "@angular/core";
|
||||
import { Http } from "@angular/http";
|
||||
|
||||
@Injectable()
|
||||
export class StrongsService
|
||||
{
|
||||
export class StrongsService {
|
||||
result: StrongsResult;
|
||||
count = 0;
|
||||
|
||||
constructor(private http: Http)
|
||||
{
|
||||
constructor(private http: Http) {
|
||||
}
|
||||
getStrongs(sn: number, dict: string): StrongsResult
|
||||
{
|
||||
try
|
||||
{
|
||||
getStrongs(sn: number, dict: string): StrongsResult {
|
||||
try {
|
||||
const self = this;
|
||||
this.result = {
|
||||
prefix: "",
|
||||
sn: -1,
|
||||
strongs: [],
|
||||
def: null,
|
||||
rmac: [],
|
||||
crossrefs: [],
|
||||
rmac: null,
|
||||
crossrefs: null,
|
||||
rmaccode: ""
|
||||
};
|
||||
let url = dict + Math.ceil(sn / 100) + ".json";
|
||||
if (dict === "grk")
|
||||
{
|
||||
if (dict === "grk") {
|
||||
self.result.prefix = "G";
|
||||
if (sn > 5624) return this.result;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
self.result.prefix = "H";
|
||||
if (sn > 8674) return this.result;
|
||||
}
|
||||
@ -43,12 +37,10 @@ export class StrongsService
|
||||
type: "GET",
|
||||
url: `data/strongs/${url}`,
|
||||
dataType: "json",
|
||||
success: function (d: StrongsDefinition[], t, x)
|
||||
{
|
||||
success: function (d: StrongsDefinition[], t, x) {
|
||||
self.result.strongs = d;
|
||||
},
|
||||
error: function (request, status, error)
|
||||
{
|
||||
error: function (request, status, error) {
|
||||
//Util.HandleError(error);
|
||||
}
|
||||
});
|
||||
@ -61,18 +53,20 @@ export class StrongsService
|
||||
type: "GET",
|
||||
url: `data/strongscr/cr${url}`,
|
||||
dataType: "json",
|
||||
success: function (d: StrongsCrossReference[], t, x)
|
||||
{
|
||||
self.result.crossrefs = d;
|
||||
success: function (d: StrongsCrossReference[], t, x) {
|
||||
for (let cr of 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);
|
||||
}
|
||||
});
|
||||
|
||||
if (dict === "grk")
|
||||
{
|
||||
if (dict === "grk") {
|
||||
url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`;
|
||||
let rmac_cross_references: RMACCrossReference[];
|
||||
|
||||
@ -82,40 +76,39 @@ export class StrongsService
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (d: RMACCrossReference[], t, x)
|
||||
{
|
||||
success: function (d: RMACCrossReference[], t, x) {
|
||||
rmac_cross_references = d;
|
||||
},
|
||||
error: function (request, status, error)
|
||||
{
|
||||
error: function (request, status, error) {
|
||||
//Util.HandleError(error);
|
||||
}
|
||||
});
|
||||
|
||||
// deal with RMAC
|
||||
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`;
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (d: RMACDefinition[], t, x)
|
||||
{
|
||||
self.result.rmac = d;
|
||||
success: function (d: RMACDefinition[], t, x) {
|
||||
for (let rmac of 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return this.result;
|
||||
} catch (err)
|
||||
{
|
||||
} catch (err) {
|
||||
//Util.HandleError(err);
|
||||
}
|
||||
return null;
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
type CardItem = { id: number, data: any, type: any, dict: string}
|
||||
|
||||
type User = {
|
||||
strongs_modal: boolean
|
||||
|
||||
type CardItem = { id: number, data: any, type: any, dict: string}
|
||||
|
||||
type User = {
|
||||
strongs_modal: boolean
|
||||
}
|
||||
|
||||
type BiblePassage = {
|
||||
@ -49,8 +49,8 @@ type StrongsResult =
|
||||
sn: number,
|
||||
strongs: StrongsDefinition[],
|
||||
def: StrongsDefinition,
|
||||
rmac: RMACDefinition[],
|
||||
crossrefs: StrongsCrossReference[],
|
||||
rmac: RMACDefinition,
|
||||
crossrefs: StrongsCrossReference,
|
||||
rmaccode: string,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user