Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit bb55646

Browse files
Cleanup and lint
1 parent 30e7236 commit bb55646

15 files changed

+30
-152
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"pree2e": "webdriver-manager update",
1313
"e2e": "protractor"
1414
},
15-
"private": true,
15+
"private": false,
1616
"dependencies": {
1717
"@angular/common": "2.0.0-rc.1",
1818
"@angular/compiler": "2.0.0-rc.1",

src/app/app.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ import { PreloadService } from './services/preload.service';
1717
import { ApiObservableService } from './services/api-observable.service';
1818
import { SermonsPageComponent } from './+sermons-page';
1919

20-
2120
@Component({
2221
moduleId: module.id,
23-
selector: 'app-root',
22+
selector: 'as-app-root',
2423
templateUrl: 'app.component.html',
2524
styleUrls: ['app.component.css'],
2625
encapsulation: ViewEncapsulation.None,

src/app/components/navbar/navbar.component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ import {ROUTER_DIRECTIVES} from '@angular/router';
55
import {ApiObservableService} from '../../services/api-observable.service';
66
import {PvLogoComponent} from '../pv-logo/index';
77

8+
// I don't think we need: CORE_DIRECTIVES, DROPDOWN_DIRECTIVES, ApiObservableService -- double check
9+
810
@Component({
911
moduleId: module.id,
1012
selector: 'as-navbar',
1113
templateUrl: 'navbar.component.html',
1214
styleUrls: ['navbar.component.css'],
13-
directives: [DROPDOWN_DIRECTIVES, CollapseDirective, CORE_DIRECTIVES, ROUTER_DIRECTIVES, PvLogoComponent],
15+
directives: [
16+
DROPDOWN_DIRECTIVES,
17+
CollapseDirective,
18+
CORE_DIRECTIVES,
19+
ROUTER_DIRECTIVES,
20+
PvLogoComponent
21+
],
1422
providers: [ApiObservableService]
1523
})
1624
export class NavbarComponent implements OnInit {
Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,2 @@
1-
import {
2-
beforeEach,
3-
beforeEachProviders,
4-
describe,
5-
expect,
6-
it,
7-
inject,
8-
} from '@angular/core/testing';
9-
import { ComponentFixture, TestComponentBuilder } from '@angular/compiler/testing';
10-
import { Component } from '@angular/core';
11-
import { By } from '@angular/platform-browser';
12-
import { PvLogoComponent } from './pv-logo.component';
131

14-
describe('Component: PvLogo', () => {
15-
let builder: TestComponentBuilder;
16-
17-
beforeEachProviders(() => [PvLogoComponent]);
18-
beforeEach(inject([TestComponentBuilder], function (tcb: TestComponentBuilder) {
19-
builder = tcb;
20-
}));
21-
22-
it('should inject the component', inject([PvLogoComponent],
23-
(component: PvLogoComponent) => {
24-
expect(component).toBeTruthy();
25-
}));
26-
27-
it('should create the component', inject([], () => {
28-
return builder.createAsync(PvLogoComponentTestController)
29-
.then((fixture: ComponentFixture<any>) => {
30-
let query = fixture.debugElement.query(By.directive(PvLogoComponent));
31-
expect(query).toBeTruthy();
32-
expect(query.componentInstance).toBeTruthy();
33-
});
34-
}));
35-
});
36-
37-
@Component({
38-
selector: 'test',
39-
template: `
40-
<app-pv-logo></app-pv-logo>
41-
`,
42-
directives: [PvLogoComponent]
43-
})
44-
class PvLogoComponentTestController {
45-
}
462

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component } from '@angular/core';
22

33
@Component({
44
moduleId: module.id,
55
selector: 'as-pv-logo',
66
templateUrl: 'pv-logo.component.html',
77
styleUrls: ['pv-logo.component.css']
88
})
9-
export class PvLogoComponent implements OnInit {
10-
11-
constructor() {}
12-
13-
ngOnInit() {
14-
}
15-
9+
export class PvLogoComponent {
1610
}

src/app/components/sermons-list/sermons-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="sermons container">
2-
<div *ngFor="let sermon of sermons | asSearchSermons:filterValues?.term:filterValues?.box1:filterValues?.box2:filterValues?.box3:filteredCount | orderBy:'Special':filterValues?.box1:filteredItems | paginate: config; let i = index"
2+
<div *ngFor="let sermon of sermons | asSearchSermons:filterValues?.term:filterValues?.box1:filterValues?.box2:filterValues?.box3:filteredCount | asOrderBy:'Special':filterValues?.box1:filteredItems | paginate: config; let i = index"
33
class="sermon-container"
44
[ngClass]="{'playing': current?.playing && current?.id == sermon?.key, 'current-sermon': current?.id == sermon?.key}">
55
<div class="sermon-art" (click)="current?.playing && current?.id === sermon?.key ? audioService.pause(): audioService.play(sermon?.key)">

src/app/pipes/order-by.pipe.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Pipe, PipeTransform } from '@angular/core';
22

33
@Pipe({
4-
name: 'orderBy'
4+
name: 'asOrderBy'
55
})
66
export class OrderBy implements PipeTransform {
77
static _orderByComparator(a: any, b: any): number {
@@ -31,7 +31,7 @@ export class OrderBy implements PipeTransform {
3131

3232
let splitOn = /[\s:\s-]+/;
3333
if (config === 'verse') {
34-
let result = input.sort( (a,b) => {
34+
let result = input.sort( (a, b) => {
3535
let x = a.verse.split(splitOn);
3636
let y = b.verse.split(splitOn);
3737
let sortLength = Math.min(x.length, y.length);
@@ -62,7 +62,7 @@ export class OrderBy implements PipeTransform {
6262
} else {
6363
// Loop over property of the array in order and sort
6464
return input.sort(function(a: any, b: any) {
65-
for(let i = 0; i < config.length; i++) {
65+
for (let i = 0; i < config.length; i++) {
6666
let desc = config[i].substr(0, 1) === '-';
6767
let property = config[i].substr(0, 1) === '+' || config[i].substr(0, 1) === '-'
6868
? config[i].substr(1)

src/app/pipes/search-sermons.pipe.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Pipe, PipeTransform } from '@angular/core';
22
import * as moment from 'moment';
33

4-
const momentConstructor: (value?: any) => moment.Moment = (<any>moment).default || moment;
5-
64
@Pipe({
75
name: 'asSearchSermons'
86
})
@@ -39,12 +37,12 @@ export class SearchSermons implements PipeTransform {
3937
}
4038
// Search terms
4139
if (term.length) {
42-
let speaker = (item.speaker).replace('Pastor ','');
40+
let speaker = (item.speaker).replace('Pastor ', '');
4341
let str = (
44-
item.name + ' ' +
45-
sermonVerse + ' ' +
46-
sermonYear + ' ' +
47-
sermonDate + ' ' +
42+
item.name + ' ' +
43+
sermonVerse + ' ' +
44+
sermonYear + ' ' +
45+
sermonDate + ' ' +
4846
speaker).toLowerCase();
4947
for (let i = 0 ; i < queries.length; i++) {
5048
if (str.indexOf( queries[i] ) === -1) { return false; }

src/app/services/audio.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Injectable, EventEmitter, Renderer } from '@angular/core';
1+
import { Injectable, Renderer } from '@angular/core';
22
import { ApiObservableService } from './api-observable.service';
33
import { Subject } from 'rxjs/Subject';
44
import * as moment from 'moment';
@@ -20,7 +20,7 @@ export class AudioService {
2020
art: {},
2121
randomClass: ''
2222
};
23-
public audioObjects = {}
23+
public audioObjects = {};
2424
public sermons;
2525
constructor(public apiObservableService: ApiObservableService, public renderer: Renderer) {
2626
this.preCurrentAudio$ = new Subject();
@@ -39,7 +39,7 @@ export class AudioService {
3939
// Create new audio object
4040
if (!(this.current.id in this.audioObjects)) {
4141
this.audioObjects[this.current.id] = new Audio();
42-
this.audioObjects[this.current.id].src = this.sermons[this.current.id]['audio'];
42+
this.audioObjects[this.current.id].src = this.sermons[this.current.id].audio;
4343
this.current.init = true;
4444
this.metaData = this.renderer.listen(
4545
this.audioObjects[this.current.id], 'timeupdate', (event) => {
@@ -86,8 +86,8 @@ export class AudioService {
8686
}
8787

8888
updatePosition() {
89-
let duration = ~~this.audioObjects[this.current.id].duration;
90-
let position = ~~this.audioObjects[this.current.id].currentTime;
89+
let duration = Math.floor(this.audioObjects[this.current.id].duration);
90+
let position = Math.floor(this.audioObjects[this.current.id].currentTime);
9191
let percentage = (position / duration) * 100;
9292
let displayPosition = this.displayTime(position);
9393
this.preAudioPosition$.next({
@@ -120,8 +120,8 @@ export class AudioService {
120120
}
121121

122122
setPosition(percentage) {
123-
let newPosition = ~~this.audioObjects[this.current.id].duration * percentage * 0.01;
123+
let newPosition = Math.floor(this.audioObjects[this.current.id].duration * percentage * 0.01);
124124
this.audioObjects[this.current.id].currentTime = newPosition;
125125
}
126-
126+
127127
}

src/app/services/bible.service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
22

33
@Injectable()
44
export class BibleService {
5-
6-
constructor() {}
75
books() {
86
return [
97
'Genesis', 'Exodus', 'Leviticus', 'Numbers',

src/app/services/test-service.service.spec.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/app/services/test-service.service.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/app/services/utilities.service.spec.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/app/services/utilities.service.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<meta name="viewport" content="width=device-width, initial-scale=1">
1717
</head>
1818
<body>
19-
<app-root>Loading...</app-root>
19+
<as-app-root>Loading...</as-app-root>
2020
<!-- TODO: Move Firebase to system-config -->
2121
<script src="https://cdn.firebase.com/js/client/2.4.2/firebase.js"></script>
2222
{{#each scripts.polyfills}}

0 commit comments

Comments
 (0)