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
d82fcf5a
Commit
d82fcf5a
authored
Jun 29, 2013
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #616 from stephenplusplus/flight-bug
(flight) bug with clearCompleted.
parents
d50f6e65
cceaffa8
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
355 additions
and
399 deletions
+355
-399
dependency-examples/flight/app/js/app.js
dependency-examples/flight/app/js/app.js
+22
-34
dependency-examples/flight/app/js/data/stats.js
dependency-examples/flight/app/js/data/stats.js
+29
-33
dependency-examples/flight/app/js/data/todos.js
dependency-examples/flight/app/js/data/todos.js
+78
-84
dependency-examples/flight/app/js/store.js
dependency-examples/flight/app/js/store.js
+7
-9
dependency-examples/flight/app/js/ui/main_selector.js
dependency-examples/flight/app/js/ui/main_selector.js
+15
-19
dependency-examples/flight/app/js/ui/new_item.js
dependency-examples/flight/app/js/ui/new_item.js
+21
-25
dependency-examples/flight/app/js/ui/stats.js
dependency-examples/flight/app/js/ui/stats.js
+33
-37
dependency-examples/flight/app/js/ui/todo_list.js
dependency-examples/flight/app/js/ui/todo_list.js
+104
-109
dependency-examples/flight/app/js/ui/toggle_all.js
dependency-examples/flight/app/js/ui/toggle_all.js
+19
-23
dependency-examples/flight/app/js/ui/with_filters.js
dependency-examples/flight/app/js/ui/with_filters.js
+20
-22
dependency-examples/flight/app/js/utils.js
dependency-examples/flight/app/js/utils.js
+3
-2
dependency-examples/flight/app/templates/stats.html
dependency-examples/flight/app/templates/stats.html
+4
-2
No files found.
dependency-examples/flight/app/js/app.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
./data/todos
'
,
'
./data/stats
'
,
'
./ui/new_item
'
,
...
...
@@ -10,17 +9,7 @@ define(
'
./ui/stats
'
,
'
./ui/main_selector
'
,
'
./ui/toggle_all
'
],
function
(
TodosData
,
StatsData
,
NewItemUI
,
TodoListUI
,
StatsUI
,
MainSelectorUI
,
ToggleAllUI
)
{
],
function
(
TodosData
,
StatsData
,
NewItemUI
,
TodoListUI
,
StatsUI
,
MainSelectorUI
,
ToggleAllUI
)
{
var
initialize
=
function
()
{
StatsData
.
attachTo
(
document
);
TodosData
.
attachTo
(
document
);
...
...
@@ -34,5 +23,4 @@ define(
return
{
initialize
:
initialize
};
}
);
});
dependency-examples/flight/app/js/data/stats.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
flight/component
'
,
'
../store
'
],
function
(
defineComponent
,
dataStore
)
{
return
defineComponent
(
stats
);
],
function
(
defineComponent
,
dataStore
)
{
function
stats
()
{
this
.
recount
=
function
()
{
var
todos
=
dataStore
.
all
();
...
...
@@ -35,5 +30,6 @@ define(
this
.
on
(
document
,
'
dataTodoToggledAll
'
,
this
.
recount
);
});
}
}
);
return
defineComponent
(
stats
);
});
dependency-examples/flight/app/js/data/todos.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
flight/component
'
,
'
../store
'
],
function
(
defineComponent
,
dataStore
)
{
return
defineComponent
(
todos
);
],
function
(
defineComponent
,
dataStore
)
{
function
todos
()
{
var
filter
;
...
...
@@ -28,7 +23,7 @@ define(
this
.
trigger
(
'
dataTodoRemoved
'
,
todo
);
};
this
.
load
=
function
(
e
,
data
)
{
this
.
load
=
function
(
)
{
var
todos
;
filter
=
localStorage
.
getItem
(
'
filter
'
);
...
...
@@ -74,8 +69,7 @@ define(
todos
=
dataStore
.
find
(
function
(
each
)
{
return
(
typeof
each
[
filter
]
!==
'
undefined
'
)
?
each
.
completed
:
!
each
.
completed
;
});
}
else
{
}
else
{
todos
=
dataStore
.
all
();
}
...
...
@@ -83,11 +77,10 @@ define(
};
this
.
clearCompleted
=
function
()
{
var
todos
;
dataStore
.
destroyAll
({
completed
:
true
});
todos
=
dataStore
.
all
();
this
.
trigger
(
'
dataClearedCompleted
'
,
{
todos
:
todos
});
this
.
trigger
(
'
uiFilterRequested
'
,
{
filter
:
filter
});
this
.
trigger
(
'
dataClearedCompleted
'
);
};
this
.
after
(
'
initialize
'
,
function
()
{
...
...
@@ -101,5 +94,6 @@ define(
this
.
on
(
document
,
'
uiFilterRequested
'
,
this
.
filter
);
});
}
}
);
return
defineComponent
(
todos
);
});
dependency-examples/flight/app/js/store.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
depot
'
],
function
(
depot
)
{
],
function
(
depot
)
{
return
depot
(
'
todos
'
,
{
idAttribute
:
'
id
'
});
}
);
});
dependency-examples/flight/app/js/ui/main_selector.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
flight/component
'
],
function
(
defineComponent
)
{
return
defineComponent
(
mainSelector
);
],
function
(
defineComponent
)
{
function
mainSelector
()
{
this
.
toggle
=
function
(
e
,
data
)
{
var
toggle
=
data
.
all
>
0
;
...
...
@@ -20,5 +15,6 @@ define(
this
.
on
(
document
,
'
dataStatsCounted
'
,
this
.
toggle
);
});
}
}
);
return
defineComponent
(
mainSelector
);
});
dependency-examples/flight/app/js/ui/new_item.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
flight/component
'
],
function
(
defineComponent
)
{
return
defineComponent
(
newItem
);
],
function
(
defineComponent
)
{
function
newItem
()
{
var
ENTER_KEY
=
13
;
...
...
@@ -29,5 +24,6 @@ define(
this
.
on
(
'
keydown
'
,
this
.
createOnEnter
);
});
}
}
);
return
defineComponent
(
newItem
);
});
dependency-examples/flight/app/js/ui/stats.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
flight/component
'
,
'
./with_filters
'
,
'
text!app/templates/stats.html
'
,
'
../utils
'
],
function
(
defineComponent
,
withFilters
,
statsTmpl
,
utils
)
{
return
defineComponent
(
stats
,
withFilters
);
],
function
(
defineComponent
,
withFilters
,
statsTmpl
,
utils
)
{
function
stats
()
{
var
template
=
utils
.
tmpl
(
statsTmpl
);
...
...
@@ -27,7 +22,7 @@ define(
this
.
markSelected
(
data
.
filter
);
};
this
.
clearCompleted
=
function
(
e
,
data
)
{
this
.
clearCompleted
=
function
(
)
{
this
.
trigger
(
'
uiClearRequested
'
);
};
...
...
@@ -37,5 +32,6 @@ define(
this
.
on
(
'
click
'
,
{
'
clearCompletedSelector
'
:
this
.
clearCompleted
});
});
}
}
);
return
defineComponent
(
stats
,
withFilters
);
});
dependency-examples/flight/app/js/ui/todo_list.js
View file @
d82fcf5a
/*global define $ */
/*global define
,
$ */
'
use strict
'
;
define
(
[
define
([
'
flight/component
'
,
'
text!app/templates/todo.html
'
,
'
../utils
'
],
function
(
defineComponent
,
todoTmpl
,
utils
)
{
return
defineComponent
(
todoList
);
],
function
(
defineComponent
,
todoTmpl
,
utils
)
{
function
todoList
()
{
var
ENTER_KEY
=
13
;
var
template
=
utils
.
tmpl
(
todoTmpl
);
...
...
@@ -44,7 +39,7 @@ define(
this
.
select
(
'
editSelector
'
).
focus
();
};
this
.
requestUpdate
=
function
(
e
,
data
)
{
this
.
requestUpdate
=
function
(
e
)
{
var
$inputEl
=
$
(
e
.
currentTarget
);
var
$todoEl
=
$inputEl
.
parents
(
'
li
'
);
var
value
=
$inputEl
.
val
().
trim
();
...
...
@@ -54,7 +49,7 @@ define(
return
;
}
!
$todoEl
.
removeClass
(
'
editing
'
);
$todoEl
.
removeClass
(
'
editing
'
);
if
(
value
)
{
$todoEl
.
find
(
'
label
'
).
html
(
value
);
...
...
@@ -91,7 +86,6 @@ define(
this
.
on
(
document
,
'
dataTodoAdded
'
,
this
.
render
);
this
.
on
(
document
,
'
dataTodosLoaded
'
,
this
.
renderAll
);
this
.
on
(
document
,
'
dataTodosFiltered
'
,
this
.
renderAll
);
this
.
on
(
document
,
'
dataClearedCompleted
'
,
this
.
renderAll
);
this
.
on
(
document
,
'
dataTodoToggledAll
'
,
this
.
renderAll
);
this
.
on
(
document
,
'
dataTodoRemoved
'
,
this
.
remove
);
...
...
@@ -109,5 +103,6 @@ define(
this
.
trigger
(
'
uiLoadRequested
'
);
});
}
}
);
return
defineComponent
(
todoList
);
});
dependency-examples/flight/app/js/ui/toggle_all.js
View file @
d82fcf5a
/*global define */
'
use strict
'
;
define
(
[
define
([
'
flight/component
'
],
function
(
defineComponent
)
{
return
defineComponent
(
toggleAll
);
],
function
(
defineComponent
)
{
function
toggleAll
()
{
this
.
toggleAllComplete
=
function
()
{
this
.
trigger
(
'
uiToggleAllRequested
'
,
{
...
...
@@ -25,5 +20,6 @@ define(
this
.
on
(
document
,
'
dataStatsCounted
'
,
this
.
toggleCheckbox
);
});
}
}
);
return
defineComponent
(
toggleAll
);
});
dependency-examples/flight/app/js/ui/with_filters.js
View file @
d82fcf5a
/*global define $ */
/*global define
,
$ */
'
use strict
'
;
define
(
function
()
{
define
(
function
()
{
return
function
withFilters
()
{
this
.
defaultAttrs
({
filterSelector
:
'
#filters a
'
...
...
@@ -24,5 +23,4 @@ define(
this
.
on
(
'
click
'
,
{
filterSelector
:
this
.
chooseFilter
});
});
};
}
);
});
dependency-examples/flight/app/js/utils.js
View file @
d82fcf5a
...
...
@@ -4,7 +4,6 @@
// tmpl function scooped from underscore.
// http://documentcloud.github.com/underscore/#template
define
(
function
()
{
var
_
=
{};
// List of HTML entities for escaping.
...
...
@@ -128,5 +127,7 @@ define(function () {
return
template
;
};
return
{
tmpl
:
template
};
return
{
tmpl
:
template
};
});
dependency-examples/flight/app/templates/stats.html
View file @
d82fcf5a
<span
id=
"todo-count"
><strong><
%=
remaining
%
></strong>
<
%=
remaining =
=
1
?
'
item
'
:
'
items
'
%
>
left
</span>
<span
id=
"todo-count"
>
<strong><
%=
remaining
%
></strong>
<
%=
remaining =
=
1
?
'
item
'
:
'
items
'
%
>
left
</span>
<ul
id=
"filters"
>
<li>
<a
href=
"#/"
>
All
</a>
...
...
@@ -11,5 +13,5 @@
</li>
</ul>
<
%
if
(
completed
)
{
%
>
<button
id=
"clear-completed"
>
Clear completed (
<
%=
completed
%
>
)
</button>
<button
id=
"clear-completed"
>
Clear completed (
<
%=
completed
%
>
)
</button>
<
%
}
%
>
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