From daa1f6eb1e2f3168f601b2d2549510c471a5d357 Mon Sep 17 00:00:00 2001 From: Bjornskjald Date: Wed, 31 Oct 2018 00:51:34 +0100 Subject: [PATCH] Add using the article title as the default value for sorting in categories This way users can rearrange/edit current name without exiting VE and/or copying it from somewhere else Bug: T145339 Change-Id: I80690cdf344c2ccbdd8be486642afcf841f36c10 --- modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js | 4 ++-- .../ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js b/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js index 5478171da5..8d993ffbf3 100644 --- a/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js +++ b/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js @@ -257,7 +257,7 @@ ve.ui.MWCategoriesPage.prototype.setup = function ( metaList ) { this.categoryWidget.addItems( this.getCategoryItems() ); this.defaultSortInput.setValue( - defaultSortKeyItem ? defaultSortKeyItem.getAttribute( 'content' ) : '' + defaultSortKeyItem ? defaultSortKeyItem.getAttribute( 'content' ) : this.fallbackDefaultSortKey ); this.defaultSortKeyTouched = false; @@ -290,7 +290,7 @@ ve.ui.MWCategoriesPage.prototype.teardown = function ( data ) { if ( data && data.action === 'apply' ) { // Alter the default sort key iff it's been touched & is actually different if ( this.defaultSortKeyTouched ) { - if ( newDefaultSortKey === '' ) { + if ( newDefaultSortKey === '' || newDefaultSortKey === this.fallbackDefaultSortKey ) { if ( currentDefaultSortKeyItem ) { currentDefaultSortKeyItem.remove(); } diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js index 41a01e319b..98276c79c1 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js @@ -27,6 +27,7 @@ ve.ui.MWCategoryPopupWidget = function VeUiMWCategoryPopupWidget( config ) { this.removed = false; this.$title = $( '