mediawiki-extensions-Visual.../modules/ve-mw/ui/widgets/ve.ui.MWParameterCheckboxInputWidget.js
Alex Monk 978224f2ec Use widgets for wiki-page-name, wiki-user-name, wiki-template-name, boolean, URL and line template fields
* Use TitleInputWidget for wiki-page-name and wiki-template-name parameters
* Use UserInputWidget for wiki-user-name parameters
* Use a custom hacky CheckboxInputWidget child class for boolean parameters
* Borrow some ve.ui.MWExternalLinkAnnotationWidget.prototype.createInputWidget code for url parameters
* Use a TextInputWidget with multiline disabled for line parameters

Not dealt with in this commit, so fallback to existing behaviour:
* string
* number
* unknown
* content
* unbalanced-wikitext
* date
* wiki-file-name

Bug: T55613
Bug: T124734
Bug: T124736
Change-Id: If04944d64303d959e8dd605e75a175895932b788
Depends-On: I87699a93ca1b34c6d248456fcc060f584623d158
Depends-On: I5e97604f0fc24176d5e89899bf0505dc442a1a7e
2016-04-06 22:07:19 +01:00

40 lines
928 B
JavaScript

/*!
* VisualEditor UserInterface MWParameterCheckboxInputWidget class.
*
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Creates an ve.ui.MWParameterCheckboxInputWidget object.
*
* @class
* @extends OO.ui.CheckboxInputWidget
*
* @constructor
*/
ve.ui.MWParameterCheckboxInputWidget = function VeUiMWParameterCheckboxInputWidget() {
// Parent constructor
ve.ui.MWParameterCheckboxInputWidget.parent.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWParameterCheckboxInputWidget, OO.ui.CheckboxInputWidget );
/* Methods */
/**
* @inheritdoc
*/
ve.ui.MWParameterCheckboxInputWidget.prototype.getValue = function () {
return this.isSelected() ? '1' : '0';
};
/**
* @inheritdoc
*/
ve.ui.MWParameterCheckboxInputWidget.prototype.setValue = function ( value ) {
return this.setSelected( value === '1' );
};