/** * Object to handle the creation of operation categories. * * @author n1474335 [n1474335@gmail.com] * @copyright Crown Copyright 2016 * @license Apache-2.0 * * @constructor * @param {string} name - The name of the category. * @param {boolean} selected - Whether this category is pre-selected or not. */ var HTMLCategory = function(name, selected) { this.name = name; this.selected = selected; this.op_list = []; }; /** * Adds an operation to this category. * * @param {HTMLOperation} operation - The operation to add. */ HTMLCategory.prototype.add_operation = function(operation) { this.op_list.push(operation); }; /** * Renders the category and all operations within it in HTML. * * @returns {string} */ HTMLCategory.prototype.to_html = function() { var cat_name = "cat" + this.name.replace(/[\s/-:_]/g, ""); var html = "
\ \ " + this.name + "\ \
"; return html; };