mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
148 lines
4.0 KiB
HTML
148 lines
4.0 KiB
HTML
<html ng-app="navTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>List</title>
|
|
|
|
<!-- Sets initial viewport load and disables zooming -->
|
|
<meta name="viewport" content="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-rc.3/angular.min.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular-touch.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular-animate.js"></script>
|
|
<style>
|
|
.my-repeat-animation > .ng-enter,
|
|
.my-repeat-animation > .ng-leave,
|
|
.my-repeat-animation > .ng-move {
|
|
-webkit-transition: 0.2s linear all;
|
|
transition: 0.2s linear all;
|
|
position:relative;
|
|
}
|
|
|
|
.my-repeat-animation > .ng-enter {
|
|
left:-10px;
|
|
opacity:0;
|
|
z-index: 10;
|
|
}
|
|
.my-repeat-animation > .ng-enter.ng-enter-active {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
|
|
.my-repeat-animation > .ng-leave {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
.my-repeat-animation > .ng-leave.ng-leave-active {
|
|
left:-10px;
|
|
opacity:0;
|
|
}
|
|
|
|
.my-repeat-animation > .ng-move {
|
|
opacity:0.5;
|
|
}
|
|
.my-repeat-animation > .ng-move.ng-move-active {
|
|
opacity:1;
|
|
}
|
|
|
|
.spinner {
|
|
width: 40px;
|
|
height: 40px;
|
|
border: 2px solid rgba(255,255,255,0.4);
|
|
border-radius: 40px;
|
|
margin: auto;
|
|
margin-bottom: 100px;
|
|
}
|
|
.spin-thing {
|
|
width: 10px;
|
|
height: 10px;
|
|
background-color: #4a87ee;
|
|
border-radius: 10px;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<div ng-controller="TestCtrl" class="reveal-animation scroll-content">
|
|
<list is-editing="isEditingItems"
|
|
on-refresh-holding="almostRefreshing()"
|
|
on-refresh-opening="almostRefreshProjects(ratio)"
|
|
on-refresh="refreshProjects()"
|
|
animation="my-repeat-animation"
|
|
delete-icon="icon ion-minus-circled"
|
|
reorder-icon="icon ion-navicon">
|
|
|
|
<refresher>
|
|
<div id="refresh-content">
|
|
<i class="icon ion-ios7-reloading"></i>
|
|
</div>
|
|
</refresher>
|
|
<item
|
|
ng-repeat="item in items"
|
|
buttons="item.buttons"
|
|
can-delete="true"
|
|
can-reorder="true"
|
|
can-swipe="true"
|
|
on-delete="deleteProject(project)"
|
|
on-select="selectProject(project)">
|
|
<i class="icon ion-email ion-primary"></i>
|
|
{{item.text}}
|
|
<i class="{{item.icon}}"></i>
|
|
</item>
|
|
</list>
|
|
<button ng-click="edit()" class="button button-success">Edit</button>
|
|
</div>
|
|
|
|
<script src="../../../../dist/js/ionic.js"></script>
|
|
<script src="../../../../dist/js/ionic-angular.js"></script>
|
|
<script>
|
|
angular.module('navTest', ['ionic.ui.list', 'ionic.ui.content', 'ngAnimate'])
|
|
|
|
.controller('TestCtrl', function($scope) {
|
|
$scope.refreshRatio = { ratio: 0 };
|
|
var removeItem = function(item) {
|
|
// Remove ourselves
|
|
$scope.items.splice($scope.items.indexOf(item), 1);
|
|
};
|
|
|
|
$scope.almostRefreshing = function() {
|
|
console.log('HOLDING FOR REFRESH');
|
|
};
|
|
$scope.almostRefreshProjects = function(amt) {
|
|
console.log('ALMOST REFRESHING', amt);
|
|
$scope.refreshRatio.ratio = amt;
|
|
$scope.$apply();
|
|
};
|
|
|
|
$scope.refreshProjects = function() {
|
|
console.log("REFRESHING");
|
|
};
|
|
|
|
$scope.items = [];
|
|
for(var i = 0; i < 20; i++) {
|
|
$scope.items.push({
|
|
text: 'Item ' + i,
|
|
canDelete: true,
|
|
canSwipe: true,
|
|
canReorder: true,
|
|
icon: 'icon-chevron-right',
|
|
hide: false,
|
|
deleteItem: removeItem,
|
|
buttons: [{
|
|
text: 'Kill',
|
|
type: 'button-danger',
|
|
buttonClicked: removeItem,
|
|
}]
|
|
});
|
|
}
|
|
|
|
$scope.edit = function() {
|
|
$scope.isEditingItems = !$scope.isEditingItems;
|
|
}
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|