refactor(demos): refactor remaining components

This commit is contained in:
Drew Rygh
2015-11-05 11:03:02 -06:00
parent a766c20d65
commit 36352626b9
45 changed files with 394 additions and 371 deletions

View File

@@ -1,32 +1,19 @@
import {Directive, ElementRef, Renderer} from 'angular2/angular2';
import {Platform, Navbar} from 'ionic/ionic';
import * as actionSheets from './action-sheets/action-sheets';
import * as buttons from './buttons/buttons';
import * as cards from './cards/cards';
import * as labels from './labels/labels';
import * as icons from './icons/icons';
import * as inputs from './inputs/inputs';
import {BasicListsPage,
AvatarListsPage,
IconListsPage,
BasicDividersPage,
BasicInsetListsPage,
ListHeadersPage,
MultilineListsPage,
ThumbnailListsPage} from './lists/lists';
import {MenusPage} from './menus/menus';
import {ModalsPage} from './modals/modals';
import {NavigationPage} from './navigation/navigation';
import {PopupsPage} from './popups/popups';
import {SlidesPage} from './slides/slides';
import {TabsPage} from './tabs/tabs';
import {TabsIconPage} from './tabs/tabs-icon';
import {TabsIconTextPage} from './tabs/tabs-icon-text';
import * as lists from './lists/lists';
import * as menus from './menus/menus';
import * as modals from './modals/modals';
import * as navigation from './navigation/navigation';
import * as popups from './popups/popups';
import * as slides from './slides/slides';
import * as tabs from './tabs/tabs';
@Directive({
@@ -120,24 +107,24 @@ export function getPageFor(hash) {
'icons': icons.BasicPage,
'lists': BasicListsPage,
'avatar-list': AvatarListsPage,
'icon-list': IconListsPage,
'list-dividers': BasicDividersPage,
'inset-list': BasicInsetListsPage,
'list-headers': ListHeadersPage,
'multiline-list': MultilineListsPage,
'thumbnail-list': ThumbnailListsPage,
'lists': lists.BasicPage,
'avatar-list': lists.AvatarPage,
'icon-list': lists.IconPage,
'list-dividers': lists.LinesPage,
'inset-list': lists.InsetPage,
'list-headers': lists.HeadersPage,
'multiline-list': lists.MultilinePage,
'thumbnail-list': lists.ThumbnailPage,
'menus': MenusPage,
'modals': ModalsPage,
'navigation': NavigationPage,
'popups': PopupsPage,
'slides': SlidesPage,
'menus': menus.BasicPage,
'modals': modals.BasicPage,
'navigation': navigation.BasicPage,
'popups': popups.BasicPage,
'slides': slides.BasicPage,
'tabs': TabsPage,
'tabs-icon': TabsIconPage,
'tabs-icon-text': TabsIconTextPage,
'tabs': tabs.BasicPage,
'tabs-icon': tabs.IconPage,
'tabs-icon-text': tabs.IconTextPage,
}[hash]
}

View File

@@ -4,7 +4,7 @@ import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'inputs/checkbox/template.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
directives: [forwardRef(() => AndroidAttribute)]
})
export class CheckboxPage{
constructor() {

View File

@@ -4,7 +4,7 @@ import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'inputs/range/template.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
directives: [forwardRef(() => AndroidAttribute)]
})
export class RangePage{
constructor() {

View File

@@ -4,7 +4,7 @@ import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'inputs/select/template.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
directives: [forwardRef(() => AndroidAttribute)]
})
export class SelectPage{
constructor() {

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/avatar/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class AvatarPage {
constructor() {
}
}

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/basic/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class BasicPage {
constructor() {
}
}

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/headers/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class HeadersPage {
constructor() {
}
}

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/icon/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class IconPage {
constructor() {
}
}

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/inset/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class InsetPage {
constructor() {
}
}

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/lines/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class LinesPage {
constructor() {
}
}

View File

@@ -1,84 +1,8 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../helpers';
@Page({
templateUrl: 'lists/basic-lists.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class BasicListsPage {
constructor() {
}
}
@Page({
templateUrl: 'lists/dividers.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class BasicDividersPage {
constructor() {
}
}
@Page({
templateUrl: 'lists/inset-lists.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class BasicInsetListsPage {
constructor() {
}
}
@Page({
templateUrl: 'lists/list-headers.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class ListHeadersPage {
constructor() {
}
}
@Page({
templateUrl: 'lists/icon-lists.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class IconListsPage {
constructor() {
}
}
@Page({
templateUrl: 'lists/avatar-lists.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class AvatarListsPage {
constructor() {
}
}
@Page({
templateUrl: 'lists/multiline-lists.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class MultilineListsPage {
constructor() {
}
}
@Page({
templateUrl: 'lists/thumbnail-lists.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class ThumbnailListsPage {
constructor() {
}
}
export * from './avatar/pages';
export * from './basic/pages';
export * from './headers/pages';
export * from './icon/pages';
export * from './inset/pages';
export * from './lines/pages';
export * from './multiline/pages';
export * from './thumbnail/pages';

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/multiline/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class MultilinePage {
constructor() {
}
}

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'lists/thumbnail/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class ThumbnailPage {
constructor() {
}
}

View File

@@ -0,0 +1,35 @@
import {App, IonicApp, Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../../helpers';
@Page({
templateUrl: 'menus/basic/menu-home.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class BasicPage{
constructor() {
}
}
@Page({
templateUrl: 'menus/basic/menu-home.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class PageOne{
constructor() {
}
}
@Page({
templateUrl: 'menus/basic/menu-friends.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class PageTwo{
}
@Page({
templateUrl: 'menus/basic/menu-events.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class PageThree{
}

View File

@@ -1,35 +1 @@
import {App, IonicApp, Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../helpers';
@Page({
templateUrl: 'menus/menu-home.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class MenusPage{
constructor() {
}
}
@Page({
templateUrl: 'menus/menu-home.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class PageOne{
constructor() {
}
}
@Page({
templateUrl: 'menus/menu-friends.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class PageTwo{
}
@Page({
templateUrl: 'menus/menu-events.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class PageThree{
}
export * from './basic/pages';

View File

@@ -0,0 +1,63 @@
import {App, IonicApp, Animation, Modal, NavController, Page, Events} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../../helpers';
@Page({
templateUrl: 'modals/basic/template.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
class ModalsFirstPage {
constructor(
nav: NavController,
modal: Modal,
events: Events
) {
this.nav = nav;
this.modal = modal;
}
openModal() {
this.modal.open(ModalsContentPage);
}
}
@Page({
templateUrl: 'modals/basic/modals-content.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
class ModalsContentPage {
constructor(
modal: Modal,
events: Events
) {
this.modal = modal;
}
closeModal() {
let modal = this.modal.get();
if (modal) {
modal.close();
}
}
}
@Page({
template: '<ion-nav [root]="rootView"></ion-nav>'
})
export class BasicPage {
constructor(modal: Modal) {
this.rootView = ModalsFirstPage;
this.modal = modal;
}
onPageWillLeave() {
let modal = this.modal.get();
if (modal) {
modal.close();
}
}
}

View File

@@ -1,63 +1 @@
import {App, IonicApp, Animation, Modal, NavController, Page, Events} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../helpers';
@Page({
templateUrl: 'modals/modals.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
class ModalsFirstPage {
constructor(
nav: NavController,
modal: Modal,
events: Events
) {
this.nav = nav;
this.modal = modal;
}
openModal() {
this.modal.open(ModalsContentPage);
}
}
@Page({
templateUrl: 'modals/modals-content.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
class ModalsContentPage {
constructor(
modal: Modal,
events: Events
) {
this.modal = modal;
}
closeModal() {
let modal = this.modal.get();
if (modal) {
modal.close();
}
}
}
@Page({
template: '<ion-nav [root]="rootView"></ion-nav>'
})
export class ModalsPage {
constructor(modal: Modal) {
this.rootView = ModalsFirstPage;
this.modal = modal;
}
onPageWillLeave() {
let modal = this.modal.get();
if (modal) {
modal.close();
}
}
}
export * from './basic/pages';

View File

@@ -0,0 +1,45 @@
import {NavController, NavParams} from 'ionic/ionic';
import {Page, Events} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../../helpers';
@Page({
templateUrl: 'navigation/basic/navigation-details.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
class NavigationDetailsPage {
constructor(nav: NavController, params: NavParams, events: Events) {
this.nav = nav;
this.selection = { title: params.data.name };
var navData = {
'Angular': "A powerful Javascript framework for building single page apps. Angular is open source, and maintained by Google.",
'CSS3': "The latest version of cascading stylesheets - the styling language of the web!",
'HTML5': "The latest version of the web's markup language.",
'Sass': "Syntactically Awesome Stylesheets - a mature, stable, and powerful professional grade CSS extension."
};
var navIcons = {
'Angular': 'ion-social-angular',
'CSS3': 'ion-social-css3',
'HTML5': 'ion-social-html5',
'Sass': 'ion-social-sass'
};
this.selection['content'] = navData[this.selection.title];
this.selection['icon'] = navIcons[this.selection.title];
}
}
@Page({
templateUrl: 'navigation/basic/navigation.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class BasicPage {
constructor(nav: NavController) {
this.nav = nav;
}
openNavDetailsPage(item) {
this.nav.push(NavigationDetailsPage, { name: item });
}
}

View File

@@ -1,45 +1 @@
import {NavController, NavParams} from 'ionic/ionic';
import {Page, Events} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../helpers';
@Page({
templateUrl: 'navigation/navigation-details.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
class NavigationDetailsPage {
constructor(nav: NavController, params: NavParams, events: Events) {
this.nav = nav;
this.selection = { title: params.data.name };
var navData = {
'Angular': "A powerful Javascript framework for building single page apps. Angular is open source, and maintained by Google.",
'CSS3': "The latest version of cascading stylesheets - the styling language of the web!",
'HTML5': "The latest version of the web's markup language.",
'Sass': "Syntactically Awesome Stylesheets - a mature, stable, and powerful professional grade CSS extension."
};
var navIcons = {
'Angular': 'ion-social-angular',
'CSS3': 'ion-social-css3',
'HTML5': 'ion-social-html5',
'Sass': 'ion-social-sass'
};
this.selection['content'] = navData[this.selection.title];
this.selection['icon'] = navIcons[this.selection.title];
}
}
@Page({
templateUrl: 'navigation/navigation.html',
directives: [forwardRef(() => helpers.AndroidAttribute)]
})
export class NavigationPage {
constructor(nav: NavController) {
this.nav = nav;
}
openNavDetailsPage(item) {
this.nav.push(NavigationDetailsPage, { name: item });
}
}
export * from './basic/pages';

View File

@@ -0,0 +1,50 @@
import {Page, Popup} from 'ionic/ionic';
import {AndroidAttribute} from '../../helpers';
import {forwardRef} from 'angular2/angular2';
@Page({
templateUrl: 'popups/basic/template.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class BasicPage {
constructor(popup: Popup) {
this.popup = popup;
}
doAlert() {
this.popup.alert({
title: "New Friend!",
template: "Your friend, Obi wan Kenobi, just accepted your friend request!",
cssClass: 'my-alert'
});
}
doPrompt() {
this.popup.prompt({
title: "New Album",
template: "Enter a name for this new album you're so keen on adding",
inputPlaceholder: "Title",
okText: "Save"
});
}
doConfirm() {
this.popup.confirm({
title: "Use this lightsaber?",
template: "Do you agree to use this lightsaber to do good across the intergalactic galaxy?",
cancelText: "Disagree",
okText: "Agree"
});
}
onPageWillLeave() {
let popup = this.popup.get();
// only try to close if there is an active popup
if (popup) {
popup.close();
}
}
}

View File

@@ -1,50 +1 @@
import {Page, Popup} from 'ionic/ionic';
import {AndroidAttribute} from '../helpers';
import {forwardRef} from 'angular2/angular2';
@Page({
templateUrl: 'popups/popups.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class PopupsPage {
constructor(popup: Popup) {
this.popup = popup;
}
doAlert() {
this.popup.alert({
title: "New Friend!",
template: "Your friend, Obi wan Kenobi, just accepted your friend request!",
cssClass: 'my-alert'
});
}
doPrompt() {
this.popup.prompt({
title: "New Album",
template: "Enter a name for this new album you're so keen on adding",
inputPlaceholder: "Title",
okText: "Save"
});
}
doConfirm() {
this.popup.confirm({
title: "Use this lightsaber?",
template: "Do you agree to use this lightsaber to do good across the intergalactic galaxy?",
cancelText: "Disagree",
okText: "Agree"
});
}
onPageWillLeave() {
let popup = this.popup.get();
// only try to close if there is an active popup
if (popup) {
popup.close();
}
}
}
export * from './basic/pages';

View File

@@ -0,0 +1,13 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../../helpers';
@Page({
templateUrl: 'slides/basic/slides.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class BasicPage {
constructor() {
}
}

View File

@@ -1,13 +1 @@
import {Page} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import {AndroidAttribute} from '../helpers';
@Page({
templateUrl: 'slides/slides.html',
directives: [forwardRef(() => AndroidAttribute)]
})
export class SlidesPage {
constructor() {
}
}
export * from './basic/pages';

View File

@@ -0,0 +1,38 @@
import {NavController, NavParams} from 'ionic/ionic';
import {Page, ViewController} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../../helpers';
@Page({
template: '' +
'<ion-navbar *navbar hide-back-button class="android-attr">' +
'<ion-title>Tabs</ion-title>' +
'</ion-navbar>' +
'<ion-content>' +
'</ion-content>',
directives: [forwardRef(() => helpers.AndroidAttribute)],
})
class TabTextCtrl {
constructor(nav: NavController, view: ViewController) {
this.nav = nav;
this.view = view;
}
}
@Page({
template:
'<ion-tabs>' +
'<ion-tab tab-title="Music" [root]="tabOne"></ion-tab>' +
'<ion-tab tab-title="Movies" [root]="tabTwo"></ion-tab>' +
'<ion-tab tab-title="Games" [root]="tabThree"></ion-tab>' +
'</ion-tabs>',
})
export class BasicPage {
constructor(nav: NavController, params: NavParams) {
this.nav = nav;
this.tabOne = TabTextCtrl;
this.tabTwo = TabTextCtrl;
this.tabThree = TabTextCtrl;
}
}

View File

@@ -1,7 +1,7 @@
import {NavController, NavParams} from 'ionic/ionic';
import {Page, ViewController} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../helpers';
import * as helpers from '../../helpers';
@Page({
@@ -29,7 +29,7 @@ class TabIconTextCtrl {
'<ion-tab tab-icon="magnet" tab-title="Force" [root]="tabFour"></ion-tab>' +
'</ion-tabs>',
})
export class TabsIconTextPage {
export class IconTextPage {
constructor(nav: NavController, params: NavParams) {
this.nav = nav;
this.tabOne = TabIconTextCtrl;

View File

@@ -1,7 +1,7 @@
import {NavController, NavParams} from 'ionic/ionic';
import {Page, ViewController} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../helpers';
import * as helpers from '../../helpers';
@Page({
@@ -29,7 +29,7 @@ class TabIconCtrl {
'<ion-tab tab-icon="settings" [root]="tabFour"></ion-tab>' +
'</ion-tabs>',
})
export class TabsIconPage {
export class IconPage {
constructor(nav: NavController, params: NavParams) {
this.nav = nav;
this.tabOne = TabIconCtrl;

View File

@@ -1,38 +1,3 @@
import {NavController, NavParams} from 'ionic/ionic';
import {Page, ViewController} from 'ionic/ionic';
import {forwardRef} from 'angular2/angular2';
import * as helpers from '../helpers';
@Page({
template: '' +
'<ion-navbar *navbar hide-back-button class="android-attr">' +
'<ion-title>Tabs</ion-title>' +
'</ion-navbar>' +
'<ion-content>' +
'</ion-content>',
directives: [forwardRef(() => helpers.AndroidAttribute)],
})
class TabTextCtrl {
constructor(nav: NavController, view: ViewController) {
this.nav = nav;
this.view = view;
}
}
@Page({
template:
'<ion-tabs>' +
'<ion-tab tab-title="Music" [root]="tabOne"></ion-tab>' +
'<ion-tab tab-title="Movies" [root]="tabTwo"></ion-tab>' +
'<ion-tab tab-title="Games" [root]="tabThree"></ion-tab>' +
'</ion-tabs>',
})
export class TabsPage {
constructor(nav: NavController, params: NavParams) {
this.nav = nav;
this.tabOne = TabTextCtrl;
this.tabTwo = TabTextCtrl;
this.tabThree = TabTextCtrl;
}
}
export * from './basic/pages';
export * from './icon/pages';
export * from './icon-text/pages';