Replace handlebars with the simpler and saner mustache library.

This commit is contained in:
Martín Ferrari 2016-11-17 01:29:58 +00:00
parent 0a6972b6a3
commit fe83ea511f
5 changed files with 14 additions and 2022 deletions

9
NOTICE
View file

@ -39,9 +39,12 @@ https://github.com/shutterstock/rickshaw
Copyright 2011-2014 by Shutterstock Images, LLC
See https://github.com/shutterstock/rickshaw/blob/master/LICENSE for license details
handlebars.js
Copyright 2011 by Yehuda Katz
See web/static/vendor/js/handlebars.js for license details
mustache.js
https://github.com/janl/mustache.js
Copyright 2009 Chris Wanstrath (Ruby)
Copyright 2010-2014 Jan Lehnardt (JavaScript)
Copyright 2010-2015 The mustache.js community
Licensed under the MIT License
jQuery
https://jquery.org

View file

@ -3,8 +3,6 @@ var graphTemplate;
var SECOND = 1000;
Handlebars.registerHelper('pathPrefix', function() { return PATH_PREFIX; });
Prometheus.Graph = function(element, options, handleChange, handleRemove) {
this.el = element;
this.graphHTML = null;
@ -48,7 +46,9 @@ Prometheus.Graph.prototype.initialize = function() {
// Draw graph controls and container from Handlebars template.
self.graphHTML = $(graphTemplate(self.options));
var options = {'pathPrefix': PATH_PREFIX};
jQuery.extend(options, self.options);
self.graphHTML = $(Mustache.render(graphTemplate, options));
self.el.append(self.graphHTML);
// Get references to all the interesting elements in the graph container and
@ -822,7 +822,9 @@ function init() {
$.ajax({
url: PATH_PREFIX + "/static/js/graph_template.handlebar",
success: function(data) {
graphTemplate = Handlebars.compile(data);
graphTemplate = data;
Mustache.parse(data);
if (isDeprecatedGraphURL()) {
redirectToMigratedURL();
} else {

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -12,7 +12,7 @@
<script src="{{ pathPrefix }}/static/vendor/bootstrap3-typeahead/bootstrap3-typeahead.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/fuzzy.js"></script>
<script src="{{ pathPrefix }}/static/vendor/js/handlebars.js"></script>
<script src="{{ pathPrefix }}/static/vendor/mustache/mustache.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.selection.js"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.hotkeys.js"></script>