FEATURE: Add options to hide paragraphs and para headings

This commit is contained in:
walljm 2018-01-19 23:48:51 -05:00
parent 2542da4ac0
commit 5a54a1a803
5 changed files with 45 additions and 20 deletions

View File

@ -22,7 +22,7 @@ passage .passage-text {
}
p {
text-indent: 1em;
//text-indent: 1em;
}
}

View File

@ -2,6 +2,7 @@ import { Component, EventEmitter, Output, Input, OnInit, ElementRef } from '@ang
import { OpenData, CardItem } from '../../pages/search/search';
import { BiblePassageResult, BibleService, BiblePassage, BibleVerse, HashTable, Paragraph } from '../../services/bible-service';
import { Reference } from '../../libs/Reference';
import { ProfileService } from '../../services/profile-service';
@Component({
selector: 'passage',
@ -27,7 +28,7 @@ export class Passage implements OnInit
data: BiblePassageResult;
ref: Reference;
constructor(private bibleService: BibleService, private elementRef: ElementRef)
constructor(private bibleService: BibleService, private elementRef: ElementRef, private profileService: ProfileService)
{
}
@ -181,6 +182,14 @@ export class Passage implements OnInit
let para: BiblePara = { p: { h: '', p: 0 }, vss: [] };
let paras: BiblePara[] = [];
// if you aren't showing paragraphs, stick em all in the same paragraph.
if (!this.profileService.profile().show_paragraphs)
{
para.vss = ch.vss;
paras.push(para);
return paras;
}
// for each verse in the chapter, break them into paragraphs.
for (let v of ch.vss)
{

View File

@ -44,6 +44,15 @@
<ion-label>Show Verse #'s</ion-label>
<ion-toggle color="dark" [(ngModel)]="this.profileService.profile().show_verse_numbers" (ionChange)="save()"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>Show Paragraphs</ion-label>
<ion-toggle color="dark" [(ngModel)]="profileService.profile().show_paragraphs" (ionChange)="save()"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>Show Paragraph Headings</ion-label>
<ion-toggle color="dark" [(ngModel)]="profileService.profile().show_paragraph_headings" (ionChange)="save()"></ion-toggle>
</ion-item>
<ion-list-header>Adjust Text</ion-list-header>
<ion-list>
<ion-item>
@ -65,9 +74,6 @@
<ion-item>
<button ion-button (click)="profileService.logout()">Logout</button>
</ion-item>
<ion-item>
<button ion-button (click)="profileService.Refresh()">Refresh</button>
</ion-item>
</ng-template>
</ion-content>
</ion-menu>

View File

@ -9,9 +9,6 @@
<ion-content padding>
<ng-template [ngIf]="profileService.profile()">
<h4>Search Settings</h4>
<ion-item>
<button ion-button (click)="profileService.reset()">Reset Settings</button>
</ion-item>
<ng-template [ngIf]="!profileService.currentUser()">
<ion-item>
@ -43,6 +40,14 @@
<ion-label>Each Verse on New Line</ion-label>
<ion-toggle color="dark" [(ngModel)]="profileService.profile().verses_on_new_line" (ionChange)="save()"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>Show Paragraphs</ion-label>
<ion-toggle color="dark" [(ngModel)]="profileService.profile().show_paragraphs" (ionChange)="save()"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>Show Paragraph Headings</ion-label>
<ion-toggle color="dark" [(ngModel)]="profileService.profile().show_paragraph_headings" (ionChange)="save()"></ion-toggle>
</ion-item>
<h4>Adjust Text</h4>
<ion-list>

View File

@ -30,6 +30,8 @@ export type User = {
saved_pages: SavedPage[],
verses_on_new_line: boolean,
show_verse_numbers: boolean,
show_paragraphs: boolean,
show_paragraph_headings: boolean,
}
export type SavedPage = {
@ -131,10 +133,6 @@ export class ProfileService
if (!user.saved_pages) user.saved_pages = [];
if (!user.items) user.items = [];
// merge the items so you don't loose anything.
if (this.profile().items.length > 0)
user.items.concat(this.localProfile.items);
// merge the saved pages so you don't loose those either
if (this.profile().saved_pages.length > 0)
user.saved_pages.concat(this.localProfile.saved_pages);
@ -142,6 +140,7 @@ export class ProfileService
// don't sync things that don't make sense.
this.profile().uid = user.uid;
this.profile().username = user.username;
this.profile().saved_pages = user.saved_pages;
// We only save the local change here since this is an update from our remote profile.
this.localSave();
@ -253,6 +252,8 @@ export class ProfileService
this.profile().saved_pages = [];
this.profile().verses_on_new_line = true;
this.profile().show_verse_numbers = true;
this.profile().show_paragraph_headings = true;
this.profile().show_paragraphs = true;
}
reset()
@ -282,15 +283,19 @@ export class ProfileService
return {
username: DEFAULT_USER_NAME,
uid: null,
strongs_modal: true,
clear_search_after_query: false,
items: [],
append_to_bottom: false,
insert_next_to_item: false,
font_size: 10,
saved_pages: [],
verses_on_new_line: true,
items: [],
strongs_modal: true,
clear_search_after_query: false,
append_to_bottom: false,
insert_next_to_item: false,
verses_on_new_line: false,
show_verse_numbers: true,
show_paragraphs: true,
show_paragraph_headings: true,
};
}