FEATURE: Added strongs modal popup.

* fixed spaces around punctuation in verse display.
This commit is contained in:
walljm 2016-12-01 13:40:04 -05:00
parent 293c47a71c
commit d92b370326
9 changed files with 86 additions and 22 deletions

View File

@ -7,6 +7,7 @@ import {SearchPage} from "../pages/search/search";
import {ComponentLoader} from "../components/component-loader/component-loader.ts";
import {Passage} from "../components/passage/passage.ts";
import {Strongs} from "../components/strongs/strongs.ts";
import {StrongsModal} from "../components/strongs-modal/strongs-modal.ts";
@NgModule({
declarations: [
@ -15,6 +16,7 @@ import {Strongs} from "../components/strongs/strongs.ts";
ComponentLoader,
Passage,
Strongs,
StrongsModal,
],
imports: [
IonicModule.forRoot(MyApp),
@ -26,6 +28,7 @@ import {Strongs} from "../components/strongs/strongs.ts";
SearchPage,
Passage,
Strongs,
StrongsModal,
],
providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }]
})

View File

@ -8,6 +8,7 @@
<div *ngFor="let ch of item.cs">
<br>
<h2 *ngIf="item.cs.length > 1"><b>Chapter {{ch.ch}}</b></h2>
<span *ngFor="let vs of ch.vss"><b>{{vs.v}}.</b> <span *ngFor="let w of vs.w"><a (click)="openStrongs(w.s)">{{w.t}}</a></span><br></span>
<span *ngFor="let vs of ch.vss"><b>{{vs.v}}.</b> <span *ngFor="let w of vs.w"><template [ngIf]="!isPunct(w.t)">
</template><a *ngIf="w.s != null" (click)="openStrongs(w.s)">{{w.t}}</a><template [ngIf]="!(w.s != null)">{{w.t}}</template></span><br></span>
</div>
</ion-card-content>

View File

@ -24,4 +24,8 @@ export class Passage {
openStrongs(strongs: string) {
this.onStrongs.emit(this.dict+strongs);
}
isPunct(c: string) {
return new RegExp('^[\.\,\;\:\?\!]$').test(c)
}
}

View File

@ -0,0 +1,18 @@
<ion-header>
<ion-toolbar>
<ion-title>
Strongs: {{item.prefix}}{{item.sn}}
</ion-title>
<ion-buttons start>
<button ion-button (click)="dismiss()">
<span color="primary" showWhen="ios">Cancel</span>
<ion-icon name="md-close" showWhen="android,windows"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<p>
<b>{{item.def.tr}} ({{item.def.sn}})</b> - {{item.def.p}} - {{item.def.lemma}} - <span [innerHTML]="item.def.de"></span><br />
</p>
</ion-content>

View File

@ -0,0 +1,22 @@
import {Component} from "@angular/core";
import { ModalController, Platform, NavParams, ViewController } from 'ionic-angular';
@Component({
selector: "strongs-modal",
templateUrl: "strongs-modal.html"
})
export class StrongsModal {
item: StrongsResult;
constructor(
public platform: Platform,
public params: NavParams,
public viewCtrl: ViewController
) {
this.item = this.params.get('strongsid') as StrongsResult;
}
dismiss() {
this.viewCtrl.dismiss();
}
}

View File

@ -1,6 +1,6 @@
<ion-header>
<ion-navbar>
<button menuToggle>
<button menuToggle item-left large>
<ion-icon name="menu"></ion-icon>
</button>
<ion-searchbar (search)="getQuery($event)" (input)="setQuery($event)"></ion-searchbar>

View File

@ -1,14 +1,19 @@
.search-card .content {
p {
margin: 20px 0;
line-height: 22px;
font-size: 16px;
}
}
.search-card {
.title {
background-color: gainsboro;
font-size: 2em;
}
p {
margin: 20px 0;
line-height: 22px;
font-size: 16px;
}
}
.title{
background-color:gainsboro;
font-size: 2em;
}
a {
color: black;
border-bottom: 1px dotted gainsboro;
}
}

View File

@ -2,12 +2,12 @@
import {Type, Component} from "@angular/core";
import {Reference} from "../../Reference";
import {BibleService} from "../../bible-service";
import {LoadingController} from "ionic-angular";
import {LoadingController, ModalController } from "ionic-angular";
import {StrongsService} from "../../strongs-service";
import {Strongs} from "../../components/strongs/strongs";
import {Passage} from "../../components/passage/passage.ts";
import {ComponentLoader} from "../../components/component-loader/component-loader.ts";
import {StrongsModal} from "../../components/strongs-modal/strongs-modal.ts";
class Item {
id: number;
@ -25,7 +25,11 @@ export class SearchPage {
items: any[];
last: number;
constructor(private strongsService: StrongsService, private bibleService: BibleService, public loadingCtrl: LoadingController) {
constructor(
private strongsService: StrongsService
, private bibleService: BibleService
, public loadingCtrl: LoadingController
, public modalCtrl: ModalController) {
this.initializeItems();
}
@ -33,6 +37,12 @@ export class SearchPage {
this.items = [];
this.last = 0;
}
presentStrongsModal(strongs: StrongsResult) {
let modal = this.modalCtrl.create(StrongsModal, { strongsid: strongs});
modal.present();
}
setQuery(searchbar) {
this.searchQuery = searchbar.target.value;
}
@ -81,7 +91,8 @@ export class SearchPage {
}
q = q.substring(1, q.length);
let result = this.strongsService.getStrongs(parseInt(q), dict);
this.items.unshift({ id: this.last++, data: result, type: Strongs });
this.presentStrongsModal(result);
//this.items.unshift({ id: this.last++, data: result, type: Strongs });
} else {
// its a verse reference.
if (q.trim() !== "") {

View File

@ -253,7 +253,7 @@ namespace DynamicBibleUtility
{
// iterate through text, output json format.
OpenFileDialog ofd = new OpenFileDialog();
List<Book> bbl = new System.Collections.Generic.List<Book>();
List<Book> bbl = new List<Book>();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
@ -303,7 +303,7 @@ namespace DynamicBibleUtility
{
if (((XElement)o).Name == "gr")
{
Ts.Add(new Text(((XElement)o).Value, ((XElement)o).FirstAttribute.Value));
Ts.Add(new Text(((XElement)o).Value.Trim(), ((XElement)o).FirstAttribute.Value));
}
else if ((((XElement)o).Name.ToString().ToLower() == "style"))
{
@ -319,7 +319,7 @@ namespace DynamicBibleUtility
}
else if (o.GetType() == typeof(XText))
{
Ts.Add(new Text(((XText)o).Value));
Ts.Add(new Text(((XText)o).Value.Trim()));
}
else
{
@ -342,7 +342,7 @@ namespace DynamicBibleUtility
{
// iterate through text, output json format.
OpenFileDialog ofd = new OpenFileDialog();
List<Book> bbl = new System.Collections.Generic.List<Book>();
List<Book> bbl = new List<Book>();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{