2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00

FIX: proper logic for 'noTitle' param of the number helper

This commit is contained in:
Régis Hanol 2016-08-17 23:28:29 +02:00
parent 6d1d7b7c8f
commit dd3d8d85d3

View file

@ -20,11 +20,13 @@ registerUnbound('number', (orig, params) => {
if (params['class']) { if (params['class']) {
classNames += ' ' + params['class']; classNames += ' ' + params['class'];
} }
let result = "<span class='" + classNames + "'"; let result = "<span class='" + classNames + "'";
let addTitle = params.noTitle ? false : true;
// Round off the thousands to one decimal place // Round off the thousands to one decimal place
const n = number(orig); const n = number(orig);
if (n.toString() !== title.toString() && !params.noTitle) { if (n.toString() !== title.toString() && addTitle) {
result += " title='" + Handlebars.Utils.escapeExpression(title) + "'"; result += " title='" + Handlebars.Utils.escapeExpression(title) + "'";
} }
result += ">" + n + "</span>"; result += ">" + n + "</span>";