Skip to content

Commit c015718

Browse files
committed
Title: fixed bug for note message, update adapter
Description: Todo Note messages weren't getting saved when editing an existing todo because we weren't properly following the data models and saving them directly. Similarly, the models were being left in a dirty state after hitting the back button which meant if you hit back then edited again, you would still see your changes. Also changed the adapter to persist data in browser storage.
1 parent 6b9b7b1 commit c015718

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

web/static/js/application.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
window.Todos = Ember.Application.create();
22

3-
Todos.ApplicationAdapter = DS.FixtureAdapter.extend();
4-
5-
/*
63
Todos.ApplicationAdapter = DS.LSAdapter.extend({
74
namespace: 'todos-emberjs'
85
});
9-
*/

web/static/js/controllers/todo_controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ Todos.TodoController = Ember.ObjectController.extend({
1818
todo.save();
1919
},
2020
saveTodo: function() {
21+
this.get('model').get('notes').get('content').get('content')[0].save();
2122
this.get('model').save();
2223

2324
// Send the user back to Todos index
2425
this.transitionToRoute('todos.index');
2526
},
2627
resetTodoModel: function(){
28+
this.get('model').get('notes').get('content').get('content')[0].rollback();
2729
this.get('model').rollback();
2830
}
2931
},

0 commit comments

Comments
 (0)