File: //home/arjun/projects/buyercall_new/buyercall/buyercall/assets/scripts/vendor/html_utils.js
// A collection of functions to simplify Underscore template building
var _ = require('underscore');
var utils = {
/** Builds the HTML for a series of <option> elements.
*
* vals - An array of parameters, in the format [[value, text], [value, text],.. ]
* selectedVal - The value of the <option> to be marked as selected.
*/
options: function (vals, selectedVal) {
var text = [];
vals.forEach(function (val, i) {
text.push('<option value="', _.escape(val[0]), '"',
((val[0] == selectedVal) ? " selected" : ""), '>',
_.escape(val[1]), '</option>');
});
return text.join('');
}
};
module.exports = utils;