jenkins-bot has submitted this change and it was merged. Change subject: Register parser and formatter for MonolingualText ......................................................................
Register parser and formatter for MonolingualText Change-Id: I7198542ec5a04237f0f1d347c559a6a2f9a29bc4 --- M lib/resources/formatters/wikibase.formatters.js A lib/resources/parsers/MonolingualTextParser.js M lib/resources/parsers/resources.php M lib/resources/parsers/wikibase.parsers.js 4 files changed, 46 insertions(+), 0 deletions(-) Approvals: Hoo man: Looks good to me, approved WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/lib/resources/formatters/wikibase.formatters.js b/lib/resources/formatters/wikibase.formatters.js index 1b2e3df..0fe8819 100644 --- a/lib/resources/formatters/wikibase.formatters.js +++ b/lib/resources/formatters/wikibase.formatters.js @@ -50,6 +50,14 @@ ); } + var monolingualTextType = dataTypeStore.getDataType( 'monolingualtext' ); + if( monolingualTextType ) { + formatterStore.registerDataTypeFormatter( + wb.formatters.ApiBasedValueFormatter, + monolingualTextType.getId() + ); + } + return formatterStore; }( wikibase, valueFormatters, dataValues, wikibase.dataTypes ) ); diff --git a/lib/resources/parsers/MonolingualTextParser.js b/lib/resources/parsers/MonolingualTextParser.js new file mode 100644 index 0000000..6f72363 --- /dev/null +++ b/lib/resources/parsers/MonolingualTextParser.js @@ -0,0 +1,22 @@ +/** + * @licence GNU GPL v2+ + */ +( function( wb, util ) { + 'use strict'; + + var PARENT = wb.parsers.ApiBasedValueParser; + + /** + * Constructor for monolingualtext parsers. + * @constructor + * @extends wikibase.parsers.ApiBasedValueParser + * @since 0.5 + */ + wb.MonolingualTextParser = util.inherit( PARENT, { + /** + * @see wikibase.parsers.ApiBasedValueParser.API_VALUE_PARSER_ID + */ + API_VALUE_PARSER_ID: 'monolingualtext' + } ); + +}( wikibase, util ) ); diff --git a/lib/resources/parsers/resources.php b/lib/resources/parsers/resources.php index f7fc98f..0081671 100644 --- a/lib/resources/parsers/resources.php +++ b/lib/resources/parsers/resources.php @@ -80,6 +80,16 @@ ), ), + 'wikibase.MonolingualTextParser' => $moduleTemplate + array( + 'scripts' => array( + 'MonolingualTextParser.js', + ), + 'dependencies' => array( + 'util.inherit', + 'wikibase.ApiBasedValueParser', + ), + ), + 'wikibase.parsers' => $moduleTemplate + array( 'scripts' => array( 'wikibase.parsers.js', @@ -93,6 +103,7 @@ 'wikibase.GlobeCoordinateParser', 'wikibase.QuantityParser', 'wikibase.TimeParser', + 'wikibase.MonolingualTextParser', ), ), diff --git a/lib/resources/parsers/wikibase.parsers.js b/lib/resources/parsers/wikibase.parsers.js index f7e177b..8204ea0 100644 --- a/lib/resources/parsers/wikibase.parsers.js +++ b/lib/resources/parsers/wikibase.parsers.js @@ -34,6 +34,11 @@ dv.TimeValue.TYPE ); + parserStore.registerDataValueParser( + wb.MonolingualTextParser, + dv.MonolingualTextValue.TYPE + ); + return parserStore; }( wikibase, valueParsers, dataValues ) ); -- To view, visit https://gerrit.wikimedia.org/r/137286 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7198542ec5a04237f0f1d347c559a6a2f9a29bc4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Adrian Lang <adrian.l...@wikimedia.de> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: WikidataJenkins <wikidata-servi...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits