mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Correct sorting for task items
This commit is contained in:
@ -91,12 +91,14 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
|||||||
if(!$scope.activeProject.tasks) {
|
if(!$scope.activeProject.tasks) {
|
||||||
$scope.activeProject.tasks = [];
|
$scope.activeProject.tasks = [];
|
||||||
}
|
}
|
||||||
$scope.activeProject.tasks.add({
|
var task = $scope.activeProject.tasks.add({
|
||||||
title: task.title,
|
title: task.title,
|
||||||
user_id: $scope.user.id,
|
user_id: $scope.user.id,
|
||||||
isCompleted: false
|
isCompleted: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
task.setPriority(-(+new Date));
|
||||||
|
|
||||||
// Set the priorty for this project to the new date, so it will
|
// Set the priorty for this project to the new date, so it will
|
||||||
// sort higher
|
// sort higher
|
||||||
$scope.activeProject.project.setPriority(-(+new Date));
|
$scope.activeProject.project.setPriority(-(+new Date));
|
||||||
@ -117,7 +119,7 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
|||||||
$scope.activeProject = {
|
$scope.activeProject = {
|
||||||
project: ref,
|
project: ref,
|
||||||
title: project.title,
|
title: project.title,
|
||||||
tasks: angularFireCollection(ref.child('tasks'))
|
tasks: angularFireCollection(ref.child('tasks').limit(100))
|
||||||
};
|
};
|
||||||
$scope.clearActive();
|
$scope.clearActive();
|
||||||
project.isActive = true;
|
project.isActive = true;
|
||||||
@ -152,7 +154,7 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
|
|||||||
};
|
};
|
||||||
|
|
||||||
var projectsRef = new Firebase(FIREBASE_URL + '/project_list');
|
var projectsRef = new Firebase(FIREBASE_URL + '/project_list');
|
||||||
$scope.projects = angularFireCollection(projectsRef, function(snapshot) {
|
$scope.projects = angularFireCollection(projectsRef.limit(100), function(snapshot) {
|
||||||
if(!snapshot.val()) {
|
if(!snapshot.val()) {
|
||||||
var title = prompt('Create your first list:');
|
var title = prompt('Create your first list:');
|
||||||
if(title) {
|
if(title) {
|
||||||
|
|||||||
Reference in New Issue
Block a user