FEATURE: Simplified component data passing, added break on verse option

This commit is contained in:
walljm 2017-01-21 02:21:44 -05:00
parent 002a64106f
commit a6b585eba0
11 changed files with 49 additions and 41 deletions

View File

@ -6,7 +6,7 @@
</ion-item> </ion-item>
<ion-card-content> <ion-card-content>
<br> <br>
<p>{{item}}</p> <p>{{cardItem.data}}</p>
</ion-card-content> </ion-card-content>
<button ion-button icon-left clear small (click)="close()"> <button ion-button icon-left clear small (click)="close()">
<ion-icon name="close-circle"></ion-icon> <ion-icon name="close-circle"></ion-icon>

View File

@ -9,10 +9,7 @@ export class Error
{ {
@Output() @Output()
onClose = new EventEmitter<CardItem>(); onClose = new EventEmitter<CardItem>();
@Input()
item: string;
@Input() @Input()
cardItem: CardItem; cardItem: CardItem;

View File

@ -1,5 +1,5 @@
<ion-item class="title passage-title"> <ion-item class="title passage-title">
<ion-icon name="book" item-left></ion-icon> {{item.ref}} <ion-icon name="book" item-left></ion-icon> {{cardItem.data.ref}}
<button ion-button icon-only item-right large clear (click)="close()"> <button ion-button icon-only item-right large clear (click)="close()">
<ion-icon name="close-circle"></ion-icon> <ion-icon name="close-circle"></ion-icon>
</button> </button>
@ -7,15 +7,15 @@
<ion-card-content> <ion-card-content>
<br> <br>
<div class="passage-text" *ngFor="let ch of item.cs"> <div class="passage-text" *ngFor="let ch of cardItem.data.cs">
<h2 *ngIf="item.cs.length > 1"> <h2 *ngIf="cardItem.data.cs.length > 1">
<b>Chapter {{ch.ch}}</b> <b>Chapter {{ch.ch}}</b>
</h2> </h2>
<span *ngFor="let vs of ch.vss"> <span *ngFor="let vs of ch.vss">
<b>{{vs.v}}.</b> <span *ngFor="let w of vs.w"> <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)" (press)="openMenu(w.s)">{{w.t}}</a> <template [ngIf]="!isPunct(w.t)"> </template><a *ngIf="w.s != null" (click)="openStrongs(w.s)" (press)="openMenu(w.s)">{{w.t}}</a>
<template [ngIf]="w.s == null">{{w.t}}</template> <template [ngIf]="w.s == null">{{w.t}}</template>
</span><br> </span><br *ngIf="versesOnNewLine">
</span> </span>
</div> </div>
</ion-card-content> </ion-card-content>

View File

@ -13,14 +13,11 @@ export class Passage
@Output() @Output()
onClose = new EventEmitter<CardItem>(); onClose = new EventEmitter<CardItem>();
@Input()
item: BiblePassageResult;
@Input()
dict: string;
@Input() @Input()
cardItem: CardItem; cardItem: CardItem;
@Input()
versesOnNewLine: boolean;
constructor() constructor()
{ {
@ -33,7 +30,7 @@ export class Passage
openStrongs(strongs: string) openStrongs(strongs: string)
{ {
this.onItemClicked.emit({ card: this.cardItem, qry: this.dict + strongs }); this.onItemClicked.emit({ card: this.cardItem, qry: this.cardItem.dict + strongs });
} }
openMenu(strongs: string) openMenu(strongs: string)

View File

@ -1,5 +1,5 @@
<ion-item class="title strongs-title" padding> <ion-item class="title strongs-title" padding>
<ion-icon name="paper" item-left></ion-icon> {{item.prefix}}{{item.sn}} <ion-icon name="paper" item-left></ion-icon> {{item.prefix}}{{cardItem.data.sn}}
<button ion-button icon-only item-right large clear (click)="close()"> <button ion-button icon-only item-right large clear (click)="close()">
<ion-icon name="close-circle"></ion-icon> <ion-icon name="close-circle"></ion-icon>
</button> </button>
@ -9,16 +9,16 @@
<div class="strongs-def"> <div class="strongs-def">
<h2>Strongs Definitition</h2> <h2>Strongs Definitition</h2>
<p> <p>
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b> <b>{{cardItem.data.def.tr}} <template [ngIf]="cardItem.data.def.sn != null">({{cardItem.data.def.sn}})</template></b>
- {{item.def.p}} - {{item.def.lemma}} - - {{cardItem.data.def.p}} - {{cardItem.data.def.lemma}} -
<span *ngFor="let part of item.def.de"><template [ngIf]="part.sn != null"><a (click)="openItem(part.sn)">{{part.sn}}</a></template><template [ngIf]="part.w != null"><span [innerHTML]="part.w"></span></template></span><br> <span *ngFor="let part of cardItem.data.def.de"><template [ngIf]="part.sn != null"><a (click)="openItem(part.sn)">{{part.sn}}</a></template><template [ngIf]="part.w != null"><span [innerHTML]="part.w"></span></template></span><br>
</p> </p>
<template [ngIf]="item.rmac !== null"> <template [ngIf]="cardItem.data.rmac !== null">
<h2>RMAC</h2> <h2>RMAC</h2>
<b>{{item.rmac.id}}</b> <b>{{item.rmac.id}}</b>
<br> <br>
<ul> <ul>
<li *ngFor="let c of item.rmac.d"> <li *ngFor="let c of cardItem.data.rmac.d">
{{c}} {{c}}
</li> </li>
</ul> </ul>
@ -28,7 +28,7 @@
<h2>Cross References</h2> <h2>Cross References</h2>
<ion-scroll scrollY="true"> <ion-scroll scrollY="true">
<dl> <dl>
<dd *ngFor="let wrd of item.crossrefs.ss"> <dd *ngFor="let wrd of cardItem.data.crossrefs.ss">
<b>{{wrd.w}}</b>: <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span> <b>{{wrd.w}}</b>: <span *ngFor="let p of wrd.rs"><a (click)="openPassage(p.r)">{{makePassage(p.r)}}</a>, </span>
</dd> </dd>
</dl> </dl>

View File

@ -14,10 +14,7 @@ export class Strongs
@Output() @Output()
onItemClicked = new EventEmitter<OpenData>(); onItemClicked = new EventEmitter<OpenData>();
@Input()
item: StrongsResult;
@Input() @Input()
cardItem: CardItem; cardItem: CardItem;

View File

@ -1,12 +1,12 @@
<ion-item class="title words-title" padding> <ion-item class="title words-title" padding>
<ion-icon name="grid" item-left></ion-icon> {{item.refs.length}} results for {{item.word}} <ion-icon name="grid" item-left></ion-icon> {{cardItem.data.refs.length}} results for {{cardItem.data.word}}
<button ion-button icon-only item-right large clear (click)="close()"> <button ion-button icon-only item-right large clear (click)="close()">
<ion-icon name="close-circle"></ion-icon> <ion-icon name="close-circle"></ion-icon>
</button> </button>
</ion-item> </ion-item>
<ion-card-content> <ion-card-content>
<ion-scroll scrollY="true" overflow-scroll="true"> <ion-scroll scrollY="true" overflow-scroll="true">
<a class="passage-button" *ngFor="let ref of item.refs" (click)="openPassage(ref)">{{makePassage(ref)}}</a> <a class="passage-button" *ngFor="let ref of cardItem.data.refs" (click)="openPassage(ref)">{{makePassage(ref)}}</a>
</ion-scroll> </ion-scroll>
</ion-card-content> </ion-card-content>
<button ion-button icon-left clear small (click)="close()"> <button ion-button icon-left clear small (click)="close()">

View File

@ -14,10 +14,7 @@ export class Words
@Output() @Output()
onItemClicked = new EventEmitter<OpenData>(); onItemClicked = new EventEmitter<OpenData>();
@Input()
item: WordLookupResult;
@Input() @Input()
cardItem: CardItem; cardItem: CardItem;

View File

@ -44,12 +44,13 @@ export class UserProfile
reset(local: Storage) reset(local: Storage)
{ {
this.user.strongs_modal = true; this.user.strongs_modal = true;
this.user.clear_search_after_query = true; this.user.clear_search_after_query = false;
this.user.items = []; this.user.items = [];
this.user.append_to_bottom = false; this.user.append_to_bottom = false;
this.user.insert_next_to_item = false; this.user.insert_next_to_item = false;
this.user.font_size = 10; this.user.font_size = 10;
this.user.saved_pages = []; this.user.saved_pages = [];
this.user.verses_on_new_line = true;
this.save(local); this.save(local);
} }
@ -62,7 +63,8 @@ export class UserProfile
append_to_bottom: false, append_to_bottom: false,
insert_next_to_item: false, insert_next_to_item: false,
font_size: 10, font_size: 10,
saved_pages: [] saved_pages: [],
verses_on_new_line: true
}; };
} }
} }
@ -74,7 +76,8 @@ export type User = {
append_to_bottom: boolean, append_to_bottom: boolean,
insert_next_to_item: boolean, insert_next_to_item: boolean,
font_size: number, font_size: number,
saved_pages: SavedPage[] saved_pages: SavedPage[],
verses_on_new_line: boolean
} }
export type SavedPage = { export type SavedPage = {

View File

@ -34,9 +34,21 @@
<ion-content #searchcontent padding class="search-card"> <ion-content #searchcontent padding class="search-card">
<span style="font-size: .8em; color: #555;">CURRENT PAGE: {{title}}</span> <span style="font-size: .8em; color: #555;">CURRENT PAGE: {{title}}</span>
<ion-card *ngFor="let item of userProfile.user.items"> <ion-card *ngFor="let item of userProfile.user.items">
<error *ngIf="isError(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)"></error> <passage *ngIf="isPassage(item.type)"
<passage *ngIf="isPassage(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" [dict]="item.dict" (onItemClicked)="getItemsNextToCard($event)"></passage> [cardItem]="item"
<strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onItemClicked)="getItemsNextToCard($event)"></strongs> [versesOnNewLine]="userProfile.user.verses_on_new_line"
<words *ngIf="isWords(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onItemClicked)="getItemsNextToCard($event)"></words> (onClose)="removeItem($event)"
(onItemClicked)="getItemsNextToCard($event)"></passage>
<strongs *ngIf="isStrongs(item.type)"
[cardItem]="item"
(onClose)="removeItem($event)"
(onItemClicked)="getItemsNextToCard($event)"></strongs>
<words *ngIf="isWords(item.type)"
[cardItem]="item"
(onClose)="removeItem($event)"
(onItemClicked)="getItemsNextToCard($event)"></words>
<error *ngIf="isError(item.type)"
[cardItem]="item"
(onClose)="removeItem($event)"></error>
</ion-card> </ion-card>
</ion-content> </ion-content>

View File

@ -9,6 +9,10 @@
<ion-content padding> <ion-content padding>
<template [ngIf]="userProfile.user"> <template [ngIf]="userProfile.user">
<h4>Search Settings</h4> <h4>Search Settings</h4>
<ion-item>
<button ion-button (click)="reset()">Reset Settings</button>
</ion-item>
<ion-item> <ion-item>
<ion-label>Show Strongs as Modal</ion-label> <ion-label>Show Strongs as Modal</ion-label>
<ion-toggle color="dark" [(ngModel)]="userProfile.user.strongs_modal" (ionChange)="save()"></ion-toggle> <ion-toggle color="dark" [(ngModel)]="userProfile.user.strongs_modal" (ionChange)="save()"></ion-toggle>
@ -26,7 +30,8 @@
<ion-toggle color="dark" [(ngModel)]="userProfile.user.insert_next_to_item" (ionChange)="save()"></ion-toggle> <ion-toggle color="dark" [(ngModel)]="userProfile.user.insert_next_to_item" (ionChange)="save()"></ion-toggle>
</ion-item> </ion-item>
<ion-item> <ion-item>
<button ion-button (click)="reset()">Reset Settings</button> <ion-label>Each Verse on New Line</ion-label>
<ion-toggle color="dark" [(ngModel)]="userProfile.user.verses_on_new_line" (ionChange)="save()"></ion-toggle>
</ion-item> </ion-item>
<h4>Adjust Text</h4> <h4>Adjust Text</h4>