Merge "Delete default sort key if set to empty string"

This commit is contained in:
jenkins-bot 2013-06-21 20:10:12 +00:00 committed by Gerrit Code Review
commit c32378b571

View file

@ -179,18 +179,22 @@ ve.ui.MWMetaDialog.prototype.onClose = function ( action ) {
} }
if ( this.defaultSortKeyChanged ) { if ( this.defaultSortKeyChanged ) {
newDefaultSortKeyItemData = { if ( this.defaultSortInput.getValue() !== '' ) {
'type': 'mwDefaultSort', newDefaultSortKeyItemData = {
'attributes': { 'content': this.defaultSortInput.getValue() } 'type': 'mwDefaultSort',
}; 'attributes': { 'content': this.defaultSortInput.getValue() }
if ( currentDefaultSortKeyItem ) { };
newDefaultSortKeyItem = new ve.dm.MWDefaultSortMetaItem( if ( currentDefaultSortKeyItem ) {
ve.extendObject( {}, currentDefaultSortKeyItem.getElement(), newDefaultSortKeyItemData ) newDefaultSortKeyItem = new ve.dm.MWDefaultSortMetaItem(
); ve.extendObject( {}, currentDefaultSortKeyItem.getElement(), newDefaultSortKeyItemData )
currentDefaultSortKeyItem.replaceWith( newDefaultSortKeyItem ); );
} else { currentDefaultSortKeyItem.replaceWith( newDefaultSortKeyItem );
newDefaultSortKeyItem = new ve.dm.MWDefaultSortMetaItem( newDefaultSortKeyItemData ); } else {
this.metaList.insertMeta( newDefaultSortKeyItem ); newDefaultSortKeyItem = new ve.dm.MWDefaultSortMetaItem( newDefaultSortKeyItemData );
this.metaList.insertMeta( newDefaultSortKeyItem );
}
} else if ( currentDefaultSortKeyItem ) {
currentDefaultSortKeyItem.remove();
} }
} }