Files
2013-11-13 22:49:57 -06:00

146 lines
3.7 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">
<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()"
refresh-complete="refreshComplete"
animation="my-repeat-animation"
delete-icon="icon ion-minus-circled"
reorder-icon="icon ion-navicon">
<refresher></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, $timeout) {
$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");
$timeout(function() {
$scope.refreshComplete();
}, 2000);
};
$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>