Anton Shestakov <engored@ya.ru>, Wed, 26 Dec 2012 22:01:21 +0900
Added tag 0.1.0 for changeset 1622dbdfa709
static/js/framework/views/tasks.js
Permissions: -rw-r--r--
var TasksView = CollectionViewWithInlineEditor.extend({ initialize: function(options) { this.compileTemplates(options.templates); options.controls.create.click(function() { options.collection.create({ renderItem: function(task) { var $item = $(this.templates.task(task.toJSON())); task.adhoc({'done': this.checked}); .find('.btn-delete-task') task.destroy({wait: true}); updateNote: function(task) { var $note = task.$item.find('[data-model="task"][data-model-attribute="note"]'); $note.text(task.get('note')); task.$item.find('.task-note').removeClass('muted').addClass('present'); task.$item.find('.task-note').addClass('muted').removeClass('present'); appendItem: function(task) { task.$item = this.renderItem(task); this.bindInlineEditable(task, '.inline-editable[data-model="task"]'); task.on('change:done', function() { task.$item.find('input:checkbox').prop('checked', task.get('done')); task.on('change:name', function() { task.$item.find('[data-model="task"][data-model-attribute="name"]').text(task.get('name')); task.on('change:note', function() { this.$el.append(task.$item); removeItem: function(task) {