summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/UploadWizard/resources/uw.DetailsWidget.js
blob: cf1f4ac9577cc84b04e2121d56cf9349b9905beb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
( function ( mw, uw, $, OO ) {

	/**
	 * A single logical field in UploadWizard's "Details" step form.
	 *
	 * This can be composed of multiple smaller widgets, but represents a single unit (e.g. a
	 * "location" field could be composed of "latitude" and "longitude" inputs).
	 *
	 * @extends OO.ui.Widget
	 * @abstract
	 */
	uw.DetailsWidget = function UWDetailsWidget() {
		uw.DetailsWidget.parent.call( this );
	};
	OO.inheritClass( uw.DetailsWidget, OO.ui.Widget );

	/**
	 * A 'change' event is emitted when the state of this widget (and the serialized value) changes.
	 *
	 * @event change
	 */

	/**
	 * @inheritdoc OO.ui.mixin.PendingElement#pushPending
	 */
	uw.DetailsWidget.prototype.pushPending = function () {
		// Do nothing by default
	};

	/**
	 * @inheritdoc OO.ui.mixin.PendingElement#popPending
	 */
	uw.DetailsWidget.prototype.popPending = function () {
		// Do nothing by default
	};

	/**
	 * Get the list of errors about the current state of the widget.
	 *
	 * @return {jQuery.Promise} Promise resolved with an array of mw.Message objects
	 *   representing errors. (Checking for errors might require API queries, etc.)
	 */
	uw.DetailsWidget.prototype.getErrors = function () {
		return $.Deferred().resolve( [] ).promise();
	};

	/**
	 * Get the list of warnings about the current state of the widget.
	 *
	 * @return {jQuery.Promise} Promise resolved with an array of mw.Message objects
	 *   representing warnings. (Checking for warnings might require API queries, etc.)
	 */
	uw.DetailsWidget.prototype.getWarnings = function () {
		return $.Deferred().resolve( [] ).promise();
	};

	/**
	 * Get a wikitext snippet generated from current state of the widget.
	 *
	 * @method
	 * @return {string} Wikitext
	 */
	uw.DetailsWidget.prototype.getWikiText = null;

	/**
	 * Get a machine-readable representation of the current state of the widget. It can be passed to
	 * #setSerialized to restore this state (or to set it for another instance of the same class).
	 *
	 * @method
	 * @return {Object}
	 */
	uw.DetailsWidget.prototype.getSerialized = null;

	/**
	 * Set the state of this widget from machine-readable representation, as returned by
	 * #getSerialized.
	 *
	 * @method
	 * @param {Object} serialized
	 */
	uw.DetailsWidget.prototype.setSerialized = null;

}( mediaWiki, mediaWiki.uploadWizard, jQuery, OO ) );