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
a9a0d679
Commit
a9a0d679
authored
Mar 21, 2015
by
Arthur Verschaeve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert on escape for `angularjs_require` app
parent
e5adfb0c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
3 deletions
+24
-3
browser-tests/knownIssues.js
browser-tests/knownIssues.js
+0
-1
examples/angularjs_require/index.html
examples/angularjs_require/index.html
+1
-1
examples/angularjs_require/js/controllers/todo.js
examples/angularjs_require/js/controllers/todo.js
+6
-0
examples/angularjs_require/js/directives/todoEscape.js
examples/angularjs_require/js/directives/todoEscape.js
+16
-0
examples/angularjs_require/js/main.js
examples/angularjs_require/js/main.js
+1
-1
No files found.
browser-tests/knownIssues.js
View file @
a9a0d679
...
...
@@ -63,7 +63,6 @@ module.exports = [
'
TodoMVC - serenadejs, Editing, should cancel edits on escape
'
,
'
TodoMVC - thorax, Editing, should cancel edits on escape
'
,
'
TodoMVC - typescript-angular, Editing, should cancel edits on escape
'
,
'
TodoMVC - angularjs_require, Editing, should cancel edits on escape
'
,
'
TodoMVC - flight, Editing, should cancel edits on escape
'
,
'
TodoMVC - thorax_lumbar, Editing, should cancel edits on escape
'
,
'
TodoMVC - backbone_require, Editing, should cancel edits on escape
'
,
...
...
examples/angularjs_require/index.html
View file @
a9a0d679
...
...
@@ -29,7 +29,7 @@
<button
class=
"destroy"
ng-click=
"removeTodo(todo)"
></button>
</div>
<form
ng-submit=
"doneEditing(todo)"
>
<input
class=
"edit"
ng-trim=
"false"
ng-model=
"todo.title"
ng-blur=
"doneEditing(todo)"
todo-focus=
"todo == editedTodo"
>
<input
class=
"edit"
ng-trim=
"false"
ng-model=
"todo.title"
ng-blur=
"doneEditing(todo)"
todo-
escape=
"revertEditing(todo)"
todo-
focus=
"todo == editedTodo"
>
</form>
</li>
</ul>
...
...
examples/angularjs_require/js/controllers/todo.js
View file @
a9a0d679
...
...
@@ -52,6 +52,8 @@ define(['app', 'services/todoStorage'], function (app) {
$scope
.
editTodo
=
function
(
todo
)
{
$scope
.
editedTodo
=
todo
;
// Clone the original todo to restore it on demand.
$scope
.
originalTodo
=
angular
.
copy
(
todo
);
};
...
...
@@ -64,6 +66,10 @@ define(['app', 'services/todoStorage'], function (app) {
}
};
$scope
.
revertEditing
=
function
(
todo
)
{
todos
[
todos
.
indexOf
(
todo
)]
=
$scope
.
originalTodo
;
$scope
.
doneEditing
(
$scope
.
originalTodo
);
};
$scope
.
removeTodo
=
function
(
todo
)
{
todos
.
splice
(
todos
.
indexOf
(
todo
),
1
);
...
...
examples/angularjs_require/js/directives/todoEscape.js
0 → 100644
View file @
a9a0d679
/*global define*/
define
([
'
app
'
],
function
(
app
)
{
'
use strict
'
;
app
.
directive
(
'
todoEscape
'
,
function
()
{
var
ESCAPE_KEY
=
27
;
return
function
(
scope
,
elem
,
attrs
)
{
elem
.
bind
(
'
keydown
'
,
function
(
event
)
{
if
(
event
.
keyCode
===
ESCAPE_KEY
)
{
scope
.
$apply
(
attrs
.
todoEscape
);
}
});
};
});
});
examples/angularjs_require/js/main.js
View file @
a9a0d679
...
...
@@ -12,6 +12,6 @@ require.config({
}
});
require
([
'
angular
'
,
'
app
'
,
'
controllers/todo
'
,
'
directives/todoFocus
'
],
function
(
angular
)
{
require
([
'
angular
'
,
'
app
'
,
'
controllers/todo
'
,
'
directives/todoFocus
'
,
'
directives/todoEscape
'
],
function
(
angular
)
{
angular
.
bootstrap
(
document
,
[
'
todomvc
'
]);
});
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