mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-28 01:30:00 +00:00
Merge "Simplify some overly complex comparisons with undefined"
This commit is contained in:
commit
310bf46cf9
|
@ -614,7 +614,7 @@ Model.prototype.setTemplateParamOrder = function ( orderArray ) {
|
||||||
* @fires change
|
* @fires change
|
||||||
*/
|
*/
|
||||||
Model.prototype.setTemplateFormat = function ( format ) {
|
Model.prototype.setTemplateFormat = function ( format ) {
|
||||||
format = format !== undefined ? format : null;
|
format = format || null;
|
||||||
if ( this.format !== format ) {
|
if ( this.format !== format ) {
|
||||||
this.format = format;
|
this.format = format;
|
||||||
this.emit( 'change-format', format );
|
this.emit( 'change-format', format );
|
||||||
|
|
|
@ -405,7 +405,7 @@ Dialog.prototype.onModelChangeDescription = function ( description ) {
|
||||||
*/
|
*/
|
||||||
Dialog.prototype.onModelChangeMapInfo = function ( map ) {
|
Dialog.prototype.onModelChangeMapInfo = function ( map ) {
|
||||||
var selectedItem = this.mapsGroup.findSelectedItem();
|
var selectedItem = this.mapsGroup.findSelectedItem();
|
||||||
map = map === undefined ? {} : map;
|
map = map || {};
|
||||||
this.mapsCache = OO.copy( map );
|
this.mapsCache = OO.copy( map );
|
||||||
if ( selectedItem ) {
|
if ( selectedItem ) {
|
||||||
this.templateMapsInput.setValue( this.stringifyObject( map[ selectedItem.label ] ) );
|
this.templateMapsInput.setValue( this.stringifyObject( map[ selectedItem.label ] ) );
|
||||||
|
@ -511,7 +511,7 @@ Dialog.prototype.onDescriptionInputChange = function ( value ) {
|
||||||
* @param {Object|undefined} mapsObject
|
* @param {Object|undefined} mapsObject
|
||||||
*/
|
*/
|
||||||
Dialog.prototype.populateMapsItems = function ( mapsObject ) {
|
Dialog.prototype.populateMapsItems = function ( mapsObject ) {
|
||||||
mapsObject = mapsObject === undefined ? {} : mapsObject;
|
mapsObject = mapsObject || {};
|
||||||
var mapKeysList = Object.keys( mapsObject );
|
var mapKeysList = Object.keys( mapsObject );
|
||||||
|
|
||||||
var items = mapKeysList.map( function ( mapKey ) {
|
var items = mapKeysList.map( function ( mapKey ) {
|
||||||
|
@ -535,7 +535,7 @@ Dialog.prototype.populateMapsItems = function ( mapsObject ) {
|
||||||
Dialog.prototype.onMapInfoChange = function ( value ) {
|
Dialog.prototype.onMapInfoChange = function ( value ) {
|
||||||
var selectedItem = this.mapsGroup.findSelectedItem();
|
var selectedItem = this.mapsGroup.findSelectedItem();
|
||||||
// Update map Info
|
// Update map Info
|
||||||
this.model.maps = this.model.getMapInfo() === undefined ? {} : this.model.getMapInfo();
|
this.model.maps = this.model.getMapInfo() || {};
|
||||||
if ( selectedItem ) {
|
if ( selectedItem ) {
|
||||||
if ( this.model.getMapInfo()[ selectedItem.label ] !== value ) {
|
if ( this.model.getMapInfo()[ selectedItem.label ] !== value ) {
|
||||||
// Disable Done button in case of invalid JSON
|
// Disable Done button in case of invalid JSON
|
||||||
|
|
Loading…
Reference in a new issue