mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
197 lines
6.0 KiB
HTML
197 lines
6.0 KiB
HTML
<html ng-app="tabsTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Tab Bars</title>
|
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-touch.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-animate.js"></script>
|
|
<style>
|
|
.fade-out > .ng-enter,
|
|
.fade-out > .ng-leave,
|
|
.fade-out > .ng-move {
|
|
-webkit-transition: 0.2s linear all;
|
|
transition: 0.4s ease-out all;
|
|
position:relative;
|
|
}
|
|
|
|
.fade-out > .ng-enter {
|
|
left:-10px;
|
|
opacity:0;
|
|
}
|
|
.fade-out > .ng-enter.ng-enter-active {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
|
|
.fade-out > .ng-leave {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
.fade-out > .ng-leave.ng-leave-active {
|
|
left:-10px;
|
|
opacity:0;
|
|
}
|
|
|
|
.fade-out > .ng-move {
|
|
opacity:0.5;
|
|
}
|
|
.fade-out > .ng-move.ng-move-active {
|
|
opacity:1;
|
|
}
|
|
|
|
.completed {
|
|
text-decoration: line-through;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body ng-controller="RootCtrl">
|
|
<tabs
|
|
animation="fade-in-out"
|
|
tabs-type="tabs-icon-only"
|
|
tabs-style="tabs-primary"
|
|
controller-changed="onControllerChanged(oldController, oldIndex, newController, newIndex)">
|
|
|
|
<tab title="Home" icon-on="icon ion-ios7-filing" icon-off="icon ion-ios7-filing-outline" ng-controller="HomeCtrl">
|
|
<header class="bar bar-header bar-secondary">
|
|
<button class="button button-clear button-primary" ng-click="newTask()">New</button>
|
|
<h1 class="title">Tasks</h1>
|
|
<button class="button button-clear button-primary" ng-click="isEditingItems = !isEditingItems">Edit</button>
|
|
</header>
|
|
<content has-header="true" has-tabs="true" scroll="false">
|
|
<list on-refresh="onRefresh()" is-editing="isEditingItems" animation="fade-out" delete-icon="icon ion-minus-circled" reorder-icon="icon ion-navicon">
|
|
<refresher>
|
|
<div id="refresh-content">
|
|
Refreshing
|
|
<i class="icon ion-ios7-reloading"></i>
|
|
</div>
|
|
</refresher>
|
|
<list-item ng-repeat="item in items"
|
|
item="item"
|
|
buttons="item.buttons"
|
|
can-delete="true"
|
|
can-reorder="true"
|
|
can-swipe="true"
|
|
on-delete="deleteItem(item)"
|
|
ng-class="{completed: item.isCompleted}"
|
|
>
|
|
{{item.title}}
|
|
<i class="{{item.icon}}"></i>
|
|
</list-item>
|
|
</list>
|
|
</content>
|
|
</tab>
|
|
|
|
<tab title="About" icon-on="icon ion-ios7-clock" icon-off="icon ion-ios7-clock-outline">
|
|
<header class="bar bar-header bar-secondary">
|
|
<h1 class="title">Deadlines</h1>
|
|
</header>
|
|
<content has-header="true" has-tabs="true">
|
|
<h1>Deadlines</h1>
|
|
</content>
|
|
</tab>
|
|
|
|
<tab title="Settings" icon-on="icon ion-ios7-gear" icon-off="icon ion-ios7-gear-outline">
|
|
<header class="bar bar-header bar-secondary">
|
|
<h1 class="title">Settings</h1>
|
|
</header>
|
|
<content has-header="true" has-tabs="true">
|
|
<h1>Settings</h1>
|
|
</content>
|
|
</tab>
|
|
|
|
</tabs>
|
|
|
|
<script id="newTask.html" type="text/ng-template">
|
|
<div id="task-view" class="modal slide-in-up" ng-controller="TaskCtrl">
|
|
<header class="bar bar-header bar-secondary">
|
|
<h1 class="title">New Task</h1>
|
|
<button class="button button-clear button-primary" ng-click="close()">Done</button>
|
|
</header>
|
|
<main class="content padding has-header">
|
|
<input type="text" placeholder="I need to do this...">
|
|
</main>
|
|
</div>
|
|
</script>
|
|
|
|
<script src="../../../../dist/js/ionic.js"></script>
|
|
<script src="../../../../dist/js/ionic-angular.js"></script>
|
|
<script>
|
|
angular.module('tabsTest', ['ionic'])
|
|
|
|
.controller('RootCtrl', function($scope) {
|
|
$scope.onControllerChanged = function(oldController, oldIndex, newController, newIndex) {
|
|
console.log('Controller changed', oldController, oldIndex, newController, newIndex);
|
|
console.log(arguments);
|
|
};
|
|
})
|
|
|
|
|
|
.controller('HomeCtrl', function($scope, Modal, ActionSheet) {
|
|
$scope.items = [];
|
|
|
|
Modal.fromTemplateUrl('newTask.html', function(modal) {
|
|
$scope.settingsModal = modal;
|
|
});
|
|
|
|
var removeItem = function(item, button) {
|
|
ActionSheet.show({
|
|
buttons: [],
|
|
destructiveText: 'Delete Task',
|
|
cancelText: 'Cancel',
|
|
cancel: function() {
|
|
return true;
|
|
},
|
|
destructiveButtonClicked: function() {
|
|
$scope.items.splice($scope.items.indexOf(item), 1);
|
|
return true;
|
|
}
|
|
});
|
|
};
|
|
|
|
var completeItem = function(item, button) {
|
|
item.isCompleted = true;
|
|
};
|
|
|
|
$scope.onRefresh = function() {
|
|
console.log('ON REFRESH');
|
|
}
|
|
|
|
$scope.removeItem = function(item) {
|
|
removeItem(item);
|
|
};
|
|
|
|
$scope.newTask = function() {
|
|
$scope.settingsModal.show();
|
|
};
|
|
|
|
// Create the items
|
|
for(var i = 0; i < 30; i++) {
|
|
$scope.items.push({
|
|
title: 'Task ' + (i + 1),
|
|
buttons: [{
|
|
text: 'Done',
|
|
type: 'button-success',
|
|
onButtonClicked: completeItem,
|
|
}, {
|
|
text: 'Delete',
|
|
type: 'button-danger',
|
|
onButtonClicked: removeItem,
|
|
}]
|
|
});
|
|
}
|
|
|
|
})
|
|
|
|
.controller('TaskCtrl', function($scope) {
|
|
$scope.close = function() {
|
|
$scope.modal.hide();
|
|
}
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|