jenkins-bot has submitted this change and it was merged. Change subject: Add a link to the reference dialog in Citoid inspector ......................................................................
Add a link to the reference dialog in Citoid inspector Link triggering the general reference dialog in the citoid inspector. Depends on VE-MW change I22a64265475b Change-Id: If5ffd9c3cc022d3261e15b522dd40f5a89627a52 --- M Citoid.php M i18n/en.json M i18n/qqq.json M modules/ve.ui.CiteFromIdInspector.css M modules/ve.ui.CiteFromIdInspector.js M modules/ve.ui.CiteFromIdInspectorTool.js 6 files changed, 61 insertions(+), 5 deletions(-) Approvals: Jforrester: Looks good to me, approved jenkins-bot: Verified diff --git a/Citoid.php b/Citoid.php index 8698c15..490d632 100644 --- a/Citoid.php +++ b/Citoid.php @@ -52,6 +52,8 @@ 'citoid-citeFromIDDialog-lookup-button', 'citoid-citeFromIDDialog-search', 'citoid-citeFromIDDialog-search-label', + 'citoid-citeFromIDDialog-use-general-dialog-message', + 'citoid-citeFromIDDialog-use-general-dialog-button', 'citoid-citeFromIDDialog-search-placeholder', 'citoid-citeFromIDDialog-search-progress', 'citoid-citeFromIDDialog-title', diff --git a/i18n/en.json b/i18n/en.json index 74b3b98..8c9d128 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -11,6 +11,8 @@ "citoid-citeFromIDDialog-title": "Add a citation", "citoid-citeFromIDTool-title": "Cite", "citoid-desc": "Provides access points between the citoid service and MediaWiki", + "citoid-citeFromIDDialog-use-general-dialog-message": "Or use the $1 to fill in the details yourself.", + "citoid-citeFromIDDialog-use-general-dialog-button": "full citation dialog", "citoid-typeMap-config-error": "Mediawiki:citoid-template-type-map.json is improperly configured.", "citoid-unknown-error": "An unknown error has occured that prevented us from creating a citation. Please try again later." } diff --git a/i18n/qqq.json b/i18n/qqq.json index 224bbf1..510f12e 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -12,6 +12,8 @@ "citoid-citeFromIDDialog-search-progress": "Message for when the search is in progress", "citoid-citeFromIDDialog-title": "The title displayed on the dialog", "citoid-citeFromIDTool-title": "Label for the button to add a citation in the toolbar\n{{Identical|Cite}}", + "citoid-citeFromIDDialog-use-general-dialog-message": "Label for the user to use the full citation tool. $1 - the button to open the citation dialog.", + "citoid-citeFromIDDialog-use-general-dialog-button": "Label for the user to click to use the full citation tool.", "citoid-desc": "{{desc|name=Citoid|url=http://www.mediawiki.org/wiki/Citoid}}", "citoid-typeMap-config-error": "Error message indicating Mediawiki:citoid-template-type-map.json either doesn't exist or contains errors.", "citoid-unknown-error": "Error message indicating that the service to create citations has returned an error or is temporarily malfunctioning, asking the user to try again later." diff --git a/modules/ve.ui.CiteFromIdInspector.css b/modules/ve.ui.CiteFromIdInspector.css index 971a5c7..75542c3 100644 --- a/modules/ve.ui.CiteFromIdInspector.css +++ b/modules/ve.ui.CiteFromIdInspector.css @@ -26,3 +26,8 @@ background-size: 24px 24px; height: 2.5em; } + +.ve-ui-citeFromIdInspector-dialog-link { + display: inline-block; + margin: 0.5em 0; +} diff --git a/modules/ve.ui.CiteFromIdInspector.js b/modules/ve.ui.CiteFromIdInspector.js index 84529a9..184dc86 100644 --- a/modules/ve.ui.CiteFromIdInspector.js +++ b/modules/ve.ui.CiteFromIdInspector.js @@ -11,15 +11,17 @@ // Parent constructor ve.ui.CiteFromIdInspector.super.call( this, config ); + config = config || {}; + this.referenceModel = null; - this.transclusionModel = null; this.doneStaging = false; this.results = []; this.citeTools = []; this.templateTypeMap = null; this.lookupPromise = null; - this.$element.addClass( 've-ui-citeFromIdInspector' ); + this.$element + .addClass( 've-ui-citeFromIdInspector' ); }; /* Inheritance */ @@ -47,7 +49,7 @@ * @inheritDoc */ ve.ui.CiteFromIdInspector.prototype.initialize = function () { - var lookupActionFieldLayout, + var lookupActionFieldLayout, plainMsg, parsedMsg, lookupFieldset = new OO.ui.FieldsetLayout(), limit = ve.init.target.constructor.static.citationToolsLimit; @@ -92,6 +94,25 @@ lookupActionFieldLayout.$element ); + // Once more, with feeling: there's a bug in mw.messages that prevents us from + // using a link in the message unless we double-parse it. + // See https://phabricator.wikimedia.org/T49395#490610 + mw.messages.set( { + 'citoid-citeFromIDDialog-temporary-message': '<a href="#">' + mw.message( 'citoid-citeFromIDDialog-use-general-dialog-button' ) + '</a>' + } ); + plainMsg = mw.message( 'citoid-citeFromIDDialog-temporary-message' ).plain(); + mw.messages.set( { 'citoid-citeFromIDDialog-temporary-message-parsed': plainMsg } ); + parsedMsg = mw.message( 'citoid-citeFromIDDialog-temporary-message-parsed' ); + // Citation dialog label + this.citeDialogLabel = new OO.ui.LabelWidget( { + // Double-parse + label: $( '<span>' ) + .addClass( 've-ui-citeFromIdInspector-dialog-link' ) + .append( + mw.message( 'citoid-citeFromIDDialog-use-general-dialog-message', parsedMsg ).parse() + ) + } ); + // Preview fieldset this.previewSelectWidget = new OO.ui.SelectWidget( { classes: [ 've-ui-citeFromIdInspector-preview' ] @@ -108,7 +129,31 @@ } ); // Attach - this.form.$element.append( lookupFieldset.$element, this.previewSelectWidget.$element ); + this.form.$element + .append( + lookupFieldset.$element, + this.citeDialogLabel.$element, + this.previewSelectWidget.$element + ) + // Connect the dialog link to the event + .find( '.ve-ui-citeFromIdInspector-dialog-link a' ) + .click( this.onOpenFullDialogLinkClick.bind( this ) ); +}; + +/** + * Respond to full dialog link click + */ +ve.ui.CiteFromIdInspector.prototype.onOpenFullDialogLinkClick = function () { + var inspector = this, + fragment = this.getFragment(); + + // Preserve the staging + this.deliveredToAnotherDialog = true; + this.close().then( function () { + inspector.getManager().getSurface().execute( 'window', 'open', 'generalreference', { + fragment: fragment + } ); + } ); }; /** diff --git a/modules/ve.ui.CiteFromIdInspectorTool.js b/modules/ve.ui.CiteFromIdInspectorTool.js index d59466a..8014450 100644 --- a/modules/ve.ui.CiteFromIdInspectorTool.js +++ b/modules/ve.ui.CiteFromIdInspectorTool.js @@ -73,7 +73,7 @@ OO.inheritClass( ve.ui.CiteFromIdInspectorTool, ve.ui.InspectorTool ); ve.ui.CiteFromIdInspectorTool.static.name = 'citefromid'; - ve.ui.CiteFromIdInspectorTool.static.icon = 'ref-cite-web'; + ve.ui.CiteFromIdInspectorTool.static.icon = 'reference'; ve.ui.CiteFromIdInspectorTool.static.title = OO.ui.deferMsg( 'citoid-citeFromIDTool-title' ); ve.ui.CiteFromIdInspectorTool.static.label = OO.ui.deferMsg( 'citoid-citeFromIDTool-title' ); ve.ui.CiteFromIdInspectorTool.static.group = 'cite'; -- To view, visit https://gerrit.wikimedia.org/r/196644 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If5ffd9c3cc022d3261e15b522dd40f5a89627a52 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Citoid Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits