Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Manduro committed Jun 28, 2016
2 parents 7f4ec96 + e3c5166 commit 24ac40e
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 40 deletions.
8 changes: 6 additions & 2 deletions app/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Type, ViewChild } from '@angular/core';
import { Nav, Platform, Loading } from 'ionic-angular';
import { Keyboard, Splashscreen, StatusBar } from 'ionic-native';
import { GoogleAnalytics, Keyboard, Splashscreen, StatusBar } from 'ionic-native';
import { Deploy } from '@ionic/cloud-angular';

import { AuthService } from './services/auth';
Expand All @@ -21,13 +21,17 @@ export class LustrumApp {
private notifier: NotificationService,
private deploy: Deploy
) {
this.initializeCordova();
this.initializeRootPage();
if (this.platform.is('cordova')) {
this.initializeCordova();
}
}

private initializeCordova() {
this.platform.ready().then(() => {
Keyboard.disableScroll(true);
GoogleAnalytics.startTrackerWithId('UA-79997582-1');
GoogleAnalytics.enableUncaughtExceptionReporting(true);
this.runDeploy();
});
}
Expand Down
37 changes: 37 additions & 0 deletions app/directives/maps-href.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Directive, ElementRef, Input, OnInit } from '@angular/core';
import { Platform } from 'ionic-angular';


@Directive({
selector: '[csrMapsHref]'
})
export class MapsHrefDirective implements OnInit {
@Input('csrMapsHref') mapsQuery: string;

private el: HTMLElement;

constructor(
el: ElementRef,
private platform: Platform
) {
this.el = el.nativeElement;
}

ngOnInit() {
let query = encodeURIComponent(this.mapsQuery);
let url = this.getPlatformMapsUrl();
this.el.setAttribute('href', url + query);
}

private getPlatformMapsUrl(): string {
if (this.platform.is('mobile')) {
if (this.platform.is('ios')) {
return 'maps://maps.apple.com/?q=';
} else {
return 'geo:0,0?q=';
}
} else {
return 'https://maps.google.com?q=';
}
}
}
5 changes: 5 additions & 0 deletions app/pages/about/about.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { Loading, NavController } from 'ionic-angular';
import { GoogleAnalytics } from 'ionic-native';

import { SystemBrowserDirective } from '../../directives/system-browser';
import { AuthService } from '../../services/auth';
Expand Down Expand Up @@ -30,4 +31,8 @@ export class AboutPage {
}, 1000);
}

ionViewDidEnter() {
GoogleAnalytics.trackView('About');
}

}
2 changes: 1 addition & 1 deletion app/pages/event-detail/event-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div padding>
<h4>{{ event.naam || event.titel }}</h4>
<p><a *ngIf="event.locatie" [href]="getLocationUrl(event.locatie)">
<p><a *ngIf="event.locatie" [csrMapsHref]="event.locatie">
{{ event.locatie }}
</a></p>
<p subdued class="preserve-whitespace">{{ getDateTimes(event._meta.start, event._meta.end) }}</p>
Expand Down
16 changes: 10 additions & 6 deletions app/pages/event-detail/event-detail.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { Component } from '@angular/core';
import { DomSanitizationService } from '@angular/platform-browser';
import { NavParams, Toast } from 'ionic-angular';
import { GoogleAnalytics } from 'ionic-native';
import * as moment from 'moment';
import 'moment/locale/nl';

import { MapsHrefDirective } from '../../directives/maps-href';
import { NotificationService } from '../../services/notification';
import { ApiData } from '../../services/api-data';
import { Event } from '../../models/event';


@Component({
templateUrl: 'build/pages/event-detail/event-detail.html'
templateUrl: 'build/pages/event-detail/event-detail.html',
directives: [MapsHrefDirective]
})
export class EventDetailPage {
event: Event;
Expand All @@ -25,11 +28,6 @@ export class EventDetailPage {
this.event = navParams.data;
}

getLocationUrl(location: string): any {
let url = 'geo:0,0?q=' + encodeURIComponent(location);
return this.sanitizer.bypassSecurityTrustUrl(url);
}

getDateTimes(start: any, end: any): string {
let line1, line2: string;
let multipleDays: boolean = !start.isSame(end, 'day');
Expand Down Expand Up @@ -77,6 +75,7 @@ export class EventDetailPage {
this.apiData.postAction(cat, id, 'aanmelden').then((event: Event) => {
this.apiData.addJoined(cat, Number(id));
this.event = this.apiData.addEventMeta(event);
GoogleAnalytics.trackEvent('Events', 'Join', event._meta.category, id);
return 'Aanmelden gelukt!';
}, error => {
console.log(error);
Expand All @@ -96,6 +95,7 @@ export class EventDetailPage {
this.apiData.postAction(cat, id, 'afmelden').then((event: Event) => {
this.apiData.removeJoined(cat, Number(id));
this.event = this.apiData.addEventMeta(event);
GoogleAnalytics.trackEvent('Events', 'Leave', event._meta.category, id);
return 'Afmelden gelukt!';
}, error => {
console.log(error);
Expand All @@ -105,4 +105,8 @@ export class EventDetailPage {
this.processingAction = false;
});
}

ionViewDidEnter() {
GoogleAnalytics.trackView('Event Detail');
}
}
5 changes: 5 additions & 0 deletions app/pages/event-list/event-list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { Alert, Modal, NavController } from 'ionic-angular';
import { GoogleAnalytics } from 'ionic-native';
import * as _ from 'lodash';
import * as moment from 'moment';
import 'moment/locale/nl';
Expand Down Expand Up @@ -80,4 +81,8 @@ export class EventListPage {
this.nav.push(EventDetailPage, event);
}

ionViewDidEnter() {
GoogleAnalytics.trackView('Event List');
}

}
5 changes: 5 additions & 0 deletions app/pages/map/map.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { GoogleAnalytics } from 'ionic-native';

import { TripDetailPage } from '../trip-detail/trip-detail';
import { TripDetailTwoPage } from '../trip-detail-two/trip-detail-two';
Expand Down Expand Up @@ -79,4 +80,8 @@ export class MapPage {
mapEle.classList.add('show-map');
});
}

ionViewDidEnter() {
GoogleAnalytics.trackView('Map');
}
}
8 changes: 4 additions & 4 deletions app/pages/member-detail/member-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ion-header>
<ion-navbar primary>
<ion-title>{{ member.naam.voornaam }} {{ member.naam.tussenvoegsel }} {{ member.naam.achternaam }}</ion-title>
<ion-buttons end hideWhen="android">
<ion-buttons end showWhen="cordova" hideWhen="android">
<button (click)="save()">
<ion-icon name="person-add"></ion-icon>
</button>
Expand All @@ -29,7 +29,7 @@ <h3>{{ member.email }}</h3>
</a>

<a ion-item detail-none [href]="'tel:' + member.mobiel">
<a button item-right clear [href]="getSafeUrl('sms', member.mobiel)">
<a button item-right clear [href]="getSafeUrl('sms', member.mobiel)" hideWhen="core">
<ion-icon primary name="text" isActive="false"></ion-icon>
</a>
<a button item-right clear [href]="getSafeUrl('tel', member.mobiel)">
Expand All @@ -39,7 +39,7 @@ <h3>{{ member.email }}</h3>
<h3>{{ member.mobiel }}</h3>
</a>

<a ion-item detail-none [href]="getLocationUrl(member.huis)">
<a ion-item detail-none [csrMapsHref]="member.huis.adres + ', ' + member.huis.woonplaats">
<ion-icon name="map" isActive="false" primary item-right></ion-icon>
<p primary>{{ member.huis.naam || 'adres' }}</p>
<h3>
Expand Down Expand Up @@ -71,7 +71,7 @@ <h3>{{ member.studie.naam }} ({{ member.studie.sinds }})</h3>

</ion-list>

<button fab fab-right fab-bottom fab-fixed lustrumgreen showWhen="android" (click)="save()">
<button fab fab-right fab-bottom fab-fixed lustrumgreen showWhen="cordova" hideWhen="ios" (click)="save()">
<ion-icon name="person-add"></ion-icon>
</button>

Expand Down
17 changes: 9 additions & 8 deletions app/pages/member-detail/member-detail.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Component } from '@angular/core';
import { DomSanitizationService } from '@angular/platform-browser';
import { ActionSheet, NavController, NavParams, Platform } from 'ionic-angular';
import { Contacts, Calendar } from 'ionic-native';
import { Contacts, Calendar, GoogleAnalytics } from 'ionic-native';
import * as moment from 'moment';
import 'moment/locale/nl';

import { MapsHrefDirective } from '../../directives/maps-href';
import { NotificationService } from '../../services/notification';
import { Member } from '../../models/member';


