Commit f2a26dc0 authored by Addy Osmani's avatar Addy Osmani

fixing firefox issues related to new todo appending

parent 9ae927f9
...@@ -96,6 +96,7 @@ changes to code. At present, JavaScriptMVC is the only framework included which ...@@ -96,6 +96,7 @@ changes to code. At present, JavaScriptMVC is the only framework included which
<li><a href="todo-example/spine/index.html">Spine.js</a></li> <li><a href="todo-example/spine/index.html">Spine.js</a></li>
<li><a href="todo-example/sammyjs/index.html">Sammy.js</a></li> <li><a href="todo-example/sammyjs/index.html">Sammy.js</a></li>
<li><a href="todo-example/knockoutjs/index.html">KnockoutJS (MVVM)</a></li> <li><a href="todo-example/knockoutjs/index.html">KnockoutJS (MVVM)</a></li>
<li><a href="todo-example/sproutcore/index.html">SproutCore</a></li>
</ul> </section> <!-- /.widget --> </ul> </section> <!-- /.widget -->
<section class="widget"> <h4 class="widgettitle">GitHub</h4> <ul> <li><a <section class="widget"> <h4 class="widgettitle">GitHub</h4> <ul> <li><a
...@@ -107,7 +108,11 @@ href="https://github.com/addyosmani/todomvc/">View repository</a></li> </ul> ...@@ -107,7 +108,11 @@ href="https://github.com/addyosmani/todomvc/">View repository</a></li> </ul>
href="http://twitter.com/addyosmani">Addy Osmani</a></li> <li><a href="http://twitter.com/addyosmani">Addy Osmani</a></li> <li><a
href="http://twitter.com/justinbmeyer">Justin Meyer</a></li> <li><a href="http://twitter.com/justinbmeyer">Justin Meyer</a></li> <li><a
href="http://twitter.com/jeromegn">Jérôme Gravel-Niquet</a></li> <li><a href="http://twitter.com/jeromegn">Jérôme Gravel-Niquet</a></li> <li><a
href="http://twitter.com/macmann">Alex MacCaw</a></li> <li><a href="">Ashish Sharma</a></li> </ul> href="http://twitter.com/macmann">Alex MacCaw</a></li>
<li><a href="">Ashish Sharma</a></li>
<li><a href="http://sproutcore.com">Tom Dale, Yehuda Katz</a></li>
</ul>
</section> <!-- /.widget --> </section> <!-- /.widget -->
......
...@@ -46,24 +46,14 @@ ...@@ -46,24 +46,14 @@
var todoContent = $(this).val(); var todoContent = $(this).val();
var todo = Todos.create({ name: todoContent, done: false, listId: parseInt($('h2').attr('data-id'), 10) }); var todo = Todos.create({ name: todoContent, done: false, listId: parseInt($('h2').attr('data-id'), 10) });
context.partial('templates/_todo.template', todo, function(html) { context.partial('templates/_todo.template', todo, function(html) {
//$(html).insertAfter('#todo-list li:last'); $('#todo-list').append(html);
var q = $(html);
console.log(q);
$('#todo-list').append(q);
}); });
$(this).val(''); $(this).val('');
} }
}); });
/*
$('#lists')
.delegate('dd[data-id]', 'click', function() {
context.redirect('#/list/'+$(this).attr('data-id'));
app.trigger('updateList');
});*/
$('.trashcan') $('.trashcan')
.live('click', function() { .live('click', function() {
...@@ -84,14 +74,7 @@ ...@@ -84,14 +74,7 @@
app.trigger('mark' + (isDone ? 'Done' : 'Undone'), { id: $li.attr('data-id') }); app.trigger('mark' + (isDone ? 'Done' : 'Undone'), { id: $li.attr('data-id') });
}); });
/*
$('.checkbox')
.live('click', function() {
var $this = $(this),
$li = $this.parents('li').toggleClass('done'),
isDone = $li.is('.done');
app.trigger('mark' + (isDone ? 'Done' : 'Undone'), { id: $li.attr('data-id') });
});*/
$('[contenteditable]') $('[contenteditable]')
.live('focus', function() { .live('focus', function() {
...@@ -145,7 +128,6 @@ ...@@ -145,7 +128,6 @@
this.redirect(lastViewedOrFirstList); this.redirect(lastViewedOrFirstList);
} }
//app.trigger('updateLists');
}); });
/*save the route as the lastviewed item*/ /*save the route as the lastviewed item*/
...@@ -156,9 +138,7 @@ ...@@ -156,9 +138,7 @@
this.bind('save', function(e, data) { this.bind('save', function(e, data) {
var model = data.type == 'todo' ? Todos : Lists; var model = data.type == 'todo' ? Todos : Lists;
model.update(data.id, { name: data.name }); model.update(data.id, { name: data.name });
//if (data.type == 'list') {
//app.trigger('updateLists');
// }
}); });
/*marking the selected item as done*/ /*marking the selected item as done*/
...@@ -193,25 +173,12 @@ ...@@ -193,25 +173,12 @@
this.redirect('#/list/'+listId); this.redirect('#/list/'+listId);
} }
//app.trigger('updateLists');
} else { } else {
// delete the todo from the view // delete the todo from the view
$('li[data-id=' + data.id + ']').remove(); $('li[data-id=' + data.id + ']').remove();
} }
// }
}); });
/*
this.bind('updateLists', function(e, data) {
var selected = parseInt(location.hash.substr(location.hash.lastIndexOf('/')+1), 10);
this.partial('templates/_lists.template', {
lists: Lists.getAll(),
selected: selected
}, function(html) {
$('#lists').html(html);
});
});*/
}); });
......
<h2>What?!</h2> There was an error.
<p>Try clicking on one of your lists to the right.</p> \ No newline at end of file
\ No newline at end of file
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