[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceCategoryManager[master]: BlueSpiceCategoryManager: codestyling, leaf items
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358090 ) Change subject: BlueSpiceCategoryManager: codestyling, leaf items .. BlueSpiceCategoryManager: codestyling, leaf items Items without child nodes are now be able to get categories dropped in. Codestyling needs merge to master Removed unused code Change-Id: I19a24db4712c1f406ee11be8260665ed080e7160 (cherry picked from commit 7a6dd1d652c4c2b1d8f8944ff38f4357a270c0c7) --- M resources/BS.BlueSpiceCategoryManager/Model.js M resources/BS.BlueSpiceCategoryManager/TreePanel.js 2 files changed, 40 insertions(+), 42 deletions(-) Approvals: Mglaser: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/BS.BlueSpiceCategoryManager/Model.js b/resources/BS.BlueSpiceCategoryManager/Model.js index bd22d05..0c3ed38 100644 --- a/resources/BS.BlueSpiceCategoryManager/Model.js +++ b/resources/BS.BlueSpiceCategoryManager/Model.js @@ -3,13 +3,22 @@ fields: [ { name: 'text', type: 'string' }, { - name: 'leaf', type: 'boolean', convert: function() { + name: 'leaf', type: 'boolean', convert: function ( value, record ) { return false; } }, { - name: 'href', type: 'string', convert: function( value, record ) { - var catTitle = mw.Title.makeTitle( bs.ns.NS_CATEGORY, record.get( 'text') ); + name: 'loaded', type: 'boolean', convert: function ( value, record ) { + if( !record.data.root ) { + return record.raw.leaf; + } + + return value; + } + }, + { + name: 'href', type: 'string', convert: function ( value, record ) { + var catTitle = mw.Title.makeTitle( bs.ns.NS_CATEGORY, record.get( 'text' ) ); return catTitle.getUrl(); } }, diff --git a/resources/BS.BlueSpiceCategoryManager/TreePanel.js b/resources/BS.BlueSpiceCategoryManager/TreePanel.js index 0553925..73e10ef 100644 --- a/resources/BS.BlueSpiceCategoryManager/TreePanel.js +++ b/resources/BS.BlueSpiceCategoryManager/TreePanel.js @@ -3,15 +3,17 @@ requires: [ 'BS.action.APIAddCategories', 'BS.action.APIRemoveCategories', + 'BS.action.APIDeletePage', 'BS.BlueSpiceCategoryManager.Model', - 'BS.dialog.BatchActions' + 'BS.dialog.BatchActions', + 'Ext.data.TreeStore' ], originalParent: undefined, afterInitComponent: function () { - this.store = Ext.create( 'Ext.data.TreeStore', { + this.store = new Ext.data.TreeStore({ proxy: { type: 'ajax', - url: mw.util.wikiScript('api'), + url: mw.util.wikiScript( 'api' ), reader: { type: 'json', root: 'results', @@ -30,7 +32,7 @@ model: 'BS.BlueSpiceCategoryManager.Model' }); - this.treePanel = new Ext.tree.Panel( { + this.treePanel = new Ext.tree.Panel({ useArrows: true, height: 500, rootVisible: false, @@ -40,7 +42,11 @@ plugins: { ptype: 'treeviewdragdrop', dragText: mw.message( 'bs-categorymanager-draganddrop-text' ).plain(), - enableDrop: true + enableDrop: true, + appendOnly: false, + sortOnDrop: true, + expandDelay: 250, + allowParentInserts: true } } } ); @@ -110,7 +116,7 @@ addCategories: function( page, categories ) { this.treePanel.setLoading( true ); - return Ext.create('BS.action.APIAddCategories', { + return new BS.action.APIAddCategories({ pageTitle: page, categories: categories }).execute(); @@ -118,7 +124,7 @@ removeCategories: function( page, categories ) { this.treePanel.setLoading( true ); - return
[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceCategoryManager[master]: BlueSpiceCategoryManager: codestyling, leaf items
Mglaser has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358090 ) Change subject: BlueSpiceCategoryManager: codestyling, leaf items .. BlueSpiceCategoryManager: codestyling, leaf items Items without child nodes are now be able to get categories dropped in. Codestyling needs merge to master Removed unused code Change-Id: I19a24db4712c1f406ee11be8260665ed080e7160 (cherry picked from commit 7a6dd1d652c4c2b1d8f8944ff38f4357a270c0c7) --- M resources/BS.BlueSpiceCategoryManager/Model.js M resources/BS.BlueSpiceCategoryManager/TreePanel.js 2 files changed, 40 insertions(+), 42 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceCategoryManager refs/changes/90/358090/1 diff --git a/resources/BS.BlueSpiceCategoryManager/Model.js b/resources/BS.BlueSpiceCategoryManager/Model.js index bd22d05..0c3ed38 100644 --- a/resources/BS.BlueSpiceCategoryManager/Model.js +++ b/resources/BS.BlueSpiceCategoryManager/Model.js @@ -3,13 +3,22 @@ fields: [ { name: 'text', type: 'string' }, { - name: 'leaf', type: 'boolean', convert: function() { + name: 'leaf', type: 'boolean', convert: function ( value, record ) { return false; } }, { - name: 'href', type: 'string', convert: function( value, record ) { - var catTitle = mw.Title.makeTitle( bs.ns.NS_CATEGORY, record.get( 'text') ); + name: 'loaded', type: 'boolean', convert: function ( value, record ) { + if( !record.data.root ) { + return record.raw.leaf; + } + + return value; + } + }, + { + name: 'href', type: 'string', convert: function ( value, record ) { + var catTitle = mw.Title.makeTitle( bs.ns.NS_CATEGORY, record.get( 'text' ) ); return catTitle.getUrl(); } }, diff --git a/resources/BS.BlueSpiceCategoryManager/TreePanel.js b/resources/BS.BlueSpiceCategoryManager/TreePanel.js index 0553925..73e10ef 100644 --- a/resources/BS.BlueSpiceCategoryManager/TreePanel.js +++ b/resources/BS.BlueSpiceCategoryManager/TreePanel.js @@ -3,15 +3,17 @@ requires: [ 'BS.action.APIAddCategories', 'BS.action.APIRemoveCategories', + 'BS.action.APIDeletePage', 'BS.BlueSpiceCategoryManager.Model', - 'BS.dialog.BatchActions' + 'BS.dialog.BatchActions', + 'Ext.data.TreeStore' ], originalParent: undefined, afterInitComponent: function () { - this.store = Ext.create( 'Ext.data.TreeStore', { + this.store = new Ext.data.TreeStore({ proxy: { type: 'ajax', - url: mw.util.wikiScript('api'), + url: mw.util.wikiScript( 'api' ), reader: { type: 'json', root: 'results', @@ -30,7 +32,7 @@ model: 'BS.BlueSpiceCategoryManager.Model' }); - this.treePanel = new Ext.tree.Panel( { + this.treePanel = new Ext.tree.Panel({ useArrows: true, height: 500, rootVisible: false, @@ -40,7 +42,11 @@ plugins: { ptype: 'treeviewdragdrop', dragText: mw.message( 'bs-categorymanager-draganddrop-text' ).plain(), - enableDrop: true + enableDrop: true, + appendOnly: false, + sortOnDrop: true, + expandDelay: 250, + allowParentInserts: true } } } ); @@ -110,7 +116,7 @@ addCategories: function( page, categories ) { this.treePanel.setLoading( true ); - return Ext.create('BS.action.APIAddCategories', { + return new BS.action.APIAddCategories({ pageTitle: page, categories: categories }).execute(); @@ -118,7 +124,7 @@ removeCategories: function( page, categories ) { this.treePanel.setLoading( true