Anton Shestakov <av6@dwimlabs.net>, Fri, 27 May 2016 18:37:01 +0800
docs: add release dates
static/js/framework/views/inline.js
Permissions: -rw-r--r--
var InlineEditorView = Backbone.View.extend({ initialize: function(options) { renderInput: function(options) { this.$input = $('<input type="text" class="form-control input-sm">').val(options.target.text()); this.$input.keyup(function(e) { view.$saveButton.click(); view.$cancelButton.click(); this.$group.append(this.$saveButton, this.$cancelButton); this.$el.append(this.$input, this.$group); options.target.after(this.$el); renderTextarea: function(options) { this.$input = $('<textarea class="form-control input-sm" rows="3">').text(options.target.text()); this.$input.keyup(function(e) { view.$saveButton.click(); view.$cancelButton.click(); this.$group.append(this.$saveButton, this.$cancelButton); this.$el.append(this.$input, this.$group); options.target.after(this.$el); render: function(options) { this.$saveButton = $('<button class="btn btn-sm btn-success">').html('<i class="glyphicon glyphicon-ok"></i>'); this.$cancelButton = $('<button class="btn btn-sm btn-default">').html('<i class="glyphicon glyphicon-remove"></i>'); this.$el = $('<div class="inline-editor input-group">'); this.$group = $('<span class="input-group-btn">'); this.$cancelButton.click(function() { this.$saveButton.click(function() { view.trigger('save', view.$input.val()); return this.renderInput(options); return this.renderTextarea(options); var CollectionViewWithInlineEditor = CollectionView.extend({ bindInlineEditable: function(model, selector) { model.$item.delegate(selector, 'click', function(e) { var attribute = $this.attr('data-model-attribute'); var inlineEditor = new InlineEditorView({ type: $this.attr('data-input-type') || 'input' inlineEditor.on('save', function(value) { model.adhoc(data).then(function() {