@Component({
templateUrl: 'build/pages/member-detail/member-detail.html'
templateUrl: 'build/pages/member-detail/member-detail.html',
directives: [MapsHrefDirective]
})
export class MemberDetailPage {
member: Member;
Expand All @@ -29,12 +31,6 @@ export class MemberDetailPage {
this.member.geboortedatum = date;
}

getLocationUrl(huis): any {
let q = encodeURIComponent(this.member.huis.adres + ', ' + this.member.huis.woonplaats);
let url = this.platform.is('ios') ? 'maps://maps.apple.com/?q=' : 'geo:0,0?q=';
return this.sanitizer.bypassSecurityTrustUrl(url + q);
}

getSafeUrl(scheme: string, target: string): any {
let url = scheme + ':' + encodeURIComponent(target);
return this.sanitizer.bypassSecurityTrustUrl(url);
Expand Down Expand Up @@ -87,6 +83,7 @@ export class MemberDetailPage {
let createdContact = Contacts.create(contact);
createdContact.save(
contact => {
GoogleAnalytics.trackEvent('Members', 'Save', 'New');
this.notifier.notify('Succesvol opgeslagen in contacten.');
},
err => {
Expand All @@ -106,4 +103,8 @@ export class MemberDetailPage {

Calendar.openCalendar(date.toDate());
}

ionViewDidEnter() {
GoogleAnalytics.trackView('Member Detail');
}
}
6 changes: 3 additions & 3 deletions app/pages/member-list/member-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<ion-navbar primary>
<ion-title>Ledenlijst</ion-title>
<ion-buttons end>
<button showWhen="android" (click)="startSearch()">
<button hideWhen="ios" (click)="startSearch(searchFocus)">
<ion-icon name="search"></ion-icon>
</button>
</ion-buttons>
<ion-searchbar showWhen="android" class="search-overlay" placeholder="Zoek op naam of lidnummer" [(ngModel)]="queryText" (ionInput)="queryMembers()" (ionBlur)="stopSearchSoft()" (ionCancel)="stopSearch()" [hidden]="!searching" debounce="50">
<ion-searchbar hideWhen="ios" class="search-overlay" placeholder="Zoek op naam of lidnummer" [(ngModel)]="queryText" #searchFocus (ionInput)="queryMembers()" (ionBlur)="stopSearchSoft()" (ionCancel)="stopSearch()" [hidden]="!searching" debounce="50">
</ion-searchbar>
</ion-navbar>
</ion-header>

<ion-content>

<ion-searchbar hideWhen="android" placeholder="Zoek op naam of lidnummer" [(ngModel)]="queryText" (ionInput)="queryMembers()" cancelButtonText="Annuleer" showCancelButton="true" debounce="50" *ngIf="groups.length > 0 && failedToLoad === false">
<ion-searchbar showWhen="ios" placeholder="Zoek op naam of lidnummer" [(ngModel)]="queryText" (ionInput)="queryMembers()" cancelButtonText="Annuleer" showCancelButton="true" debounce="50" [hidden]="groups.length === 0 || failedToLoad !== false">
</ion-searchbar>

<div *ngIf="groups.length === 0 && failedToLoad === false" padding text-center>
Expand Down
7 changes: 4 additions & 3 deletions app/pages/member-list/member-list.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

.ios .member-list {
min-height: 100%;
}
// Disable as it seems buggy
// .ios .member-list {
// min-height: 100%;
// }

.member-list {
margin-bottom: 0;
Expand Down
19 changes: 15 additions & 4 deletions app/pages/member-list/member-list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, ViewChild } from '@angular/core';
import { Component, Renderer, ViewChild } from '@angular/core';
import { Content, NavController, Platform } from 'ionic-angular';
import { GoogleAnalytics } from 'ionic-native';
import * as _ from 'lodash';

import { IMemberGroup, IMemberShort } from '../../models/member';
Expand All @@ -23,7 +24,8 @@ export class MemberListPage {
constructor(
private apiData: ApiData,
private nav: NavController,
private platform: Platform
private platform: Platform,
private renderer: Renderer
) {
apiData.getMemberList().then((members: IMemberShort[]) => {
let grouped = _.groupBy(members, c => c.achternaam.replace(/[a-z ']/g, '')[0]);
Expand All @@ -38,7 +40,8 @@ export class MemberListPage {

// Hide searchbar by default on iOS
if (this.platform.is('ios')) {
this.content.setScrollTop(44);
// Disable as it seems buggy
// this.content.setScrollTop(44);
}
}, () => {
this.failedToLoad = true;
Expand Down Expand Up @@ -78,9 +81,13 @@ export class MemberListPage {
this.lastQueryText = queryText;
}

startSearch() {
startSearch(searchBar) {
setTimeout(() => {
this.searching = true;
setTimeout(() => {
let el = searchBar._searchbarInput.nativeElement;
this.renderer.invokeElementMethod(el, 'focus', []);
}, 0);
}, 200);
}

Expand All @@ -104,4 +111,8 @@ export class MemberListPage {
});
}

ionViewDidEnter() {
GoogleAnalytics.trackView('Member List');
}

}
3 changes: 2 additions & 1 deletion app/pages/tutorial/tutorial.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
import { StatusBar } from 'ionic-native';
import { GoogleAnalytics, StatusBar } from 'ionic-native';

import { LoginPage } from '../login/login';

Expand Down Expand Up @@ -44,6 +44,7 @@ export class TutorialPage {
private ionViewDidEnter() {
this.platform.ready().then(() => {
StatusBar.styleDefault();
GoogleAnalytics.trackView('Tutorial');
});
}

Expand Down
Loading

0 comments on commit 24ac40e

Please sign in to comment.