From 5a54a1a803e8e5b6ecaa62ce133570a4f7f57cf8 Mon Sep 17 00:00:00 2001 From: walljm Date: Fri, 19 Jan 2018 23:48:51 -0500 Subject: [PATCH] FEATURE: Add options to hide paragraphs and para headings --- .../src/components/passage/passage.scss | 2 +- .../src/components/passage/passage.ts | 13 ++++++++-- .../src/pages/search/search.html | 12 ++++++--- .../src/pages/settings/settings.html | 13 +++++++--- .../src/services/profile-service.ts | 25 +++++++++++-------- 5 files changed, 45 insertions(+), 20 deletions(-) diff --git a/DynamicBibleIonic/src/components/passage/passage.scss b/DynamicBibleIonic/src/components/passage/passage.scss index 98549dd0..30326b3a 100644 --- a/DynamicBibleIonic/src/components/passage/passage.scss +++ b/DynamicBibleIonic/src/components/passage/passage.scss @@ -22,7 +22,7 @@ passage .passage-text { } p { - text-indent: 1em; + //text-indent: 1em; } } diff --git a/DynamicBibleIonic/src/components/passage/passage.ts b/DynamicBibleIonic/src/components/passage/passage.ts index 96a735ef..1d883687 100644 --- a/DynamicBibleIonic/src/components/passage/passage.ts +++ b/DynamicBibleIonic/src/components/passage/passage.ts @@ -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) { } @@ -176,11 +177,19 @@ export class Passage implements OnInit getParas(ch: BiblePassage) { // group the verses into paragraphs. - + // create an initial paragraph to hold verses that might come before a paragraph. 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) { diff --git a/DynamicBibleIonic/src/pages/search/search.html b/DynamicBibleIonic/src/pages/search/search.html index 9fd700b7..15e21a8c 100644 --- a/DynamicBibleIonic/src/pages/search/search.html +++ b/DynamicBibleIonic/src/pages/search/search.html @@ -44,6 +44,15 @@ Show Verse #'s + + Show Paragraphs + + + + Show Paragraph Headings + + + Adjust Text @@ -65,9 +74,6 @@ - - - diff --git a/DynamicBibleIonic/src/pages/settings/settings.html b/DynamicBibleIonic/src/pages/settings/settings.html index 2ff83075..9531c692 100644 --- a/DynamicBibleIonic/src/pages/settings/settings.html +++ b/DynamicBibleIonic/src/pages/settings/settings.html @@ -9,10 +9,7 @@

Search Settings

- - - - + @@ -43,6 +40,14 @@ Each Verse on New Line + + Show Paragraphs + + + + Show Paragraph Headings + +

Adjust Text

diff --git a/DynamicBibleIonic/src/services/profile-service.ts b/DynamicBibleIonic/src/services/profile-service.ts index fc532369..cf67b919 100644 --- a/DynamicBibleIonic/src/services/profile-service.ts +++ b/DynamicBibleIonic/src/services/profile-service.ts @@ -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, }; }