[view,util,refactor][s]: move cellEditor template into view-grid from util (as only place it is used).
This commit is contained in:
11
src/util.js
11
src/util.js
@@ -3,17 +3,6 @@
|
|||||||
var util = function() {
|
var util = function() {
|
||||||
var templates = {
|
var templates = {
|
||||||
transformActions: '<li><a data-action="transform" class="menuAction" href="JavaScript:void(0);">Global transform...</a></li>',
|
transformActions: '<li><a data-action="transform" class="menuAction" href="JavaScript:void(0);">Global transform...</a></li>',
|
||||||
cellEditor: ' \
|
|
||||||
<div class="menu-container data-table-cell-editor"> \
|
|
||||||
<textarea class="data-table-cell-editor-editor" bind="textarea">{{value}}</textarea> \
|
|
||||||
<div id="data-table-cell-editor-actions"> \
|
|
||||||
<div class="data-table-cell-editor-action"> \
|
|
||||||
<button class="okButton btn primary">Update</button> \
|
|
||||||
<button class="cancelButton btn danger">Cancel</button> \
|
|
||||||
</div> \
|
|
||||||
</div> \
|
|
||||||
</div> \
|
|
||||||
',
|
|
||||||
editPreview: ' \
|
editPreview: ' \
|
||||||
<div class="expression-preview-table-wrapper"> \
|
<div class="expression-preview-table-wrapper"> \
|
||||||
<table> \
|
<table> \
|
||||||
|
|||||||
@@ -260,6 +260,19 @@ my.GridRow = Backbone.View.extend({
|
|||||||
|
|
||||||
// ===================
|
// ===================
|
||||||
// Cell Editor methods
|
// Cell Editor methods
|
||||||
|
|
||||||
|
cellEditorTemplate: ' \
|
||||||
|
<div class="menu-container data-table-cell-editor"> \
|
||||||
|
<textarea class="data-table-cell-editor-editor" bind="textarea">{{value}}</textarea> \
|
||||||
|
<div id="data-table-cell-editor-actions"> \
|
||||||
|
<div class="data-table-cell-editor-action"> \
|
||||||
|
<button class="okButton btn primary">Update</button> \
|
||||||
|
<button class="cancelButton btn danger">Cancel</button> \
|
||||||
|
</div> \
|
||||||
|
</div> \
|
||||||
|
</div> \
|
||||||
|
',
|
||||||
|
|
||||||
onEditClick: function(e) {
|
onEditClick: function(e) {
|
||||||
var editing = this.el.find('.data-table-cell-editor-editor');
|
var editing = this.el.find('.data-table-cell-editor-editor');
|
||||||
if (editing.length > 0) {
|
if (editing.length > 0) {
|
||||||
@@ -268,7 +281,8 @@ my.GridRow = Backbone.View.extend({
|
|||||||
$(e.target).addClass("hidden");
|
$(e.target).addClass("hidden");
|
||||||
var cell = $(e.target).siblings('.data-table-cell-value');
|
var cell = $(e.target).siblings('.data-table-cell-value');
|
||||||
cell.data("previousContents", cell.text());
|
cell.data("previousContents", cell.text());
|
||||||
util.render('cellEditor', cell, {value: cell.text()});
|
var templated = $.mustache(this.cellEditorTemplate, {value: cell.text()});
|
||||||
|
cell.html(templated);
|
||||||
},
|
},
|
||||||
|
|
||||||
onEditorOK: function(e) {
|
onEditorOK: function(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user