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
1c739d6f
Commit
1c739d6f
authored
Mar 09, 2013
by
Sindre Sorhus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backbone app - code style
parent
1877dd10
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
85 deletions
+75
-85
architecture-examples/backbone/index.html
architecture-examples/backbone/index.html
+59
-59
architecture-examples/backbone/js/app.js
architecture-examples/backbone/js/app.js
+3
-4
architecture-examples/backbone/js/collections/todos.js
architecture-examples/backbone/js/collections/todos.js
+1
-3
architecture-examples/backbone/js/models/todo.js
architecture-examples/backbone/js/models/todo.js
+2
-5
architecture-examples/backbone/js/routers/router.js
architecture-examples/backbone/js/routers/router.js
+2
-4
architecture-examples/backbone/js/views/app.js
architecture-examples/backbone/js/views/app.js
+1
-1
architecture-examples/backbone/js/views/todos.js
architecture-examples/backbone/js/views/todos.js
+7
-9
No files found.
architecture-examples/backbone/index.html
View file @
1c739d6f
<!doctype html>
<html
lang=
"en"
>
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<title>
Backbone.js • TodoMVC
</title>
<link
rel=
"stylesheet"
href=
"components/todomvc-common/base.css"
>
</head>
<body>
</head>
<body>
<section
id=
"todoapp"
>
<header
id=
"header"
>
<h1>
todos
</h1>
...
...
@@ -60,5 +60,5 @@
<script
src=
"js/views/app.js"
></script>
<script
src=
"js/routers/router.js"
></script>
<script
src=
"js/app.js"
></script>
</body>
</body>
</html>
architecture-examples/backbone/js/app.js
View file @
1c739d6f
/*global $*/
/*jshint unused:false*/
/*global $
*/
/*jshint unused:false
*/
var
app
=
app
||
{};
var
ENTER_KEY
=
13
;
$
(
function
()
{
'
use strict
'
;
//
Kick things off by creating the **App**.
//
kick things off by creating the `App`
new
app
.
AppView
();
});
architecture-examples/backbone/js/collections/todos.js
View file @
1c739d6f
...
...
@@ -10,7 +10,6 @@ var app = app || {};
// The collection of todos is backed by *localStorage* instead of a remote
// server.
var
TodoList
=
Backbone
.
Collection
.
extend
({
// Reference to this collection's model.
model
:
app
.
Todo
,
...
...
@@ -46,5 +45,4 @@ var app = app || {};
// Create our global collection of **Todos**.
app
.
Todos
=
new
TodoList
();
}());
})();
architecture-examples/backbone/js/models/todo.js
View file @
1c739d6f
/*global Backbone*/
/*global Backbone
*/
var
app
=
app
||
{};
(
function
()
{
...
...
@@ -9,7 +9,6 @@ var app = app || {};
// Our basic **Todo** model has `title`, `order`, and `completed` attributes.
app
.
Todo
=
Backbone
.
Model
.
extend
({
// Default attributes for the todo
// and ensure that each todo created has `title` and `completed` keys.
defaults
:
{
...
...
@@ -23,7 +22,5 @@ var app = app || {};
completed
:
!
this
.
get
(
'
completed
'
)
});
}
});
}());
})();
architecture-examples/backbone/js/routers/router.js
View file @
1c739d6f
/*global Backbone*/
/*global Backbone
*/
var
app
=
app
||
{};
(
function
()
{
...
...
@@ -6,7 +6,6 @@ var app = app || {};
// Todo Router
// ----------
var
Workspace
=
Backbone
.
Router
.
extend
({
routes
:
{
'
*filter
'
:
'
setFilter
'
...
...
@@ -24,5 +23,4 @@ var app = app || {};
app
.
TodoRouter
=
new
Workspace
();
Backbone
.
history
.
start
();
}());
})();
architecture-examples/backbone/js/views/app.js
View file @
1c739d6f
/*global Backbone _ $ ENTER_KEY*/
/*global Backbone _ $ ENTER_KEY
*/
var
app
=
app
||
{};
$
(
function
(
$
)
{
...
...
architecture-examples/backbone/js/views/todos.js
View file @
1c739d6f
/*global Backbone _ $ ENTER_KEY*/
/*global Backbone _ $ ENTER_KEY
*/
var
app
=
app
||
{};
$
(
function
()
{
...
...
@@ -9,7 +9,6 @@ $(function () {
// The DOM element for a todo item...
app
.
TodoView
=
Backbone
.
View
.
extend
({
//... is a list tag.
tagName
:
'
li
'
,
...
...
@@ -38,7 +37,6 @@ $(function () {
render
:
function
()
{
this
.
$el
.
html
(
this
.
template
(
this
.
model
.
toJSON
()));
this
.
$el
.
toggleClass
(
'
completed
'
,
this
.
model
.
get
(
'
completed
'
));
this
.
toggleVisible
();
this
.
$input
=
this
.
$
(
'
.edit
'
);
return
this
;
...
...
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