2013-01-01 18:00:02 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/widgets/error.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: widget
|
|
|
|
|
|
|
|
The error widget displays an error message.
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var ErrorWidget = function(renderer,errorMessage) {
|
|
|
|
// Save state
|
|
|
|
this.renderer = renderer;
|
|
|
|
this.errorMessage = errorMessage;
|
|
|
|
// Generate child nodes
|
2013-01-03 16:27:55 +00:00
|
|
|
this.generate();
|
2013-01-01 18:00:02 +00:00
|
|
|
};
|
|
|
|
|
2013-01-03 16:27:55 +00:00
|
|
|
ErrorWidget.prototype.generate = function() {
|
|
|
|
// Set the element details
|
|
|
|
this.tag = "span";
|
|
|
|
this.attributes = {
|
|
|
|
"class": "tw-error-widget"
|
|
|
|
};
|
|
|
|
this.children = this.renderer.renderTree.createRenderers(this.renderer.renderContext,[{
|
2013-01-01 18:00:02 +00:00
|
|
|
type: "text",
|
|
|
|
text: this.errorMessage
|
2013-01-03 16:27:55 +00:00
|
|
|
}]);
|
2013-01-01 18:00:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.error = ErrorWidget;
|
|
|
|
|
|
|
|
})();
|