Tabs and toderp tweaks

This commit is contained in:
Max Lynch
2013-10-15 11:32:46 -05:00
parent a5d574e159
commit 9ec9cedf70
2 changed files with 45 additions and 8 deletions

View File

@ -121,7 +121,6 @@
</form> </form>
<list id="task-list"> <list id="task-list">
<li class="list-item" ng-repeat="task in activeProject.tasks" ng-class="{completed: task.isCompleted}"> <li class="list-item" ng-repeat="task in activeProject.tasks" ng-class="{completed: task.isCompleted}">
<input type="checkbox" ng-model="task.isCompleted"> {{task.title}}
<input type="text" ng-model="task.title"> <input type="text" ng-model="task.title">
</li> </li>
</list> </list>

View File

@ -52,6 +52,7 @@
<div title="Home" icon-on="icon-ios7-filing" icon-off="icon-ios7-filing-outline" class="tab-content" ng-controller="HomeCtrl"> <div title="Home" icon-on="icon-ios7-filing" icon-off="icon-ios7-filing-outline" class="tab-content" ng-controller="HomeCtrl">
<header class="bar bar-header bar-secondary"> <header class="bar bar-header bar-secondary">
<button class="button button-clear button-primary" ng-click="newTask()">New</button>
<h1 class="title">Tasks</h1> <h1 class="title">Tasks</h1>
<button class="button button-clear button-primary" ng-click="isEditingItems = !isEditingItems">Edit</button> <button class="button button-clear button-primary" ng-click="isEditingItems = !isEditingItems">Edit</button>
</header> </header>
@ -90,31 +91,62 @@
<h1>Settings</h1> <h1>Settings</h1>
</content> </content>
</div> </div>
</tab-controller> </tab-controller>
<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 padded 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.js"></script>
<script src="../../../../dist/js/ionic-angular.js"></script> <script src="../../../../dist/js/ionic-angular.js"></script>
<script> <script>
angular.module('tabsTest', ['ionic.ui']) angular.module('tabsTest', ['ionic.ui', 'ionic.service.modal', 'ionic.service.actionSheet'])
.controller('HomeCtrl', function($scope) { .controller('HomeCtrl', function($scope, Modal, ActionSheet) {
$scope.items = []; $scope.items = [];
Modal.fromTemplateUrl('newTask.html', function(modal) {
$scope.settingsModal = modal;
});
var removeItem = function(item, button) { var removeItem = function(item, button) {
console.log('Removing item', item); ActionSheet.show({
// Remove ourselves buttons: [],
$scope.items.splice($scope.items.indexOf(item), 1); 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) { var completeItem = function(item, button) {
// Remove ourselves
console.log('Completing item', item);
item.isCompleted = true; item.isCompleted = true;
}; };
$scope.removeItem = function(item) { $scope.removeItem = function(item) {
removeItem(item); removeItem(item);
}; };
$scope.newTask = function() {
$scope.settingsModal.show();
};
// Create the items
for(var i = 0; i < 30; i++) { for(var i = 0; i < 30; i++) {
$scope.items.push({ $scope.items.push({
title: 'Task ' + (i + 1), title: 'Task ' + (i + 1),
@ -132,6 +164,12 @@
}) })
.controller('TaskCtrl', function($scope) {
$scope.close = function() {
$scope.modal.hide();
}
});
</script> </script>
</body> </body>
</html> </html>