diff --git a/src/util.js b/src/util.js
index f390d994..c67d930c 100644
--- a/src/util.js
+++ b/src/util.js
@@ -1,38 +1,6 @@
/*jshint multistr:true */
var util = function() {
- var templates = {
- transformActions: '
',
- editPreview: ' \
- \
-
\
- \
- \
- | \
- before \
- | \
- \
- after \
- | \
-
\
- \
- \
- {{#rows}} \
- \
- | \
- {{before}} \
- | \
- \
- {{after}} \
- | \
-
\
- {{/rows}} \
- \
-
\
-
\
- '
- };
-
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
@@ -62,27 +30,7 @@ var util = function() {
$('.' + thing).show().css({top: position.top + $(elem.target).height(), left: position.left});
}
- function render( template, target, options ) {
- if ( !options ) options = {data: {}};
- if ( !options.data ) options = {data: options};
- var html = $.mustache( templates[template], options.data );
- var targetDom = null;
- if (target instanceof jQuery) {
- targetDom = target;
- } else {
- targetDom = $( "." + target + ":first" );
- }
- if( options.append ) {
- targetDom.append( html );
- } else {
- targetDom.html( html );
- }
- // TODO: remove (commented out as part of Backbon-i-fication
- // if (template in app.after) app.after[template]();
- }
-
return {
- position: position,
- render: render
+ position: position
};
}();
diff --git a/src/view-transform-dialog.js b/src/view-transform-dialog.js
index f43b5931..83ab53a8 100644
--- a/src/view-transform-dialog.js
+++ b/src/view-transform-dialog.js
@@ -121,6 +121,35 @@ my.ColumnTransform = Backbone.View.extend({
this.el.remove();
},
+ editPreviewTemplate: ' \
+ \
+
\
+ \
+ \
+ | \
+ before \
+ | \
+ \
+ after \
+ | \
+
\
+ \
+ \
+ {{#rows}} \
+ \
+ | \
+ {{before}} \
+ | \
+ \
+ {{after}} \
+ | \
+
\
+ {{/rows}} \
+ \
+
\
+
\
+ ',
+
onEditorKeydown: function(e) {
var self = this;
// if you don't setTimeout it won't grab the latest character if you call e.target.value
@@ -133,7 +162,9 @@ my.ColumnTransform = Backbone.View.extend({
return doc.toJSON();
});
var previewData = costco.previewTransform(docs, editFunc, self.state.currentColumn);
- util.render('editPreview', 'expression-preview-container', {rows: previewData});
+ var $el = self.el.find('.expression-preview-container');
+ var templated = $.mustache(self.editPreviewTemplate, {rows: previewData.slice(0,4)});
+ $el.html(templated);
} else {
errors.text(editFunc.errorMessage);
}