[#79,refactor][s]: switch from (old) jquery.mustache to latest mustache.js - fixes #79.
* This mustache has support for nested values e.g. {{sub.x.y}}
* Specifically mustache.js as of Fri Feb 24 09:58:31 2012 +0100 2f135e2e15dcc3c61385212261faaf00597bae10
This commit is contained in:
@@ -120,7 +120,7 @@ my.Graph = Backbone.View.extend({
|
||||
render: function() {
|
||||
var self = this;
|
||||
var tmplData = this.model.toTemplateJSON();
|
||||
var htmls = $.mustache(this.template, tmplData);
|
||||
var htmls = Mustache.render(this.template, tmplData);
|
||||
$(this.el).html(htmls);
|
||||
this.$graph = this.el.find('.panel.graph');
|
||||
|
||||
@@ -375,7 +375,7 @@ my.Graph = Backbone.View.extend({
|
||||
seriesName: String.fromCharCode(idx + 64 + 1),
|
||||
}, this.model.toTemplateJSON());
|
||||
|
||||
var htmls = $.mustache(this.templateSeriesEditor, data);
|
||||
var htmls = Mustache.render(this.templateSeriesEditor, data);
|
||||
this.el.find('.editor-series-group').append(htmls);
|
||||
return this;
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@ my.Grid = Backbone.View.extend({
|
||||
{{#columns}} \
|
||||
<li><a data-action="showColumn" data-column="{{.}}" href="JavaScript:void(0);">Show column: {{.}}</a></li> \
|
||||
{{/columns}}';
|
||||
var tmp = $.mustache(tmpl, {'columns': this.state.get('hiddenFields')});
|
||||
var tmp = Mustache.render(tmpl, {'columns': this.state.get('hiddenFields')});
|
||||
this.el.find('.root-header-menu .dropdown-menu').html(tmp);
|
||||
},
|
||||
|
||||
@@ -211,7 +211,7 @@ my.Grid = Backbone.View.extend({
|
||||
field.set({width: width});
|
||||
}
|
||||
});
|
||||
var htmls = $.mustache(this.template, this.toTemplateJSON());
|
||||
var htmls = Mustache.render(this.template, this.toTemplateJSON());
|
||||
this.el.html(htmls);
|
||||
this.model.currentDocuments.forEach(function(doc) {
|
||||
var tr = $('<tr />');
|
||||
@@ -308,7 +308,7 @@ my.GridRow = Backbone.View.extend({
|
||||
|
||||
render: function() {
|
||||
this.el.attr('data-id', this.model.id);
|
||||
var html = $.mustache(this.template, this.toTemplateJSON());
|
||||
var html = Mustache.render(this.template, this.toTemplateJSON());
|
||||
$(this.el).html(html);
|
||||
return this;
|
||||
},
|
||||
@@ -336,7 +336,7 @@ my.GridRow = Backbone.View.extend({
|
||||
$(e.target).addClass("hidden");
|
||||
var cell = $(e.target).siblings('.data-table-cell-value');
|
||||
cell.data("previousContents", cell.text());
|
||||
var templated = $.mustache(this.cellEditorTemplate, {value: cell.text()});
|
||||
var templated = Mustache.render(this.cellEditorTemplate, {value: cell.text()});
|
||||
cell.html(templated);
|
||||
},
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ my.Map = Backbone.View.extend({
|
||||
|
||||
var self = this;
|
||||
|
||||
htmls = $.mustache(this.template, this.model.toTemplateJSON());
|
||||
htmls = Mustache.render(this.template, this.model.toTemplateJSON());
|
||||
|
||||
$(this.el).html(htmls);
|
||||
this.$map = this.el.find('.panel.map');
|
||||
|
||||
@@ -47,7 +47,7 @@ my.Timeline = Backbone.View.extend({
|
||||
|
||||
render: function() {
|
||||
var tmplData = {};
|
||||
var htmls = $.mustache(this.template, tmplData);
|
||||
var htmls = Mustache.render(this.template, tmplData);
|
||||
this.el.html(htmls);
|
||||
},
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ my.ColumnTransform = Backbone.View.extend({
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var htmls = $.mustache(this.template,
|
||||
var htmls = Mustache.render(this.template,
|
||||
{name: this.state.currentColumn}
|
||||
);
|
||||
this.el.html(htmls);
|
||||
@@ -163,7 +163,7 @@ my.ColumnTransform = Backbone.View.extend({
|
||||
});
|
||||
var previewData = costco.previewTransform(docs, editFunc, self.state.currentColumn);
|
||||
var $el = self.el.find('.expression-preview-container');
|
||||
var templated = $.mustache(self.editPreviewTemplate, {rows: previewData.slice(0,4)});
|
||||
var templated = Mustache.render(self.editPreviewTemplate, {rows: previewData.slice(0,4)});
|
||||
$el.html(templated);
|
||||
} else {
|
||||
errors.text(editFunc.errorMessage);
|
||||
|
||||
10
src/view.js
10
src/view.js
@@ -286,7 +286,7 @@ my.DataExplorer = Backbone.View.extend({
|
||||
render: function() {
|
||||
var tmplData = this.model.toTemplateJSON();
|
||||
tmplData.views = this.pageViews;
|
||||
var template = $.mustache(this.template, tmplData);
|
||||
var template = Mustache.render(this.template, tmplData);
|
||||
$(this.el).html(template);
|
||||
var $dataViewContainer = this.el.find('.data-view-container');
|
||||
_.each(this.pageViews, function(view, pageName) {
|
||||
@@ -431,7 +431,7 @@ my.DataExplorer = Backbone.View.extend({
|
||||
{{message}} \
|
||||
</div>';
|
||||
}
|
||||
var _templated = $($.mustache(_template, tmplData));
|
||||
var _templated = $(Mustache.render(_template, tmplData));
|
||||
_templated = $(_templated).appendTo($('.recline-data-explorer .alert-messages'));
|
||||
if (!flash.persist) {
|
||||
setTimeout(function() {
|
||||
@@ -516,7 +516,7 @@ my.QueryEditor = Backbone.View.extend({
|
||||
render: function() {
|
||||
var tmplData = this.model.toJSON();
|
||||
tmplData.to = this.model.get('from') + this.model.get('size');
|
||||
var templated = $.mustache(this.template, tmplData);
|
||||
var templated = Mustache.render(this.template, tmplData);
|
||||
this.el.html(templated);
|
||||
}
|
||||
});
|
||||
@@ -584,7 +584,7 @@ my.FilterEditor = Backbone.View.extend({
|
||||
value: filter.term[fieldId]
|
||||
};
|
||||
});
|
||||
var out = $.mustache(this.template, tmplData);
|
||||
var out = Mustache.render(this.template, tmplData);
|
||||
this.el.html(out);
|
||||
// are there actually any facets to show?
|
||||
if (this.model.get('filters').length > 0) {
|
||||
@@ -669,7 +669,7 @@ my.FacetViewer = Backbone.View.extend({
|
||||
}
|
||||
return facet;
|
||||
});
|
||||
var templated = $.mustache(this.template, tmplData);
|
||||
var templated = Mustache.render(this.template, tmplData);
|
||||
this.el.html(templated);
|
||||
// are there actually any facets to show?
|
||||
if (this.model.facets.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user