Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
amercier committed Jun 21, 2015
1 parent 8873373 commit 1dfde4e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
Empty file removed app/components/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion app/controllers/todo.js → app/components/todo-item.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';

export default Ember.Controller.extend({
export default Ember.Component.extend({
actions: {
editTodo: function() {
this.set('isEditing', true);
Expand Down
Empty file removed app/controllers/.gitkeep
Empty file.
Empty file removed app/models/.gitkeep
Empty file.
Empty file removed app/templates/components/.gitkeep
Empty file.
14 changes: 14 additions & 0 deletions app/templates/components/todo-item.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<li class="{{if isCompleted 'completed'}} {{if isEditing 'editing'}}">
{{#if isEditing}}
{{input class="edit"
value=model.title
focus-out="acceptChanges"
insert-newline="acceptChanges"
autofocus="autofocus"
}}
{{else}}
{{input type="checkbox" checked=isCompleted class="toggle"}}
<label {{action "editTodo" on="doubleClick"}}>{{model.title}}</label>
<button {{action "removeTodo"}} class="destroy"></button>
{{/if}}
</li>
17 changes: 2 additions & 15 deletions app/templates/todos/index.hbs
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
<ul id="todo-list">
{{#each todo in this itemController="todo"}}
<li class="{{if todo.isCompleted 'completed'}} {{if todo.isEditing 'editing'}}">
{{#if todo.isEditing}}
{{input class="edit"
value=todo.model.title
focus-out="acceptChanges"
insert-newline="acceptChanges"
autofocus="autofocus"
}}
{{else}}
{{input type="checkbox" checked=todo.isCompleted class="toggle"}}
<label {{action "editTodo" on="doubleClick"}}>{{todo.model.title}}</label>
<button {{action "removeTodo"}} class="destroy"></button>
{{/if}}
</li>
{{#each this as |todo|}}
{{todo-item model=todo.model}}
{{/each}}
</ul>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"bower": "1.4.1",
"broccoli-asset-rev": "2.0.3",
"broccoli-clean-css": "1.0.0",
"ember-cli": "0.2.3",
"ember-cli": "0.2.7",
"ember-cli-app-version": "0.3.3",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-htmlbars": "0.7.6",
Expand Down

0 comments on commit 1dfde4e

Please sign in to comment.