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-card-content>
<br>
<p>{{item}}</p>
<p>{{cardItem.data}}</p>
</ion-card-content>
<button ion-button icon-left clear small (click)="close()">
<ion-icon name="close-circle"></ion-icon>

View File

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

View File

@ -1,5 +1,5 @@
<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()">
<ion-icon name="close-circle"></ion-icon>
</button>
@ -7,15 +7,15 @@
<ion-card-content>
<br>
<div class="passage-text" *ngFor="let ch of item.cs">
<h2 *ngIf="item.cs.length > 1">
<div class="passage-text" *ngFor="let ch of cardItem.data.cs">
<h2 *ngIf="cardItem.data.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">
<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>
</span><br>
</span><br *ngIf="versesOnNewLine">
</span>
</div>
</ion-card-content>

View File

@ -13,14 +13,11 @@ export class Passage
@Output()
onClose = new EventEmitter<CardItem>();
@Input()
item: BiblePassageResult;
@Input()
dict: string;
@Input()
cardItem: CardItem;
@Input()
versesOnNewLine: boolean;
constructor()
{
@ -33,7 +30,7 @@ export class Passage
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)

View File

@ -1,5 +1,5 @@
<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()">
<ion-icon name="close-circle"></ion-icon>
</button>
@ -9,16 +9,16 @@
<div class="strongs-def">
<h2>Strongs Definitition</h2>
<p>
<b>{{item.def.tr}} <template [ngIf]="item.def.sn != null">({{item.def.sn}})</template></b>
- {{item.def.p}} - {{item.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>
<b>{{cardItem.data.def.tr}} <template [ngIf]="cardItem.data.def.sn != null">({{cardItem.data.def.sn}})</template></b>
- {{cardItem.data.def.p}} - {{cardItem.data.def.lemma}} -
<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>
<template [ngIf]="item.rmac !== null">
<template [ngIf]="cardItem.data.rmac !== null">
<h2>RMAC</h2>
<b>{{item.rmac.id}}</b>
<br>
<ul>
<li *ngFor="let c of item.rmac.d">
<li *ngFor="let c of cardItem.data.rmac.d">
{{c}}
</li>
</ul>
@ -28,7 +28,7 @@
<h2>Cross References</h2>
<ion-scroll scrollY="true">
<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>
</dd>
</dl>

View File

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

View File

@ -1,12 +1,12 @@
<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()">
<ion-icon name="close-circle"></ion-icon>
</button>
</ion-item>
<ion-card-content>
<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-card-content>
<button ion-button icon-left clear small (click)="close()">

View File

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

View File

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

View File

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

View File

@ -9,6 +9,10 @@
<ion-content padding>
<template [ngIf]="userProfile.user">
<h4>Search Settings</h4>
<ion-item>
<button ion-button (click)="reset()">Reset Settings</button>
</ion-item>
<ion-item>
<ion-label>Show Strongs as Modal</ion-label>
<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-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>
<h4>Adjust Text</h4>