UNPKG

ionic-framework

Version:
118 lines 5.93 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var ionic_1 = require('ionic/ionic'); var ionic_2 = require('ionic/ionic'); var Login = (function () { function Login(nav) { this.nav = nav; } Login.prototype.goToAccount = function () { this.nav.push(Account); }; Login = __decorate([ ionic_2.Page({ template: "\n <ion-navbar *navbar>\n <ion-title>Login</ion-title>\n </ion-navbar>\n <ion-content style=\"text-align:center;\" padding>\n <button (click)=\"goToAccount()\">Login</button>\n </ion-content>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_1.NavController !== 'undefined' && ionic_1.NavController) === 'function' && _a) || Object]) ], Login); return Login; var _a; })(); exports.Login = Login; var Account = (function () { function Account(app) { this.app = app; this.rootPage = Dashboard; } Account.prototype.goToProfile = function () { var _this = this; this.app.getComponent('account-nav').setRoot(Profile).then(function () { _this.app.getComponent('menu').close(); }); }; Account.prototype.goToDashboard = function () { var _this = this; this.app.getComponent('account-nav').setRoot(Dashboard).then(function () { _this.app.getComponent('menu').close(); }); }; Account.prototype.logOut = function () { this.app.getComponent('root-nav').setRoot(Login, null, { animate: true }); }; Account = __decorate([ ionic_2.Page({ template: "\n <ion-menu [content]=\"content\">\n <ion-toolbar secondary>\n <ion-title>Account Menu</ion-title>\n </ion-toolbar>\n <ion-content>\n <ion-list>\n <button ion-item (click)=\"goToProfile()\">\n Profile\n </button>\n <button ion-item (click)=\"goToDashboard()\">\n Dashboard\n </button>\n <button ion-item detail-none (click)=\"logOut()\">\n Logout\n </button>\n </ion-list>\n </ion-content>\n </ion-menu>\n\n <ion-nav id=\"account-nav\" [root]=\"rootPage\" #content swipe-back-enabled=\"false\"></ion-nav>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.IonicApp !== 'undefined' && ionic_2.IonicApp) === 'function' && _a) || Object]) ], Account); return Account; var _a; })(); exports.Account = Account; var Dashboard = (function () { function Dashboard(app, nav) { this.app = app; this.nav = nav; } Dashboard.prototype.goToProfile = function () { this.nav.push(Profile); }; Dashboard.prototype.logOut = function () { this.app.getComponent('root-nav').setRoot(Login, null, { animate: true, direction: 'back' }); }; Dashboard = __decorate([ ionic_2.Page({ template: "\n <ion-navbar *navbar primary>\n <button menu-toggle>\n <icon menu></icon>\n </button>\n <ion-title>Account Dashboard</ion-title>\n </ion-navbar>\n <ion-content padding>\n <p><button (click)=\"goToProfile()\">Profile</button></p>\n <p><button (click)=\"logOut()\">Logout</button></p>\n </ion-content>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.IonicApp !== 'undefined' && ionic_2.IonicApp) === 'function' && _a) || Object, (typeof (_b = typeof ionic_1.NavController !== 'undefined' && ionic_1.NavController) === 'function' && _b) || Object]) ], Dashboard); return Dashboard; var _a, _b; })(); exports.Dashboard = Dashboard; var Profile = (function () { function Profile(app, nav) { this.app = app; this.nav = nav; } Profile.prototype.goToDashboard = function () { this.nav.push(Dashboard); }; Profile.prototype.logOut = function () { this.app.getComponent('root-nav').setRoot(Login, null, { animate: true, direction: 'back' }); }; Profile = __decorate([ ionic_2.Page({ template: "\n <ion-navbar *navbar danger>\n <button menu-toggle>\n <icon menu></icon>\n </button>\n <ion-title>Account Profile</ion-title>\n </ion-navbar>\n <ion-content padding>\n <p><button (click)=\"goToDashboard()\">Dashboard</button></p>\n <p><button (click)=\"logOut()\">Logout</button></p>\n </ion-content>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.IonicApp !== 'undefined' && ionic_2.IonicApp) === 'function' && _a) || Object, (typeof (_b = typeof ionic_1.NavController !== 'undefined' && ionic_1.NavController) === 'function' && _b) || Object]) ], Profile); return Profile; var _a, _b; })(); exports.Profile = Profile; var E2EApp = (function () { function E2EApp() { this.rootPage = Login; } E2EApp = __decorate([ ionic_1.App({ template: "<ion-nav id=\"root-nav\" [root]=\"rootPage\" swipe-back-enabled=\"false\"></ion-nav>" }), __metadata('design:paramtypes', []) ], E2EApp); return E2EApp; })();