function HistoryWidget(div, tabHeader) { this._div = div; this._tabHeader = tabHeader; this.update(); } HistoryWidget.prototype.resize = function() { var body = this._div.find(".history-panel-body"); var controls = this._div.find(".history-panel-controls"); var bodyPaddings = body.outerHeight(true) - body.height(); body.css("height", (this._div.height() - controls.outerHeight(true) - bodyPaddings) + "px"); }; HistoryWidget.prototype.update = function(onDone) { var self = this; Ajax.chainGetJSON( "/command/core/get-history?" + $.param({ project: theProject.id }), null, function(data) { self._data = data; self._render(); if (onDone) { onDone(); } } ); }; HistoryWidget.prototype._render = function() { var self = this; this._tabHeader.html('Undo / Redo ' + this._data.past.length + ''); this._div .empty() .unbind() .html( '
Don\'t worry about making mistakes. Every change you make will be shown here, and you can undo your changes anytime.
' + '' + '' + 'Paste the JSON code encoding the operations to perform.' + ' |
' + '' + ' |