[FIX] Web: view_list.js: _.template()

The signature and behavior of function template() of underscore.js has
been changed from rev. 1.7.0. It doesn't accept an initial data object
anymore, and always returns a function.

This commits adapts our calls to _.template(). This fixes display bugs in
list views (e.g. the progressbar which was not displayed).
This commit is contained in:
Aaron Bohy
2015-03-12 11:16:06 +01:00
parent 438c33ed5f
commit a1d319a8fb
+3 -3
View File
@@ -2327,7 +2327,7 @@ instance.web.list.Binary = instance.web.list.Column.extend({
text = _.str.sprintf(_t("Download \"%s\""), instance.web.format_value(
row_data[this.filename].value, {type: 'char'}));
}
return _.template('<a href="<%-href%>"><%-text%></a> (<%-size%>)', {
return _.template('<a href="<%-href%>"><%-text%></a> (<%-size%>)')({
text: text,
href: download_url,
size: instance.web.binary_to_binsize(value),
@@ -2356,7 +2356,7 @@ instance.web.list.ProgressBar = instance.web.list.Column.extend({
*/
_format: function (row_data, options) {
return _.template(
'<progress value="<%-value%>" max="100"><%-value%>%</progress>', {
'<progress value="<%-value%>" max="100"><%-value%>%</progress>')({
value: _.str.sprintf("%.0f", row_data[this.id].value || 0)
});
}
@@ -2427,7 +2427,7 @@ instance.web.list.Url = instance.web.list.Column.extend({
var value = row_data[this.id].value;
if (value) {
return _.template("<a href='<%-href%>' target='_blank'><%-text%></a>", {
return _.template("<a href='<%-href%>' target='_blank'><%-text%></a>")({
href: value.trim().replace(this.PROTOCOL_REGEX, '//'),
text: value
});