diff options
Diffstat (limited to 'vendor/oojs/oojs-ui/demos/pages/toolbars.js')
-rw-r--r-- | vendor/oojs/oojs-ui/demos/pages/toolbars.js | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/vendor/oojs/oojs-ui/demos/pages/toolbars.js b/vendor/oojs/oojs-ui/demos/pages/toolbars.js index 550d8128..b729e364 100644 --- a/vendor/oojs/oojs-ui/demos/pages/toolbars.js +++ b/vendor/oojs/oojs-ui/demos/pages/toolbars.js @@ -1,5 +1,6 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { - var i, toolGroups, saveButton, actionButton, actionButtonDisabled, PopupTool, ToolGroupTool, + var i, toolGroups, saveButton, deleteButton, actionButton, actionButtonDisabled, PopupTool, ToolGroupTool, + setDisabled = function () { this.setDisabled( true ); }, $demo = demo.$element, $containers = $(), toolFactories = [], @@ -26,7 +27,7 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { function createTool( toolbar, group, name, icon, title, init, onSelect, displayBothIconAndLabel ) { var Tool = function () { - Tool.super.apply( this, arguments ); + Tool.parent.apply( this, arguments ); this.toggled = false; if ( init ) { init.call( this ); @@ -64,7 +65,7 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { function createDisabledToolGroup( parent, name ) { var DisabledToolGroup = function () { - DisabledToolGroup.super.apply( this, arguments ); + DisabledToolGroup.parent.apply( this, arguments ); this.setDisabled( true ); }; @@ -210,6 +211,10 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { include: [ { group: 'cite' } ] }, { + type: 'bar', + include: [ { group: 'citeDisabled' } ] + }, + { type: 'list', indicator: 'down', label: 'Insert', @@ -218,13 +223,14 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { ] ); saveButton = new OO.ui.ButtonWidget( { label: 'Save', flags: [ 'progressive', 'primary' ] } ); + deleteButton = new OO.ui.ButtonWidget( { label: 'Delete', flags: [ 'destructive' ] } ); actionButton = new OO.ui.ButtonWidget( { label: 'Action' } ); actionButtonDisabled = new OO.ui.ButtonWidget( { label: 'Disabled', disabled: true } ); toolbars[ 1 ].$actions .append( actionButton.$element, actionButtonDisabled.$element ); toolbars[ 3 ].$actions - .append( toolbars[ 2 ].$element, saveButton.$element ); + .append( toolbars[ 2 ].$element, deleteButton.$element, saveButton.$element ); for ( i = 0; i < toolbars.length; i++ ) { toolbars[ i ].emit( 'updateState' ); @@ -233,7 +239,7 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { toolGroups = { barTools: [ [ 'barTool', 'picture', 'Basic tool in bar' ], - [ 'disabledBarTool', 'picture', 'Basic tool in bar disabled', function () { this.setDisabled( true ); } ] + [ 'disabledBarTool', 'picture', 'Basic tool in bar disabled', setDisabled ] ], disabledBarTools: [ @@ -243,7 +249,7 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { listTools: [ [ 'listTool', 'picture', 'First basic tool in list' ], [ 'listTool1', 'picture', 'Basic tool in list' ], - [ 'listTool3', 'picture', 'Basic disabled tool in list', function () { this.setDisabled( true ); } ], + [ 'listTool3', 'picture', 'Basic disabled tool in list', setDisabled ], [ 'listTool6', 'picture', 'A final tool' ] ], @@ -262,12 +268,12 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { ], autoDisableListTools: [ - [ 'autoDisableListTool', 'picture', 'Click to disable this tool', null, function () { this.setDisabled( true ); } ] + [ 'autoDisableListTool', 'picture', 'Click to disable this tool', null, setDisabled ] ], menuTools: [ [ 'menuTool', 'picture', 'Basic tool' ], - [ 'disabledMenuTool', 'picture', 'Basic tool disabled', function () { this.setDisabled( true ); } ] + [ 'disabledMenuTool', 'picture', 'Basic tool disabled', setDisabled ] ], disabledMenuTools: [ @@ -290,6 +296,10 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { cite: [ [ 'citeTool', 'citeArticle', 'Cite', null, null, true ] + ], + + citeDisabled: [ + [ 'citeToolDisabled', 'citeArticle', 'Cite', setDisabled, null, true ] ] }; @@ -306,6 +316,7 @@ OO.ui.Demo.static.pages.toolbars = function ( demo ) { createToolGroup( 3, 'history' ); createToolGroup( 3, 'link' ); createToolGroup( 3, 'cite' ); + createToolGroup( 3, 'citeDisabled' ); createToolGroup( 3, 'menuTools' ); createToolGroup( 3, 'listTools' ); createToolGroup( 3, 'moreListTools' ); |