Fix selected state for tools on load

This commit is contained in:
Vince 2013-06-13 13:57:52 +02:00
parent b89409f82e
commit f08f58328e

View File

@ -69,11 +69,15 @@
* @private * @private
*/ */
ns.ToolController.prototype.createToolMarkup_ = function() { ns.ToolController.prototype.createToolMarkup_ = function() {
var currentTool, toolMarkup = ''; var currentTool, toolMarkup = '', extraClass;
// TODO(vincz): Tools rendering order is not enforced by the data stucture (this.toolInstances), fix that. // TODO(vincz): Tools rendering order is not enforced by the data stucture (this.toolInstances), fix that.
for (var toolKey in this.toolInstances) { for (var toolKey in this.toolInstances) {
currentTool = this.toolInstances[toolKey]; currentTool = this.toolInstances[toolKey];
toolMarkup += '<li rel="tooltip" data-placement="bottom" class="tool-icon ' + currentTool.toolId + '" data-tool-id="' + currentTool.toolId + extraClass = currentTool.toolId;
if (this.currentSelectedTool == currentTool) {
extraClass = extraClass + " selected";
}
toolMarkup += '<li rel="tooltip" data-placement="right" class="tool-icon ' + extraClass + '" data-tool-id="' + currentTool.toolId +
'" title="' + currentTool.helpText + '"></li>'; '" title="' + currentTool.helpText + '"></li>';
} }
$('#tools-container').html(toolMarkup); $('#tools-container').html(toolMarkup);