Mglaser has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374317 )

Change subject: InsertMagic: Pre select quick access when not empty
......................................................................

InsertMagic: Pre select quick access when not empty

In InsertMagic, the group quick access should be selected when it
contains any items.

Patch created by pwirth, I am just the messenger.

ERM#733

Change-Id: I91be251105132b3dd4ce8211efa210d28aba53b4
---
M InsertMagic/resources/BS.InsertMagic/Window.js
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/17/374317/1

diff --git a/InsertMagic/resources/BS.InsertMagic/Window.js 
b/InsertMagic/resources/BS.InsertMagic/Window.js
index 0544785..ce7d234 100644
--- a/InsertMagic/resources/BS.InsertMagic/Window.js
+++ b/InsertMagic/resources/BS.InsertMagic/Window.js
@@ -10,6 +10,7 @@
        height: 400,
        layout: 'border',
        singleton: true,
+       preSelectedType: 'tag',
 
        afterInitComponent: function() {
                this.setTitle( mw.message('bs-insertmagic-dlg-title').plain() );
@@ -31,7 +32,7 @@
                        readonly: true,
                        allowBlank: false,
                        forceSelection: true,
-                       value:'tag', //default selection
+                       value: this.preSelectedType, //default selection
                        store: typesArray
                });
                this.cmbType.on( 'select', this.onTypeSelected, this );
@@ -161,7 +162,16 @@
 
        onStoreLoad: function( store, records, options ) {
                this.tagsStore.sort( 'name', 'ASC' );
-               this.tagsStore.filter( 'type', 'tag'); //just initial
+
+               var firstQuickAccessItemId = this.tagsStore.findExact(
+                       'type',
+                       'quickaccess'
+               );
+               if( firstQuickAccessItemId && firstQuickAccessItemId !== -1 ) {
+                       this.preSelectedType = 'quickaccess';
+                       this.cmbType.setValue( this.preSelectedType );
+               }
+               this.tagsStore.filter( 'type', this.preSelectedType ); //just 
initial
        },
 
        onTypeSelected: function( combo, record, index ){

-- 
To view, visit https://gerrit.wikimedia.org/r/374317
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91be251105132b3dd4ce8211efa210d28aba53b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser <gla...@hallowelt.biz>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to