Anton Shestakov <av6@dwimlabs.net>, Wed, 06 Apr 2016 13:23:19 +0800
provision: set root outside of location block
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) {