awaken-direct-democracy
Version:
This is the functional skeleton / working mock up of a disruptive app to increase voter turnout and participation driven at the start by just one person - Tom Atkinson in New Zealand - after watching in horror the signing of the TPPA in Auckland February
54 lines (42 loc) • 1.38 kB
text/typescript
import { Component } from '@angular/core';
import { NavParams, ViewController } from 'ionic-angular';
import { ConferenceData } from '../../providers/conference-data';
({
selector: 'page-schedule-filter',
templateUrl: 'schedule-filter.html'
})
export class ScheduleFilterPage {
tracks: Array<{name: string, isChecked: boolean}> = [];
constructor(
public confData: ConferenceData,
public navParams: NavParams,
public viewCtrl: ViewController
) {
// passed in array of track names that should be excluded (unchecked)
let excludedTrackNames = this.navParams.data;
this.confData.getTracks().then((trackNames: string[]) => {
trackNames.forEach(trackName => {
this.tracks.push({
name: trackName,
isChecked: (excludedTrackNames.indexOf(trackName) === -1)
});
});
});
}
resetFilters() {
// reset all of the toggles to be checked
this.tracks.forEach(track => {
track.isChecked = true;
});
}
applyFilters() {
// Pass back a new array of track names to exclude
let excludedTrackNames = this.tracks.filter(c => !c.isChecked).map(c => c.name);
this.dismiss(excludedTrackNames);
}
dismiss(data?: any) {
// using the injected ViewController this page
// can "dismiss" itself and pass back data
this.viewCtrl.dismiss(data);
}
}