mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-26 17:10:11 -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({
|
||||
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: [
|
||||
'./src/polyfills.ts',
|
||||
'./src/mocks.ts',
|
||||
'./src/**/*.ts',
|
||||
'./src/**/*.spec.ts'
|
||||
{ pattern: './src/**/*.spec.ts', watched: false }
|
||||
],
|
||||
|
||||
exclude: [
|
||||
],
|
||||
|
||||
preprocessors: {
|
||||
'./src/polyfills.ts': ['karma-typescript'],
|
||||
'./src/mocks.ts': ['karma-typescript'],
|
||||
'./src/**/*.ts': ['karma-typescript'],
|
||||
'./src/**/*.spec.ts': ['karma-typescript']
|
||||
'./src/**/*.spec.ts': ['angular-cli']
|
||||
},
|
||||
|
||||
typescriptPreprocessor: {
|
||||
options: {
|
||||
sourceMap: false,
|
||||
target: 'ES5',
|
||||
module: 'amd',
|
||||
noImplicitAny: true,
|
||||
noResolve: true,
|
||||
removeComments: true,
|
||||
concatenateOutput: false
|
||||
},
|
||||
transformPath: function (path)
|
||||
{
|
||||
return path.replace(/\.ts$/, '.js');
|
||||
mime: {
|
||||
'text/x-typescript': ['ts', 'tsx']
|
||||
},
|
||||
remapIstanbulReporter: {
|
||||
reports: {
|
||||
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,
|
||||
colors: true,
|
||||
logLevel: config.LOG_DEBUG,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
||||
singleRun: false
|
||||
});
|
||||
};
|
@ -12,7 +12,7 @@
|
||||
"build": "ionic-app-scripts build",
|
||||
"ionic:build": "ionic-app-scripts build",
|
||||
"ionic:serve": "ionic-app-scripts serve",
|
||||
"test": "karma start karma.conf.js"
|
||||
"test": "ng test --code-coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/common": "2.2.1",
|
||||
@ -25,22 +25,32 @@
|
||||
"@angular/platform-browser-dynamic": "2.2.1",
|
||||
"@angular/platform-server": "2.2.1",
|
||||
"@ionic/storage": "1.1.7",
|
||||
"@types/jasmine": "^2.5.38",
|
||||
"ionic-angular": "2.0.0-rc.4",
|
||||
"ionic-native": "2.2.11",
|
||||
"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",
|
||||
"zone.js": "0.6.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ionic/app-scripts": "0.0.47",
|
||||
"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": [
|
||||
"cordova-plugin-whitelist",
|
||||
|
@ -5,7 +5,7 @@ import { Component, EventEmitter, Output, Input} from "@angular/core";
|
||||
})
|
||||
export class Passage {
|
||||
@Output()
|
||||
onStrongsClicked = new EventEmitter<string>();
|
||||
onStrongsClicked = new EventEmitter<OpenData>();
|
||||
@Output()
|
||||
onClose = new EventEmitter<CardItem>();
|
||||
|
||||
@ -25,7 +25,7 @@ export class Passage {
|
||||
this.onClose.emit(this.cardItem);
|
||||
}
|
||||
openStrongs(strongs: string) {
|
||||
this.onStrongsClicked.emit(this.dict+strongs);
|
||||
this.onStrongsClicked.emit({ card: this.cardItem, qry: this.dict + strongs });
|
||||
}
|
||||
|
||||
isPunct(c: string) {
|
||||
|
@ -10,7 +10,7 @@ export class StrongsModal {
|
||||
item: StrongsResult;
|
||||
|
||||
@Output()
|
||||
onPassageClicked = new EventEmitter<string>();
|
||||
onPassageClicked = new EventEmitter<OpenData>();
|
||||
|
||||
constructor(
|
||||
public platform: Platform,
|
||||
|
@ -10,7 +10,7 @@ export class Strongs {
|
||||
onClose = new EventEmitter<CardItem>();
|
||||
|
||||
@Output()
|
||||
onPassageClicked = new EventEmitter<string>();
|
||||
onPassageClicked = new EventEmitter<OpenData>();
|
||||
|
||||
@Input()
|
||||
item: StrongsResult;
|
||||
@ -30,6 +30,6 @@ export class Strongs {
|
||||
}
|
||||
openPassage(p: string) {
|
||||
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>();
|
||||
|
||||
@Output()
|
||||
onPassageClicked = new EventEmitter<string>();
|
||||
onPassageClicked = new EventEmitter<OpenData>();
|
||||
|
||||
@Input()
|
||||
item: WordLookupResult;
|
||||
@ -37,6 +37,6 @@ export class Words {
|
||||
openPassage(p: string)
|
||||
{
|
||||
let ref = this.makePassage(p);
|
||||
this.onPassageClicked.emit(ref);
|
||||
this.onPassageClicked.emit({ card: this.cardItem, qry: ref });
|
||||
}
|
||||
}
|
@ -8,9 +8,9 @@
|
||||
</ion-header>
|
||||
<ion-content padding class="search-card">
|
||||
<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>
|
||||
<strongs *ngIf="isStrongs(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItems($event)"></strongs>
|
||||
<words *ngIf="isWords(item.type)" [cardItem]="item" [item]="item.data" (onClose)="removeItem($event)" (onPassageClicked)="getItems($event)"></words>
|
||||
<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)="getItemsNextToCard($event)"></strongs>
|
||||
<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)">
|
||||
<ion-icon name="close-circle"></ion-icon>
|
||||
<div>Close</div>
|
||||
|
@ -24,8 +24,14 @@ class Item
|
||||
export class SearchPage
|
||||
{
|
||||
searchQuery: string = "";
|
||||
last: number;
|
||||
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
|
||||
};
|
||||
last: CardItem;
|
||||
|
||||
constructor(
|
||||
private strongsService: StrongsService
|
||||
@ -55,7 +61,6 @@ export class SearchPage
|
||||
|
||||
initializeItems(u: User)
|
||||
{
|
||||
this.last = u.items.length;
|
||||
this.user = u;
|
||||
}
|
||||
|
||||
@ -106,9 +111,32 @@ export class SearchPage
|
||||
addItemToList(item)
|
||||
{
|
||||
if (this.user.append_to_bottom)
|
||||
this.user.items.push(item);
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
this.user.items.unshift(item);
|
||||
{
|
||||
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
|
||||
this.user.items.unshift(item);
|
||||
}
|
||||
this.last = null;
|
||||
}
|
||||
|
||||
getItemsNextToCard(data: OpenData)
|
||||
{
|
||||
this.last = data.card;
|
||||
this.getItems(data.qry);
|
||||
}
|
||||
|
||||
getItems(search)
|
||||
@ -127,7 +155,7 @@ export class SearchPage
|
||||
if (q.search(/[0-9]/i) === -1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -146,7 +174,7 @@ export class SearchPage
|
||||
if (this.user.strongs_modal)
|
||||
this.presentStrongsModal(result);
|
||||
else
|
||||
this.addItemToList({ id: this.last++, data: result, type: "Strongs", dict: "na" });
|
||||
this.addItemToList({ data: result, type: "Strongs", dict: "na" });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -156,7 +184,7 @@ export class SearchPage
|
||||
let myref = new Reference(q.trim());
|
||||
let r = this.bibleService.getResult(myref.Section);
|
||||
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-toggle color="dark" [(ngModel)]="user.append_to_bottom" (ionChange)="save()"></ion-toggle>
|
||||
</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>
|
||||
<button ion-button (click)="reset()">Reset Settings</button>
|
||||
</ion-item>
|
||||
|
@ -10,7 +10,13 @@ import {UserHelpers} from '../../Helpers';
|
||||
})
|
||||
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)
|
||||
{
|
||||
@ -37,7 +43,13 @@ export class SettingsPage
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
type WordLookupResult = {
|
||||
type OpenData = {
|
||||
card: CardItem,
|
||||
qry: string
|
||||
}
|
||||
|
||||
type WordLookupResult = {
|
||||
refs: string[],
|
||||
word: string,
|
||||
status: Status,
|
||||
@ -10,13 +15,14 @@ type IndexResult = {
|
||||
refs: string[];
|
||||
word: string;
|
||||
}
|
||||
type CardItem = { id: number, data: any, type: string, dict: string }
|
||||
type CardItem = { data: any, type: string, dict: string }
|
||||
|
||||
type User = {
|
||||
strongs_modal: boolean,
|
||||
clear_search_after_query: boolean,
|
||||
items: CardItem[],
|
||||
append_to_bottom: boolean
|
||||
append_to_bottom: boolean,
|
||||
insert_next_to_item: boolean
|
||||
}
|
||||
|
||||
type BiblePassage = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user