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
0a9cbb0c
Commit
0a9cbb0c
authored
9 years ago
by
TasteBot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update the build files for gh-pages [ci skip]
parent
16a78771
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
21 deletions
+87
-21
examples/thorax_lumbar/public/base.js
examples/thorax_lumbar/public/base.js
+3
-0
examples/thorax_lumbar/public/todomvc.js
examples/thorax_lumbar/public/todomvc.js
+41
-11
examples/thorax_lumbar/src/js/app.js
examples/thorax_lumbar/src/js/app.js
+4
-0
examples/thorax_lumbar/src/js/collections/todos.js
examples/thorax_lumbar/src/js/collections/todos.js
+1
-0
examples/thorax_lumbar/src/js/init.js
examples/thorax_lumbar/src/js/init.js
+3
-0
examples/thorax_lumbar/src/js/models/todo.js
examples/thorax_lumbar/src/js/models/todo.js
+1
-0
examples/thorax_lumbar/src/js/routers/todomvc.js
examples/thorax_lumbar/src/js/routers/todomvc.js
+3
-1
examples/thorax_lumbar/src/js/views/app.js
examples/thorax_lumbar/src/js/views/app.js
+3
-1
examples/thorax_lumbar/src/js/views/stats.js
examples/thorax_lumbar/src/js/views/stats.js
+9
-3
examples/thorax_lumbar/src/js/views/todo-item.js
examples/thorax_lumbar/src/js/views/todo-item.js
+19
-5
No files found.
examples/thorax_lumbar/public/base.js
View file @
0a9cbb0c
...
...
@@ -17276,12 +17276,15 @@ if (module.exports.loader && module.exports.loader.map && window.Backbone) {
}
;;
/*global Thorax, Backbone, $ */
//all templates are assumed to be in the templates directory
Thorax
.
templatePathPrefix
=
'
src/templates/
'
;
var
app
=
window
.
app
=
module
.
exports
;
$
(
function
()
{
'
use strict
'
;
app
.
initBackboneLoader
();
Backbone
.
history
.
start
();
});
...
...
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/public/todomvc.js
View file @
0a9cbb0c
...
...
@@ -7,6 +7,7 @@ Application['todomvc'] = (function() {
/* router : todomvc */
module
.
name
=
"
todomvc
"
;
module
.
routes
=
{
""
:
"
setFilter
"
,
"
:filter
"
:
"
setFilter
"
};
/*global Thorax */
(
function
()
{
'
use strict
'
;
...
...
@@ -46,6 +47,7 @@ module.routes = {"":"setFilter",":filter":"setFilter"};
}());
;;
/*global Thorax, Store */
(
function
()
{
'
use strict
'
;
...
...
@@ -91,6 +93,8 @@ module.routes = {"":"setFilter",":filter":"setFilter"};
}());
;;
/*global Thorax, $, ENTER_KEY, ESCAPE_KEY */
$
(
function
()
{
'
use strict
'
;
...
...
@@ -111,7 +115,7 @@ $(function () {
'
click .toggle
'
:
'
toggleCompleted
'
,
'
dblclick label
'
:
'
edit
'
,
'
click .destroy
'
:
'
clear
'
,
'
key
press .edit
'
:
'
updateOnEnt
er
'
,
'
key
up .edit
'
:
'
keyListen
er
'
,
'
blur .edit
'
:
'
close
'
,
// The "rendered" event is triggered by Thorax each time render()
// is called and the result of the template has been appended
...
...
@@ -129,11 +133,16 @@ $(function () {
// Switch this view into `"editing"` mode, displaying the input field.
edit
:
function
()
{
this
.
$el
.
addClass
(
'
editing
'
);
this
.
$
(
'
.edit
'
).
focus
();
this
.
$
(
'
.edit
'
).
val
(
this
.
model
.
get
(
'
title
'
)).
focus
();
},
// Close the `"editing"` mode
, saving changes to the todo
.
// Close the `"editing"` mode.
close
:
function
()
{
// If editing was cancelled, don't save
if
(
!
this
.
$el
.
hasClass
(
'
editing
'
))
{
return
;
}
var
value
=
this
.
$
(
'
.edit
'
).
val
().
trim
();
if
(
value
)
{
...
...
@@ -145,10 +154,17 @@ $(function () {
this
.
$el
.
removeClass
(
'
editing
'
);
},
// If you hit `enter`, we're through editing the item.
updateOnEnter
:
function
(
e
)
{
// User cancelled editing, don't update the todo.
cancelEdits
:
function
()
{
this
.
$el
.
removeClass
(
'
editing
'
);
},
// Enter completes the editing, Escape cancels it
keyListener
:
function
(
e
)
{
if
(
e
.
which
===
ENTER_KEY
)
{
this
.
close
();
}
else
if
(
e
.
which
===
ESCAPE_KEY
)
{
this
.
cancelEdits
();
}
},
...
...
@@ -160,7 +176,9 @@ $(function () {
});
;;
Thorax
.
templates
[
'
src/templates/stats
'
]
=
Handlebars
.
compile
(
'
<span id=
\
"todo-count
\
"><strong>{{remaining}}</strong> {{itemText}} left</span>
\n
<ul id=
\
"filters
\
">
\n
<li>
\n
{{#link
\
"/
\
" class=
\
"selected
\
"}}All{{/link}}
\n
</li>
\n
<li>
\n
{{#link
\
"/active
\
"}}Active{{/link}}
\n
</li>
\n
<li>
\n
{{#link
\
"/completed
\
"}}Completed{{/link}}
\n
</li>
\n
</ul>
\n
{{#if completed}}
\n
<button id=
\
"clear-completed
\
">Clear completed</button>
\n
{{/if}}
\n
'
);
Thorax
.
View
.
extend
({
Thorax
.
templates
[
'
src/templates/stats
'
]
=
Handlebars
.
compile
(
'
<span id=
\
"todo-count
\
"><strong>{{remaining}}</strong> {{itemText}} left</span>
\n
<ul id=
\
"filters
\
">
\n
<li>
\n
{{#link
\
"/
\
" class=
\
"selected
\
"}}All{{/link}}
\n
</li>
\n
<li>
\n
{{#link
\
"/active
\
"}}Active{{/link}}
\n
</li>
\n
<li>
\n
{{#link
\
"/completed
\
"}}Completed{{/link}}
\n
</li>
\n
</ul>
\n
{{#if completed}}
\n
<button id=
\
"clear-completed
\
">Clear completed</button>
\n
{{/if}}
\n
'
);
/*global Thorax, _ */
Thorax
.
View
.
extend
({
name
:
'
stats
'
,
events
:
{
...
...
@@ -172,6 +190,7 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co
},
initialize
:
function
()
{
'
use strict
'
;
// Whenever the Todos collection changes re-render the stats
// render() needs to be called with no arguments, otherwise calling
// it with arguments will insert the arguments as content
...
...
@@ -182,6 +201,7 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co
// Clear all completed todo items, destroying their models.
clearCompleted
:
function
()
{
'
use strict
'
;
_
.
each
(
window
.
app
.
Todos
.
completed
(),
function
(
todo
)
{
todo
.
destroy
();
});
...
...
@@ -193,6 +213,7 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co
// be called to generate the context / scope that the template
// will be called with. "context" defaults to "return this"
context
:
function
()
{
'
use strict
'
;
var
remaining
=
window
.
app
.
Todos
.
remaining
().
length
;
return
{
itemText
:
remaining
===
1
?
'
item
'
:
'
items
'
,
...
...
@@ -203,15 +224,18 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co
// Highlight which filter will appear to be active
highlightFilter
:
function
()
{
'
use strict
'
;
this
.
$
(
'
#filters li a
'
)
.
removeClass
(
'
selected
'
)
.
filter
(
'
[href="#/
'
+
(
window
.
app
.
TodoFilter
||
''
)
+
'
"]
'
)
.
addClass
(
'
selected
'
);
.
removeClass
(
'
selected
'
)
.
filter
(
'
[href="#/
'
+
(
window
.
app
.
TodoFilter
||
''
)
+
'
"]
'
)
.
addClass
(
'
selected
'
);
}
});
;;
Thorax
.
templates
[
'
src/templates/app
'
]
=
Handlebars
.
compile
(
'
<section id=
\
"todoapp
\
">
\n
<header id=
\
"header
\
">
\n
<h1>todos</h1>
\n
<input id=
\
"new-todo
\
" placeholder=
\
"What needs to be done?
\
" autofocus>
\n
</header>
\n
{{^empty collection}}
\n
<section id=
\
"main
\
">
\n
<input id=
\
"toggle-all
\
" type=
\
"checkbox
\
">
\n
<label for=
\
"toggle-all
\
">Mark all as complete</label>
\n
{{#collection item-view=
\
"todo-item
\
" tag=
\
"ul
\
" id=
\
"todo-list
\
"}}
\n
<div class=
\
"view
\
">
\n
<input class=
\
"toggle
\
" type=
\
"checkbox
\
" {{#if completed}}checked=
\
"checked
\
"{{/if}}>
\n
<label>{{title}}</label>
\n
<button class=
\
"destroy
\
"></button>
\n
</div>
\n
<input class=
\
"edit
\
" value=
\
"{{title}}
\
">
\n
{{/collection}}
\n
</section>
\n
{{view
\
"stats
\
" tag=
\
"footer
\
" id=
\
"footer
\
"}}
\n
{{/empty}}
\n
</section>
\n
<div id=
\
"info
\
">
\n
<p>Double-click to edit a todo</p>
\n
<p>Written by <a href=
\
"https://github.com/addyosmani
\
">Addy Osmani</a> & <a href=
\
"https://github.com/eastridge
\
">Ryan Eastridge</a></p>
\n
<p>Part of <a href=
\
"http://todomvc.com
\
">TodoMVC</a></p>
\n
</div>
\n
'
);
$
(
function
(
$
)
{
Thorax
.
templates
[
'
src/templates/app
'
]
=
Handlebars
.
compile
(
'
<section id=
\
"todoapp
\
">
\n
<header id=
\
"header
\
">
\n
<h1>todos</h1>
\n
<input id=
\
"new-todo
\
" placeholder=
\
"What needs to be done?
\
" autofocus>
\n
</header>
\n
{{^empty collection}}
\n
<section id=
\
"main
\
">
\n
<input id=
\
"toggle-all
\
" type=
\
"checkbox
\
">
\n
<label for=
\
"toggle-all
\
">Mark all as complete</label>
\n
{{#collection item-view=
\
"todo-item
\
" tag=
\
"ul
\
" id=
\
"todo-list
\
"}}
\n
<div class=
\
"view
\
">
\n
<input class=
\
"toggle
\
" type=
\
"checkbox
\
" {{#if completed}}checked=
\
"checked
\
"{{/if}}>
\n
<label>{{title}}</label>
\n
<button class=
\
"destroy
\
"></button>
\n
</div>
\n
<input class=
\
"edit
\
" value=
\
"{{title}}
\
">
\n
{{/collection}}
\n
</section>
\n
{{view
\
"stats
\
" tag=
\
"footer
\
" id=
\
"footer
\
"}}
\n
{{/empty}}
\n
</section>
\n
<div id=
\
"info
\
">
\n
<p>Double-click to edit a todo</p>
\n
<p>Written by <a href=
\
"https://github.com/addyosmani
\
">Addy Osmani</a> & <a href=
\
"https://github.com/eastridge
\
">Ryan Eastridge</a></p>
\n
<p>Part of <a href=
\
"http://todomvc.com
\
">TodoMVC</a></p>
\n
</div>
\n
'
);
/*global Thorax, $, ENTER_KEY */
$
(
function
()
{
'
use strict
'
;
// The Application
...
...
@@ -281,6 +305,8 @@ Thorax.templates['src/templates/app'] = Handlebars.compile('<section id=\"todoap
});
;;
/*global Thorax */
(
function
()
{
'
use strict
'
;
...
...
@@ -300,14 +326,18 @@ Thorax.templates['src/templates/app'] = Handlebars.compile('<section id=\"todoap
// force the collection to re-filter
window
.
app
.
Todos
.
trigger
(
'
filter
'
);
}
}));
}))
()
;
}());
;;
/*global Thorax, $ */
/*jshint unused:false*/
var
ENTER_KEY
=
13
;
var
ESCAPE_KEY
=
27
;
$
(
function
()
{
'
use strict
'
;
// Kick things off by creating the **App**.
var
view
=
new
Thorax
.
Views
.
app
({
collection
:
window
.
app
.
Todos
...
...
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/app.js
View file @
0a9cbb0c
/*global Thorax, $ */
/*jshint unused:false*/
var
ENTER_KEY
=
13
;
var
ESCAPE_KEY
=
27
;
$
(
function
()
{
'
use strict
'
;
// Kick things off by creating the **App**.
var
view
=
new
Thorax
.
Views
.
app
({
collection
:
window
.
app
.
Todos
...
...
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/collections/todos.js
View file @
0a9cbb0c
/*global Thorax, Store */
(
function
()
{
'
use strict
'
;
...
...
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/init.js
View file @
0a9cbb0c
/*global Thorax, Backbone, $ */
//all templates are assumed to be in the templates directory
Thorax
.
templatePathPrefix
=
'
src/templates/
'
;
var
app
=
window
.
app
=
module
.
exports
;
$
(
function
()
{
'
use strict
'
;
app
.
initBackboneLoader
();
Backbone
.
history
.
start
();
});
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/models/todo.js
View file @
0a9cbb0c
/*global Thorax */
(
function
()
{
'
use strict
'
;
...
...
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/routers/todomvc.js
View file @
0a9cbb0c
/*global Thorax */
(
function
()
{
'
use strict
'
;
...
...
@@ -17,6 +19,6 @@
// force the collection to re-filter
window
.
app
.
Todos
.
trigger
(
'
filter
'
);
}
}));
}))
()
;
}());
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/views/app.js
View file @
0a9cbb0c
$
(
function
(
$
)
{
/*global Thorax, $, ENTER_KEY */
$
(
function
()
{
'
use strict
'
;
// The Application
...
...
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/views/stats.js
View file @
0a9cbb0c
/*global Thorax, _ */
Thorax
.
View
.
extend
({
name
:
'
stats
'
,
...
...
@@ -10,6 +12,7 @@ Thorax.View.extend({
},
initialize
:
function
()
{
'
use strict
'
;
// Whenever the Todos collection changes re-render the stats
// render() needs to be called with no arguments, otherwise calling
// it with arguments will insert the arguments as content
...
...
@@ -20,6 +23,7 @@ Thorax.View.extend({
// Clear all completed todo items, destroying their models.
clearCompleted
:
function
()
{
'
use strict
'
;
_
.
each
(
window
.
app
.
Todos
.
completed
(),
function
(
todo
)
{
todo
.
destroy
();
});
...
...
@@ -31,6 +35,7 @@ Thorax.View.extend({
// be called to generate the context / scope that the template
// will be called with. "context" defaults to "return this"
context
:
function
()
{
'
use strict
'
;
var
remaining
=
window
.
app
.
Todos
.
remaining
().
length
;
return
{
itemText
:
remaining
===
1
?
'
item
'
:
'
items
'
,
...
...
@@ -41,9 +46,10 @@ Thorax.View.extend({
// Highlight which filter will appear to be active
highlightFilter
:
function
()
{
'
use strict
'
;
this
.
$
(
'
#filters li a
'
)
.
removeClass
(
'
selected
'
)
.
filter
(
'
[href="#/
'
+
(
window
.
app
.
TodoFilter
||
''
)
+
'
"]
'
)
.
addClass
(
'
selected
'
);
.
removeClass
(
'
selected
'
)
.
filter
(
'
[href="#/
'
+
(
window
.
app
.
TodoFilter
||
''
)
+
'
"]
'
)
.
addClass
(
'
selected
'
);
}
});
This diff is collapsed.
Click to expand it.
examples/thorax_lumbar/src/js/views/todo-item.js
View file @
0a9cbb0c
/*global Thorax, $, ENTER_KEY, ESCAPE_KEY */
$
(
function
()
{
'
use strict
'
;
...
...
@@ -18,7 +20,7 @@ $(function () {
'
click .toggle
'
:
'
toggleCompleted
'
,
'
dblclick label
'
:
'
edit
'
,
'
click .destroy
'
:
'
clear
'
,
'
key
press .edit
'
:
'
updateOnEnt
er
'
,
'
key
up .edit
'
:
'
keyListen
er
'
,
'
blur .edit
'
:
'
close
'
,
// The "rendered" event is triggered by Thorax each time render()
// is called and the result of the template has been appended
...
...
@@ -36,11 +38,16 @@ $(function () {
// Switch this view into `"editing"` mode, displaying the input field.
edit
:
function
()
{
this
.
$el
.
addClass
(
'
editing
'
);
this
.
$
(
'
.edit
'
).
focus
();
this
.
$
(
'
.edit
'
).
val
(
this
.
model
.
get
(
'
title
'
)).
focus
();
},
// Close the `"editing"` mode
, saving changes to the todo
.
// Close the `"editing"` mode.
close
:
function
()
{
// If editing was cancelled, don't save
if
(
!
this
.
$el
.
hasClass
(
'
editing
'
))
{
return
;
}
var
value
=
this
.
$
(
'
.edit
'
).
val
().
trim
();
if
(
value
)
{
...
...
@@ -52,10 +59,17 @@ $(function () {
this
.
$el
.
removeClass
(
'
editing
'
);
},
// If you hit `enter`, we're through editing the item.
updateOnEnter
:
function
(
e
)
{
// User cancelled editing, don't update the todo.
cancelEdits
:
function
()
{
this
.
$el
.
removeClass
(
'
editing
'
);
},
// Enter completes the editing, Escape cancels it
keyListener
:
function
(
e
)
{
if
(
e
.
which
===
ENTER_KEY
)
{
this
.
close
();
}
else
if
(
e
.
which
===
ESCAPE_KEY
)
{
this
.
cancelEdits
();
}
},
...
...
This diff is collapsed.
Click to expand it.
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