jenkins-bot has submitted this change and it was merged. Change subject: demo: Add 'layout' variable to the consoles ......................................................................
demo: Add 'layout' variable to the consoles I needed a way to exercise ActionFieldLayout. Change-Id: I991f6f78fae936fe277b685ee0b2c0e29effdc1f --- M demos/demo.js M demos/pages/widgets.js 2 files changed, 11 insertions(+), 10 deletions(-) Approvals: Trevor Parscal: Looks good to me, approved jenkins-bot: Verified diff --git a/demos/demo.js b/demos/demo.js index e910472..9e67c99 100644 --- a/demos/demo.js +++ b/demos/demo.js @@ -394,12 +394,12 @@ /** * Build a console for interacting with an element. * - * @param {OO.ui.Element} item - * @param {string} key Variable name for item - * @param {string} [item.label=""] + * @param {OO.ui.Layout} item + * @param {string} layout Variable name for layout + * @param {string} widget Variable name for layout's field widget * @return {jQuery} Console interface element */ -OO.ui.Demo.prototype.buildConsole = function ( item, key ) { +OO.ui.Demo.prototype.buildConsole = function ( item, layout, widget ) { var $toggle, $log, $label, $input, $submit, $console, $form, console = window.console; @@ -410,8 +410,8 @@ str = 'return ' + str; } try { - func = new Function( key, 'item', str ); - ret = { value: func( item, item ) }; + func = new Function( layout, widget, 'item', str ); + ret = { value: func( item, item.fieldWidget, item.fieldWidget ) }; } catch ( error ) { ret = { value: undefined, @@ -471,8 +471,9 @@ if ( $input.is( ':visible' ) ) { $input[ 0 ].focus(); if ( console && console.log ) { - window[ key ] = item; - console.log( '[demo]', 'Global ' + key + ' has been set' ); + window[ layout ] = item; + window[ widget ] = item.fieldWidget; + console.log( '[demo]', 'Globals ' + layout + ', ' + widget + ' have been set' ); console.log( '[demo]', item ); } } @@ -486,7 +487,7 @@ $input = $( '<input>' ) .addClass( 'oo-ui-demo-console-input' ) - .prop( 'placeholder', '... (predefined: ' + key + ')' ); + .prop( 'placeholder', '... (predefined: ' + layout + ', ' + widget + ')' ); $submit = $( '<div>' ) .addClass( 'oo-ui-demo-console-submit' ) diff --git a/demos/pages/widgets.js b/demos/pages/widgets.js index a272dd0..9f18652 100644 --- a/demos/pages/widgets.js +++ b/demos/pages/widgets.js @@ -1429,7 +1429,7 @@ $.each( fieldsets, function ( i, fieldsetLayout ) { $.each( fieldsetLayout.getItems(), function ( j, fieldLayout ) { fieldLayout.$element.append( - demo.buildConsole( fieldLayout.fieldWidget, 'widget' ) + demo.buildConsole( fieldLayout, 'layout', 'widget' ) ); } ); } ); -- To view, visit https://gerrit.wikimedia.org/r/215737 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I991f6f78fae936fe277b685ee0b2c0e29effdc1f Gerrit-PatchSet: 2 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Bartosz DziewoĆski <matma....@gmail.com> Gerrit-Reviewer: Trevor Parscal <tpars...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits