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
Sven Franck
todomvc
Commits
193752e8
Commit
193752e8
authored
Feb 13, 2014
by
Peter Müller
Committed by
Sindre Sorhus
Feb 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close GH-847: Ember: Prevent global leakage of 'use strict' directive.
parent
64af0c87
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
284 additions
and
269 deletions
+284
-269
architecture-examples/emberjs/bower_components/ember-localstorage-adapter/localstorage_adapter.js
...onents/ember-localstorage-adapter/localstorage_adapter.js
+119
-117
architecture-examples/emberjs/js/controllers/todo_controller.js
...ecture-examples/emberjs/js/controllers/todo_controller.js
+52
-51
architecture-examples/emberjs/js/controllers/todos_controller.js
...cture-examples/emberjs/js/controllers/todos_controller.js
+45
-43
architecture-examples/emberjs/js/helpers/pluralize.js
architecture-examples/emberjs/js/helpers/pluralize.js
+8
-6
architecture-examples/emberjs/js/models/todo.js
architecture-examples/emberjs/js/models/todo.js
+7
-5
architecture-examples/emberjs/js/router.js
architecture-examples/emberjs/js/router.js
+34
-32
architecture-examples/emberjs/js/views/edit_todo_view.js
architecture-examples/emberjs/js/views/edit_todo_view.js
+11
-9
architecture-examples/emberjs/js/views/todos_view.js
architecture-examples/emberjs/js/views/todos_view.js
+8
-6
No files found.
architecture-examples/emberjs/bower_components/ember-localstorage-adapter/localstorage_adapter.js
View file @
193752e8
/*global Ember*/
/*global DS*/
'
use strict
'
;
(
function
()
{
'
use strict
'
;
DS
.
LSAdapter
=
DS
.
Adapter
.
extend
(
Ember
.
Evented
,
{
DS
.
LSAdapter
=
DS
.
Adapter
.
extend
(
Ember
.
Evented
,
{
init
:
function
()
{
this
.
_loadData
();
...
...
@@ -125,4 +126,5 @@ DS.LSAdapter = DS.Adapter.extend(Ember.Evented, {
var
data
=
record
.
serialize
({
includeId
:
true
});
namespace
.
records
[
data
.
id
]
=
data
;
}
});
});
})();
architecture-examples/emberjs/js/controllers/todo_controller.js
View file @
193752e8
/*global Todos, Ember */
'
use strict
'
;
Todos
.
TodoController
=
Ember
.
ObjectController
.
extend
({
(
function
()
{
'
use strict
'
;
Todos
.
TodoController
=
Ember
.
ObjectController
.
extend
({
isEditing
:
false
,
// We use the bufferedTitle to store the original value of
...
...
@@ -55,4 +55,5 @@ Todos.TodoController = Ember.ObjectController.extend({
saveWhenCompleted
:
function
()
{
this
.
get
(
'
model
'
).
save
();
}.
observes
(
'
isCompleted
'
)
});
});
})();
architecture-examples/emberjs/js/controllers/todos_controller.js
View file @
193752e8
/*global Todos, Ember */
'
use strict
'
;
(
function
()
{
'
use strict
'
;
Todos
.
TodosController
=
Ember
.
ArrayController
.
extend
({
Todos
.
TodosController
=
Ember
.
ArrayController
.
extend
({
actions
:
{
createTodo
:
function
()
{
var
title
,
todo
;
...
...
@@ -46,4 +47,5 @@ Todos.TodosController = Ember.ArrayController.extend({
return
length
>
0
&&
length
===
completedLength
;
}
}.
property
(
'
length
'
,
'
completed.length
'
)
});
});
})();
architecture-examples/emberjs/js/helpers/pluralize.js
View file @
193752e8
/*global Todos, Ember */
'
use strict
'
;
(
function
()
{
'
use strict
'
;
Ember
.
Handlebars
.
helper
(
'
pluralize
'
,
function
(
singular
,
count
)
{
Ember
.
Handlebars
.
helper
(
'
pluralize
'
,
function
(
singular
,
count
)
{
/* From Ember-Data */
var
inflector
=
new
Ember
.
Inflector
(
Ember
.
Inflector
.
defaultRules
);
return
count
===
1
?
singular
:
inflector
.
pluralize
(
singular
);
});
});
})();
architecture-examples/emberjs/js/models/todo.js
View file @
193752e8
/*global Todos, DS */
'
use strict
'
;
(
function
()
{
'
use strict
'
;
Todos
.
Todo
=
DS
.
Model
.
extend
({
Todos
.
Todo
=
DS
.
Model
.
extend
({
title
:
DS
.
attr
(
'
string
'
),
isCompleted
:
DS
.
attr
(
'
boolean
'
)
});
});
})();
architecture-examples/emberjs/js/router.js
View file @
193752e8
/*global Ember, Todos */
'
use strict
'
;
(
function
()
{
'
use strict
'
;
Todos
.
Router
.
map
(
function
()
{
Todos
.
Router
.
map
(
function
()
{
this
.
resource
(
'
todos
'
,
{
path
:
'
/
'
},
function
()
{
this
.
route
(
'
active
'
);
this
.
route
(
'
completed
'
);
});
});
});
Todos
.
TodosRoute
=
Ember
.
Route
.
extend
({
Todos
.
TodosRoute
=
Ember
.
Route
.
extend
({
model
:
function
()
{
return
this
.
store
.
find
(
'
todo
'
);
}
});
});
Todos
.
TodosIndexRoute
=
Ember
.
Route
.
extend
({
Todos
.
TodosIndexRoute
=
Ember
.
Route
.
extend
({
setupController
:
function
()
{
this
.
controllerFor
(
'
todos
'
).
set
(
'
filteredTodos
'
,
this
.
modelFor
(
'
todos
'
));
}
});
});
Todos
.
TodosActiveRoute
=
Ember
.
Route
.
extend
({
Todos
.
TodosActiveRoute
=
Ember
.
Route
.
extend
({
setupController
:
function
()
{
var
todos
=
this
.
store
.
filter
(
'
todo
'
,
function
(
todo
)
{
return
!
todo
.
get
(
'
isCompleted
'
);
...
...
@@ -28,9 +29,9 @@ Todos.TodosActiveRoute = Ember.Route.extend({
this
.
controllerFor
(
'
todos
'
).
set
(
'
filteredTodos
'
,
todos
);
}
});
});
Todos
.
TodosCompletedRoute
=
Ember
.
Route
.
extend
({
Todos
.
TodosCompletedRoute
=
Ember
.
Route
.
extend
({
setupController
:
function
()
{
var
todos
=
this
.
store
.
filter
(
'
todo
'
,
function
(
todo
)
{
return
todo
.
get
(
'
isCompleted
'
);
...
...
@@ -38,4 +39,5 @@ Todos.TodosCompletedRoute = Ember.Route.extend({
this
.
controllerFor
(
'
todos
'
).
set
(
'
filteredTodos
'
,
todos
);
}
});
});
})();
architecture-examples/emberjs/js/views/edit_todo_view.js
View file @
193752e8
/*global Todos, Ember */
'
use strict
'
;
(
function
()
{
'
use strict
'
;
Todos
.
EditTodoView
=
Ember
.
TextField
.
extend
({
Todos
.
EditTodoView
=
Ember
.
TextField
.
extend
({
focusOnInsert
:
function
()
{
// Re-set input value to get rid of a reduntant text selection
this
.
$
().
val
(
this
.
$
().
val
());
this
.
$
().
focus
();
}.
on
(
'
didInsertElement
'
)
});
});
Ember
.
Handlebars
.
helper
(
'
edit-todo
'
,
Todos
.
EditTodoView
);
Ember
.
Handlebars
.
helper
(
'
edit-todo
'
,
Todos
.
EditTodoView
);
})();
architecture-examples/emberjs/js/views/todos_view.js
View file @
193752e8
/*global Todos, Ember */
'
use strict
'
;
(
function
()
{
'
use strict
'
;
Todos
.
TodosView
=
Ember
.
View
.
extend
({
Todos
.
TodosView
=
Ember
.
View
.
extend
({
focusInput
:
function
()
{
this
.
$
(
'
#new-todo
'
).
focus
();
}.
on
(
'
didInsertElement
'
)
});
});
})();
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