Anton Shestakov <av6@dwimlabs.net>, Mon, 18 Jul 2016 21:21:10 +0800
fruitbar: don't import from flask.ext (preparing for Flask 0.11+)
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) {