Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
todomvc
Commits
d945ec21
Commit
d945ec21
authored
Jun 29, 2014
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #939 from pgilad/gh-pages
improve collection flow in backbone examples
parents
6ddcbab2
410f3a46
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
82 deletions
+29
-82
architecture-examples/backbone/js/collections/todos.js
architecture-examples/backbone/js/collections/todos.js
+2
-8
dependency-examples/backbone_require/js/collections/todos.js
dependency-examples/backbone_require/js/collections/todos.js
+2
-8
labs/architecture-examples/backbone_marionette/js/TodoMVC.Todos.js
...itecture-examples/backbone_marionette/js/TodoMVC.Todos.js
+1
-3
labs/architecture-examples/exoskeleton/js/collections/todos.js
...architecture-examples/exoskeleton/js/collections/todos.js
+4
-13
labs/architecture-examples/react-backbone/js/todos.js
labs/architecture-examples/react-backbone/js/todos.js
+4
-11
labs/architecture-examples/thorax/js/collections/todos.js
labs/architecture-examples/thorax/js/collections/todos.js
+4
-11
labs/dependency-examples/backbone_marionette_require/js/collections/TodoList.js
...es/backbone_marionette_require/js/collections/TodoList.js
+1
-3
labs/dependency-examples/thorax_lumbar/public/todomvc.js
labs/dependency-examples/thorax_lumbar/public/todomvc.js
+4
-11
labs/dependency-examples/thorax_lumbar/src/js/collections/todos.js
...ndency-examples/thorax_lumbar/src/js/collections/todos.js
+7
-14
No files found.
architecture-examples/backbone/js/collections/todos.js
View file @
d945ec21
...
...
@@ -29,17 +29,11 @@ var app = app || {};
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
if
(
!
this
.
length
)
{
return
1
;
}
return
this
.
last
().
get
(
'
order
'
)
+
1
;
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
// Todos are sorted by their original insertion order.
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
order
'
);
}
comparator
:
'
order
'
});
// Create our global collection of **Todos**.
...
...
dependency-examples/backbone_require/js/collections/todos.js
View file @
d945ec21
...
...
@@ -27,17 +27,11 @@ define([
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
if
(
!
this
.
length
)
{
return
1
;
}
return
this
.
last
().
get
(
'
order
'
)
+
1
;
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
// Todos are sorted by their original insertion order.
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
order
'
);
}
comparator
:
'
order
'
});
return
new
TodosCollection
();
...
...
labs/architecture-examples/backbone_marionette/js/TodoMVC.Todos.js
View file @
d945ec21
...
...
@@ -41,9 +41,7 @@ TodoMVC.module('Todos', function (Todos, App, Backbone) {
return
this
.
reject
(
this
.
_isCompleted
);
},
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
created
'
);
},
comparator
:
'
created
'
,
_isCompleted
:
function
(
todo
)
{
return
todo
.
isCompleted
();
...
...
labs/architecture-examples/exoskeleton/js/collections/todos.js
View file @
d945ec21
...
...
@@ -18,31 +18,22 @@ var app = app || {};
// Filter down the list of all todo items that are finished.
completed
:
function
()
{
return
this
.
filter
(
function
(
todo
)
{
return
todo
.
get
(
'
completed
'
);
});
return
this
.
where
({
completed
:
true
});
},
// Filter down the list to only todo items that are still not finished.
remaining
:
function
()
{
return
this
.
filter
(
function
(
todo
)
{
return
!
todo
.
get
(
'
completed
'
);
});
return
this
.
where
({
completed
:
false
});
},
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
if
(
!
this
.
length
)
{
return
1
;
}
return
this
.
at
(
this
.
length
-
1
).
get
(
'
order
'
)
+
1
;
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
// Todos are sorted by their original insertion order.
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
order
'
);
}
comparator
:
'
order
'
});
// Create our global collection of **Todos**.
...
...
labs/architecture-examples/react-backbone/js/todos.js
View file @
d945ec21
...
...
@@ -18,29 +18,22 @@ var app = app || {};
// Filter down the list of all todo items that are finished.
completed
:
function
()
{
return
this
.
filter
(
function
(
todo
)
{
return
todo
.
get
(
'
completed
'
);
});
return
this
.
where
({
completed
:
true
});
},
// Filter down the list to only todo items that are still not finished.
remaining
:
function
()
{
return
this
.
w
ithout
.
apply
(
this
,
this
.
completed
()
);
return
this
.
w
here
({
completed
:
false
}
);
},
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
if
(
!
this
.
length
)
{
return
1
;
}
return
this
.
last
().
get
(
'
order
'
)
+
1
;
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
// Todos are sorted by their original insertion order.
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
order
'
);
}
comparator
:
'
order
'
});
// Create our global collection of **Todos**.
...
...
labs/architecture-examples/thorax/js/collections/todos.js
View file @
d945ec21
...
...
@@ -17,29 +17,22 @@
// Filter down the list of all todo items that are finished.
completed
:
function
()
{
return
this
.
filter
(
function
(
todo
)
{
return
todo
.
get
(
'
completed
'
);
});
return
this
.
where
({
completed
:
true
});
},
// Filter down the list to only todo items that are still not finished.
remaining
:
function
()
{
return
this
.
w
ithout
.
apply
(
this
,
this
.
completed
()
);
return
this
.
w
here
({
completed
:
false
}
);
},
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
if
(
!
this
.
length
)
{
return
1
;
}
return
this
.
last
().
get
(
'
order
'
)
+
1
;
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
// Todos are sorted by their original insertion order.
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
order
'
);
}
comparator
:
'
order
'
});
// Create our global collection of **Todos**.
...
...
labs/dependency-examples/backbone_marionette_require/js/collections/TodoList.js
View file @
d945ec21
...
...
@@ -19,8 +19,6 @@ define([
return
this
.
where
({
completed
:
false
});
},
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
created
'
);
}
comparator
:
'
created
'
});
});
labs/dependency-examples/thorax_lumbar/public/todomvc.js
View file @
d945ec21
...
...
@@ -63,29 +63,22 @@ module.routes = {"":"setFilter",":filter":"setFilter"};
// Filter down the list of all todo items that are finished.
completed
:
function
()
{
return
this
.
filter
(
function
(
todo
)
{
return
todo
.
get
(
'
completed
'
);
});
return
this
.
where
({
completed
:
true
});
},
// Filter down the list to only todo items that are still not finished.
remaining
:
function
()
{
return
this
.
w
ithout
.
apply
(
this
,
this
.
completed
()
);
return
this
.
w
here
({
completed
:
false
}
);
},
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
if
(
!
this
.
length
)
{
return
1
;
}
return
this
.
last
().
get
(
'
order
'
)
+
1
;
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
// Todos are sorted by their original insertion order.
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
order
'
);
}
comparator
:
'
order
'
});
// Create our global collection of **Todos**.
...
...
labs/dependency-examples/thorax_lumbar/src/js/collections/todos.js
View file @
d945ec21
...
...
@@ -15,30 +15,23 @@
localStorage
:
new
Store
(
'
todos-backbone-thorax
'
),
// Filter down the list of all todo items that are finished.
completed
:
function
()
{
return
this
.
filter
(
function
(
todo
)
{
return
todo
.
get
(
'
completed
'
);
});
completed
:
function
()
{
return
this
.
where
({
completed
:
true
});
},
// Filter down the list to only todo items that are still not finished.
remaining
:
function
()
{
return
this
.
w
ithout
.
apply
(
this
,
this
.
completed
()
);
remaining
:
function
()
{
return
this
.
w
here
({
completed
:
false
}
);
},
// We keep the Todos in sequential order, despite being saved by unordered
// GUID in the database. This generates the next order number for new items.
nextOrder
:
function
()
{
if
(
!
this
.
length
)
{
return
1
;
}
return
this
.
last
().
get
(
'
order
'
)
+
1
;
nextOrder
:
function
()
{
return
this
.
length
?
this
.
last
().
get
(
'
order
'
)
+
1
:
1
;
},
// Todos are sorted by their original insertion order.
comparator
:
function
(
todo
)
{
return
todo
.
get
(
'
order
'
);
}
comparator
:
'
order
'
});
// Create our global collection of **Todos**.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment