Commit 193752e8 authored by Peter Müller's avatar Peter Müller Committed by Sindre Sorhus

Close GH-847: Ember: Prevent global leakage of 'use strict' directive.

parent 64af0c87
/*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;
}
});
});
})();
/*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')
});
});
})();
/*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')
});
});
})();
/*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);
});
});
})();
/*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')
});
});
})();
/*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);
}
});
});
})();
/*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);
})();
/*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')
});
});
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment