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
69 lines (55 loc) • 1.45 kB
text/typescript
import { Component } from '@angular/core';
import { AlertController, NavController } from 'ionic-angular';
import { LoginPage } from '../login/login';
import { UserData } from '../../providers/user-data';
({
selector: 'page-account',
templateUrl: 'account.html'
})
export class AccountPage {
username: string;
constructor(public alertCtrl: AlertController, public nav: NavController, public userData: UserData) {
}
ngAfterViewInit() {
this.getUsername();
}
updatePicture() {
console.log('Clicked to update picture');
}
// Present an alert with the current username populated
// clicking OK will update the username and display it
// clicking Cancel will close the alert and do nothing
changeUsername() {
let alert = this.alertCtrl.create({
title: 'Change Username',
buttons: [
'Cancel'
]
});
alert.addInput({
name: 'username',
value: this.username,
placeholder: 'username'
});
alert.addButton({
text: 'Ok',
handler: data => {
this.userData.setUsername(data.username);
this.getUsername();
}
});
alert.present();
}
getUsername() {
this.userData.getUsername().then((username) => {
this.username = username;
});
}
changePassword() {
console.log('Clicked to change password');
}
logout() {
this.userData.logout();
this.nav.setRoot(LoginPage);
}
}