mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-27 01:19:52 -04:00
FEATURE: Added option to insert new card above or below the card you clicked from.
* some mods for testing (still not working)
This commit is contained in:
parent
5c85bfdb19
commit
b60e2de7cf
@ -2,47 +2,41 @@ module.exports = function (config)
|
|||||||
{
|
{
|
||||||
config.set({
|
config.set({
|
||||||
basePath: '',
|
basePath: '',
|
||||||
frameworks: ['jasmine', 'karma-typescript'],
|
frameworks: ['jasmine', 'angular-cli'],
|
||||||
|
plugins: [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-remap-istanbul'),
|
||||||
|
require('karma-mocha-reporter'),
|
||||||
|
require('angular-cli/plugins/karma')
|
||||||
|
],
|
||||||
files: [
|
files: [
|
||||||
'./src/polyfills.ts',
|
{ pattern: './src/**/*.spec.ts', watched: false }
|
||||||
'./src/mocks.ts',
|
|
||||||
'./src/**/*.ts',
|
|
||||||
'./src/**/*.spec.ts'
|
|
||||||
],
|
],
|
||||||
|
|
||||||
exclude: [
|
|
||||||
],
|
|
||||||
|
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'./src/polyfills.ts': ['karma-typescript'],
|
'./src/**/*.spec.ts': ['angular-cli']
|
||||||
'./src/mocks.ts': ['karma-typescript'],
|
|
||||||
'./src/**/*.ts': ['karma-typescript'],
|
|
||||||
'./src/**/*.spec.ts': ['karma-typescript']
|
|
||||||
},
|
},
|
||||||
|
mime: {
|
||||||
typescriptPreprocessor: {
|
'text/x-typescript': ['ts', 'tsx']
|
||||||
options: {
|
|
||||||
sourceMap: false,
|
|
||||||
target: 'ES5',
|
|
||||||
module: 'amd',
|
|
||||||
noImplicitAny: true,
|
|
||||||
noResolve: true,
|
|
||||||
removeComments: true,
|
|
||||||
concatenateOutput: false
|
|
||||||
},
|
},
|
||||||
transformPath: function (path)
|
remapIstanbulReporter: {
|
||||||
{
|
reports: {
|
||||||
return path.replace(/\.ts$/, '.js');
|
html: 'coverage',
|
||||||
|
lcovonly: './coverage/coverage.lcov'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reporters: ['progress', 'karma-typescript'],
|
angularCli: {
|
||||||
|
config: './angular-cli.json',
|
||||||
|
environment: 'dev'
|
||||||
|
},
|
||||||
|
reporters: config.angularCli && config.angularCli.codeCoverage
|
||||||
|
? ['mocha', 'karma-remap-istanbul']
|
||||||
|
: ['mocha'],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
colors: true,
|
colors: true,
|
||||||
logLevel: config.LOG_DEBUG,
|
logLevel: config.LOG_INFO,
|
||||||
autoWatch: true,
|
autoWatch: true,
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
singleRun: false,
|
singleRun: false
|
||||||
concurrency: Infinity
|
});
|
||||||
})
|
};
|
||||||
}
|
|
@ -12,7 +12,7 @@
|
|||||||
"build": "ionic-app-scripts build",
|
"build": "ionic-app-scripts build",
|
||||||
"ionic:build": "ionic-app-scripts build",
|
"ionic:build": "ionic-app-scripts build",
|
||||||
"ionic:serve": "ionic-app-scripts serve",
|
"ionic:serve": "ionic-app-scripts serve",
|
||||||
"test": "karma start karma.conf.js"
|
"test": "ng test --code-coverage"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/common": "2.2.1",
|
"@angular/common": "2.2.1",
|
||||||
@ -25,22 +25,32 @@
|
|||||||
"@angular/platform-browser-dynamic": "2.2.1",
|
"@angular/platform-browser-dynamic": "2.2.1",
|
||||||
"@angular/platform-server": "2.2.1",
|
"@angular/platform-server": "2.2.1",
|
||||||
"@ionic/storage": "1.1.7",
|
"@ionic/storage": "1.1.7",
|
||||||
"@types/jasmine": "^2.5.38",
|
|
||||||
"ionic-angular": "2.0.0-rc.4",
|
"ionic-angular": "2.0.0-rc.4",
|
||||||
"ionic-native": "2.2.11",
|
"ionic-native": "2.2.11",
|
||||||
"ionicons": "3.0.0",
|
"ionicons": "3.0.0",
|
||||||
"jasmine-core": "^2.5.2",
|
|
||||||
"karma": "^1.3.0",
|
|
||||||
"karma-chrome-launcher": "^2.0.0",
|
|
||||||
"karma-jasmine": "^1.1.0",
|
|
||||||
"karma-typescript": "^2.1.5",
|
|
||||||
"rxjs": "5.0.0-beta.12",
|
"rxjs": "5.0.0-beta.12",
|
||||||
"zone.js": "0.6.26"
|
"zone.js": "0.6.26"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ionic/app-scripts": "0.0.47",
|
"@ionic/app-scripts": "0.0.47",
|
||||||
"karma": "^1.3.0",
|
"karma": "^1.3.0",
|
||||||
"typescript": "2.0.9"
|
"typescript": "2.0.9",
|
||||||
|
"@types/jasmine": "2.5.38",
|
||||||
|
"@types/node": "6.0.42",
|
||||||
|
"angular-cli": "1.0.0-beta.24",
|
||||||
|
"codecov": "1.0.1",
|
||||||
|
"jasmine-core": "2.5.2",
|
||||||
|
"jasmine-spec-reporter": "2.7.0",
|
||||||
|
"karma-chrome-launcher": "2.0.0",
|
||||||
|
"karma-cli": "1.0.1",
|
||||||
|
"karma-jasmine": "1.1.0",
|
||||||
|
"karma-mocha-reporter": "2.2.1",
|
||||||
|
"karma-remap-istanbul": "0.2.2",
|
||||||
|
"protractor": "4.0.13",
|
||||||
|
"protractor-jasmine2-screenshot-reporter": "0.3.2",
|
||||||
|
"ts-node": "1.7.2",
|
||||||
|
"tslint": "4.1.1",
|
||||||
|
"tslint-eslint-rules": "3.2.0"
|
||||||
},
|
},
|
||||||
"cordovaPlugins": [
|
"cordovaPlugins": [
|
||||||
"cordova-plugin-whitelist",
|
"cordova-plugin-whitelist",
|
||||||
|
@ -5,7 +5,7 @@ import { Component, EventEmitter, Output, Input} from "@angular/core";
|
|||||||
})
|
})
|
||||||
export class Passage {
|
export class Passage {
|
||||||
@Output()
|
@Output()
|
||||||
onStrongsClicked = new EventEmitter<string>();
|
onStrongsClicked = new EventEmitter<OpenData>();
|
||||||
@Output()
|
@Output()
|
||||||
onClose = new EventEmitter<CardItem>();
|
onClose = new EventEmitter<CardItem>();
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ export class Passage {
|
|||||||
this.onClose.emit(this.cardItem);
|
this.onClose.emit(this.cardItem);
|
||||||
}
|
}
|
||||||
openStrongs(strongs: string) {
|
openStrongs(strongs: string) {
|
||||||
this.onStrongsClicked.emit(this.dict+strongs);
|
this.onStrongsClicked.emit({ card: this.cardItem, qry: this.dict + strongs });
|
||||||
}
|
}
|
||||||
|
|
||||||
isPunct(c: string) {
|
isPunct(c: string) {
|
||||||
|
@ -10,7 +10,7 @@ export class StrongsModal {
|
|||||||
item: StrongsResult;
|
item: StrongsResult;
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
onPassageClicked = new EventEmitter<string>();
|
onPassageClicked = new EventEmitter<OpenData>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public platform: Platform,
|
public platform: Platform,
|
||||||
|
@ -10,7 +10,7 @@ export class Strongs {
|
|||||||
onClose = new EventEmitter<CardItem>();
|
onClose = new EventEmitter<CardItem>();
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
onPassageClicked = new EventEmitter<string>();
|
onPassageClicked = new EventEmitter<OpenData>();
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
item: StrongsResult;
|
item: StrongsResult;
|
||||||
@ -30,6 +30,6 @@ export class Strongs {
|
|||||||
}
|
}
|
||||||
openPassage(p: string) {
|
openPassage(p: string) {
|
||||||
let ref = this.makePassage(p);
|
let ref = this.makePassage(p);
|
||||||
this.onPassageClicked.emit(ref);
|
this.onPassageClicked.emit({ card: this.cardItem, qry: ref });
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ export class Words {
|
|||||||
onClose = new EventEmitter<CardItem>();
|
onClose = new EventEmitter<CardItem>();
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
onPassageClicked = new EventEmitter<string>();
|
onPassageClicked = new EventEmitter<OpenData>();
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
item: WordLookupResult;
|
item: WordLookupResult;
|
||||||
@ -37,6 +37,6 @@ export class Words {
|
|||||||
openPassage(p: string)
|
openPassage(p: string)
|
||||||
{
|
{
|
||||||
let ref = this.makePassage(p);
|
let ref = this.makePassage(p);
|
||||||
this.onPassageClicked.emit(ref);
|
this.onPassageClicked.emit({ card: this.cardItem, qry: ref });
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,9 +8,9 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content padding class="search-card">
|
<ion-content padding class="search-card">
|
||||||
<ion-card *ngFor="let item of user.items">
|
<ion-card *ngFor="let item of user.items">
|
||||||
<passage *ngIf="isPassage(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" [dict]="item.dict" (onStrongsClicked)="getItems($event)"></passage>
|
<passage *ngIf="isPassage(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" [dict]="item.dict" (onStrongsClicked)="getItemsNextToCard($event)"></passage>
|
||||||
<strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItems($event)"></strongs>
|
<strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItemsNextToCard($event)"></strongs>
|
||||||
<words *ngIf="isWords(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItems($event)"></words>
|
<words *ngIf="isWords(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItemsNextToCard($event)"></words>
|
||||||
<button ion-button icon-left clear small (click)="removeItem(item)">
|
<button ion-button icon-left clear small (click)="removeItem(item)">
|
||||||
<ion-icon name="close-circle"></ion-icon>
|
<ion-icon name="close-circle"></ion-icon>
|
||||||
<div>Close</div>
|
<div>Close</div>
|
||||||
|
@ -24,8 +24,14 @@ class Item
|
|||||||
export class SearchPage
|
export class SearchPage
|
||||||
{
|
{
|
||||||
searchQuery: string = "";
|
searchQuery: string = "";
|
||||||
last: number;
|
user: User = {
|
||||||
user: User = { strongs_modal: true, clear_search_after_query: true, items: [], append_to_bottom: false };
|
strongs_modal: true,
|
||||||
|
clear_search_after_query: true,
|
||||||
|
items: [],
|
||||||
|
append_to_bottom: false,
|
||||||
|
insert_next_to_item: false
|
||||||
|
};
|
||||||
|
last: CardItem;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private strongsService: StrongsService
|
private strongsService: StrongsService
|
||||||
@ -55,7 +61,6 @@ export class SearchPage
|
|||||||
|
|
||||||
initializeItems(u: User)
|
initializeItems(u: User)
|
||||||
{
|
{
|
||||||
this.last = u.items.length;
|
|
||||||
this.user = u;
|
this.user = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,10 +111,33 @@ export class SearchPage
|
|||||||
addItemToList(item)
|
addItemToList(item)
|
||||||
{
|
{
|
||||||
if (this.user.append_to_bottom)
|
if (this.user.append_to_bottom)
|
||||||
|
{
|
||||||
|
if (this.last != null && this.user.insert_next_to_item)
|
||||||
|
{
|
||||||
|
let idx = this.user.items.indexOf(this.last);
|
||||||
|
this.user.items.splice(idx + 1, 0, item);
|
||||||
|
}
|
||||||
|
else
|
||||||
this.user.items.push(item);
|
this.user.items.push(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.last != null && this.user.insert_next_to_item)
|
||||||
|
{
|
||||||
|
let idx = this.user.items.indexOf(this.last);
|
||||||
|
this.user.items.splice(idx, 0, item);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
this.user.items.unshift(item);
|
this.user.items.unshift(item);
|
||||||
}
|
}
|
||||||
|
this.last = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
getItemsNextToCard(data: OpenData)
|
||||||
|
{
|
||||||
|
this.last = data.card;
|
||||||
|
this.getItems(data.qry);
|
||||||
|
}
|
||||||
|
|
||||||
getItems(search)
|
getItems(search)
|
||||||
{
|
{
|
||||||
@ -127,7 +155,7 @@ export class SearchPage
|
|||||||
if (q.search(/[0-9]/i) === -1)
|
if (q.search(/[0-9]/i) === -1)
|
||||||
{
|
{
|
||||||
let result = this.wordService.getResult(q);
|
let result = this.wordService.getResult(q);
|
||||||
this.addItemToList({ id: this.last++, data: result, type: "Words", dict: "na" });
|
this.addItemToList({ data: result, type: "Words", dict: "na" });
|
||||||
}
|
}
|
||||||
else if (q.search(/(H|G)[0-9]/i) !== -1)
|
else if (q.search(/(H|G)[0-9]/i) !== -1)
|
||||||
{
|
{
|
||||||
@ -146,7 +174,7 @@ export class SearchPage
|
|||||||
if (this.user.strongs_modal)
|
if (this.user.strongs_modal)
|
||||||
this.presentStrongsModal(result);
|
this.presentStrongsModal(result);
|
||||||
else
|
else
|
||||||
this.addItemToList({ id: this.last++, data: result, type: "Strongs", dict: "na" });
|
this.addItemToList({ data: result, type: "Strongs", dict: "na" });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -156,7 +184,7 @@ export class SearchPage
|
|||||||
let myref = new Reference(q.trim());
|
let myref = new Reference(q.trim());
|
||||||
let r = this.bibleService.getResult(myref.Section);
|
let r = this.bibleService.getResult(myref.Section);
|
||||||
r.ref = myref.toString();
|
r.ref = myref.toString();
|
||||||
this.addItemToList({ id: this.last++, data: r, type: "Passage", dict: r.testament == 'new' ? "G" : "H" });
|
this.addItemToList({ data: r, type: "Passage", dict: r.testament == 'new' ? "G" : "H" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
<ion-label>Append Results to the Bottom of List</ion-label>
|
<ion-label>Append Results to the Bottom of List</ion-label>
|
||||||
<ion-toggle color="dark" [(ngModel)]="user.append_to_bottom" (ionChange)="save()"></ion-toggle>
|
<ion-toggle color="dark" [(ngModel)]="user.append_to_bottom" (ionChange)="save()"></ion-toggle>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>Insert Results Next To Item</ion-label>
|
||||||
|
<ion-toggle color="dark" [(ngModel)]="user.insert_next_to_item" (ionChange)="save()"></ion-toggle>
|
||||||
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<button ion-button (click)="reset()">Reset Settings</button>
|
<button ion-button (click)="reset()">Reset Settings</button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
@ -10,7 +10,13 @@ import {UserHelpers} from '../../Helpers';
|
|||||||
})
|
})
|
||||||
export class SettingsPage
|
export class SettingsPage
|
||||||
{
|
{
|
||||||
user: User = { strongs_modal: true, clear_search_after_query: true, items: [], append_to_bottom: false };
|
user: User = {
|
||||||
|
strongs_modal: true,
|
||||||
|
clear_search_after_query: true,
|
||||||
|
items: [],
|
||||||
|
append_to_bottom: false,
|
||||||
|
insert_next_to_item: false
|
||||||
|
};
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public local: Storage)
|
constructor(public navCtrl: NavController, public local: Storage)
|
||||||
{
|
{
|
||||||
@ -37,7 +43,13 @@ export class SettingsPage
|
|||||||
|
|
||||||
reset()
|
reset()
|
||||||
{
|
{
|
||||||
this.user = { strongs_modal: true, clear_search_after_query: true, items: [], append_to_bottom: false };
|
this.user = {
|
||||||
|
strongs_modal: true,
|
||||||
|
clear_search_after_query: true,
|
||||||
|
items: [],
|
||||||
|
append_to_bottom: false,
|
||||||
|
insert_next_to_item: false
|
||||||
|
};
|
||||||
this.save();
|
this.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
type WordLookupResult = {
|
type OpenData = {
|
||||||
|
card: CardItem,
|
||||||
|
qry: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type WordLookupResult = {
|
||||||
refs: string[],
|
refs: string[],
|
||||||
word: string,
|
word: string,
|
||||||
status: Status,
|
status: Status,
|
||||||
@ -10,13 +15,14 @@ type IndexResult = {
|
|||||||
refs: string[];
|
refs: string[];
|
||||||
word: string;
|
word: string;
|
||||||
}
|
}
|
||||||
type CardItem = { id: number, data: any, type: string, dict: string }
|
type CardItem = { data: any, type: string, dict: string }
|
||||||
|
|
||||||
type User = {
|
type User = {
|
||||||
strongs_modal: boolean,
|
strongs_modal: boolean,
|
||||||
clear_search_after_query: boolean,
|
clear_search_after_query: boolean,
|
||||||
items: CardItem[],
|
items: CardItem[],
|
||||||
append_to_bottom: boolean
|
append_to_bottom: boolean,
|
||||||
|
insert_next_to_item: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type BiblePassage = {
|
type BiblePassage = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user