mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 22:45:20 +00:00
Merge "Citation needed template handling"
This commit is contained in:
commit
12c7fd7ac2
|
@ -130,7 +130,8 @@ class CiteHooks {
|
|||
"ve-cite/ve.ui.MWReferencesListContextItem.js",
|
||||
"ve-cite/ve.ui.MWCitationContextItem.js",
|
||||
"ve-cite/ve.ui.MWCitationAction.js",
|
||||
"ve-cite/ve.ui.MWReference.init.js"
|
||||
"ve-cite/ve.ui.MWReference.init.js",
|
||||
"ve-cite/ve.ui.MWCitationNeededContextItem.js",
|
||||
],
|
||||
"styles" => [
|
||||
"ve-cite/ve.ui.MWReferenceDialog.css",
|
||||
|
@ -160,6 +161,9 @@ class CiteHooks {
|
|||
"cite-ve-changedesc-reflist-item-id",
|
||||
"cite-ve-changedesc-reflist-responsive-set",
|
||||
"cite-ve-changedesc-reflist-responsive-unset",
|
||||
"cite-ve-citationneeded-button",
|
||||
"cite-ve-citationneeded-description",
|
||||
"cite-ve-citationneeded-title",
|
||||
"cite-ve-dialog-reference-editing-reused",
|
||||
"cite-ve-dialog-reference-editing-reused-long",
|
||||
"cite-ve-dialog-reference-options-group-label",
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
"cite-ve-changedesc-reflist-responsive-set": "References list changed to display in responsive columns",
|
||||
"cite-ve-changedesc-reflist-responsive-unset": "References list changed to display in only one column",
|
||||
"cite-ve-changedesc-reflist-item-id": "Reference index changed",
|
||||
"cite-ve-citationneeded-button": "Add a citation",
|
||||
"cite-ve-citationneeded-description": "An editor has indicated that this claim needs a citation to a reliable source.",
|
||||
"cite-ve-citationneeded-title": "Citation needed",
|
||||
"cite-ve-dialog-reference-editing-reused": "This reference is used {{PLURAL:$1|once|2=twice|$1 times}} on this page.",
|
||||
"cite-ve-dialog-reference-editing-reused-long": "This reference is used {{PLURAL:$1|once|2=twice|$1 times}} on this page. Changes made here will be applied in all places where this reference is reused.",
|
||||
"cite-ve-dialog-reference-options-group-label": "Use this group",
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
"cite-ve-changedesc-reflist-responsive-set": "Description of a references list changing responsiveness to on",
|
||||
"cite-ve-changedesc-reflist-responsive-unset": "Description of a references list changing responsiveness to off",
|
||||
"cite-ve-changedesc-reflist-item-id": "Description of the visible index of a reference changing",
|
||||
"cite-ve-citationneeded-button": "Label for button in citation needed context, to add a citation",
|
||||
"cite-ve-citationneeded-description": "Description in citation needed context, explaining that a citation is needed",
|
||||
"cite-ve-citationneeded-title": "Title of citation needed context",
|
||||
"cite-ve-dialog-reference-editing-reused": "Text shown in reference context menu when editing a reference that is used multiple times. This is a shorter version of {{msg-mw|cite-ve-dialog-reference-editing-reused-long}}.\n\nParameters:\n* $1 - Number of times used. This is always greater than 1.\n\nNote that the explicit '2' value is useful in English, but not necessarily for other languages. Don't translate the 2 value if it's not useful for your language.",
|
||||
"cite-ve-dialog-reference-editing-reused-long": "Text shown at the top of the reference dialog when editing a reference that is used multiple times. This is a more detailed version of {{msg-mw|cite-ve-dialog-reference-editing-reused}}.\n\nParameters:\n* $1 - Number of times used. This is always greater than 1.\n\nNote that the explicit '2' value is useful in English, but not necessarily for other languages. Don't translate the 2 value if it's not useful for your language.",
|
||||
"cite-ve-dialog-reference-options-group-label": "Label for the reference group input",
|
||||
|
|
68
modules/ve-cite/ve.ui.MWCitationNeededContextItem.js
Normal file
68
modules/ve-cite/ve.ui.MWCitationNeededContextItem.js
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*!
|
||||
* VisualEditor MWCitationNeededContextItem class.
|
||||
*
|
||||
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Context item for a citation needed template.
|
||||
*
|
||||
* @class
|
||||
* @extends ve.ui.MWDefinedTransclusionContextItem
|
||||
*
|
||||
* @constructor
|
||||
* @param {ve.ui.Context} context Context item is in
|
||||
* @param {ve.dm.Model} model Model item is related to
|
||||
* @param {Object} config Configuration options
|
||||
*/
|
||||
ve.ui.MWCitationNeededContextItem = function VeUiMWCitationNeededContextItem() {
|
||||
var contextItem = this;
|
||||
|
||||
// Parent constructor
|
||||
ve.ui.MWCitationNeededContextItem.super.apply( this, arguments );
|
||||
|
||||
this.addButton = new OO.ui.ButtonWidget( {
|
||||
label: ve.msg( 'cite-ve-citationneeded-button' ),
|
||||
flags: [ 'progressive' ]
|
||||
} ).on( 'click', function () {
|
||||
var action = ve.ui.actionFactory.create( 'citoid', contextItem.context.getSurface() );
|
||||
action.open( true );
|
||||
ve.track( 'activity.' + contextItem.constructor.static.name, { action: 'context-add-citation' } );
|
||||
} );
|
||||
|
||||
// Remove progressive flag from edit, as addButton is now the
|
||||
// main progressive action in the context.
|
||||
this.editButton.setFlags( { progressive: false } );
|
||||
|
||||
// Initialization
|
||||
this.$element.addClass( 've-ui-mwCitationNeededContextItem' );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
OO.inheritClass( ve.ui.MWCitationNeededContextItem, ve.ui.MWDefinedTransclusionContextItem );
|
||||
|
||||
/* Static Properties */
|
||||
|
||||
ve.ui.MWCitationNeededContextItem.static.name = 'citationNeeded';
|
||||
|
||||
ve.ui.MWCitationNeededContextItem.static.icon = 'quotes';
|
||||
|
||||
ve.ui.MWCitationNeededContextItem.static.label = OO.ui.deferMsg( 'cite-ve-citationneeded-title' );
|
||||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWCitationNeededContextItem.prototype.renderBody = function () {
|
||||
this.$body.empty().append(
|
||||
$( '<p>' ).text( ve.msg( 'cite-ve-citationneeded-description' ) ),
|
||||
this.addButton.$element
|
||||
);
|
||||
};
|
||||
|
||||
/* Registration */
|
||||
|
||||
ve.ui.contextItemFactory.register( ve.ui.MWCitationNeededContextItem );
|
Loading…
Reference in a new issue