[MediaWiki-commits] [Gerrit] Improve contributions page entry point by adding 3 ways to c... - change (mediawiki...ContentTranslation)
jenkins-bot has submitted this change and it was merged. Change subject: Improve contributions page entry point by adding 3 ways to contribute .. Improve contributions page entry point by adding 3 ways to contribute Also includes eventlogging tooling. Bug: T92939 Change-Id: If6670eb05106516637221a24f0a64e084f27626b --- M ContentTranslation.hooks.php M Resources.php M i18n/en.json M i18n/qqq.json M modules/entrypoint/ext.cx.contributions.init.js M modules/entrypoint/ext.cx.contributions.js D modules/entrypoint/images/dropdown.png D modules/entrypoint/images/dropdown.svg A modules/entrypoint/images/editarticle.png A modules/entrypoint/images/editarticle.svg A modules/entrypoint/images/translation.png A modules/entrypoint/images/translation.svg A modules/entrypoint/images/upload.png A modules/entrypoint/images/upload.svg M modules/entrypoint/styles/ext.cx.contributions.less 15 files changed, 134 insertions(+), 95 deletions(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php index 991bd46..ac18b64 100644 --- a/ContentTranslation.hooks.php +++ b/ContentTranslation.hooks.php @@ -116,9 +116,15 @@ * @param SpecialPage $page */ public static function addNewContributionButton( $id, User $user, SpecialPage $page ) { + global $wgContentTranslationEventLogging; + if ( $user-getId() === $page-getUser()-getId() ContentTranslationHooks::isEnabledForUser( $user ) ) { + // If EventLogging integration is enabled, load the event logging functions module + if ( $wgContentTranslationEventLogging ) { + $page-getOutput()-addModules( 'ext.cx.eventlogging' ); + } $page-getOutput()-addModules( 'ext.cx.contributions.init' ); } } diff --git a/Resources.php b/Resources.php index 4304ade..8fb2841 100644 --- a/Resources.php +++ b/Resources.php @@ -26,9 +26,13 @@ 'mediawiki.ui.button', ), 'messages' = array( - 'cx-contributions', + 'cx-contributions-new-contributions', + 'cx-contributions-new-article', 'cx-contributions-translation', - 'cx-contributions-media', + 'cx-contributions-upload', + 'cx-contributions-new-article-tooltip', + 'cx-contributions-translation-tooltip', + 'cx-contributions-upload-tooltip', ), ) + $resourcePaths; diff --git a/i18n/en.json b/i18n/en.json index aba65c9..b0206d9 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -132,9 +132,13 @@ cx-save-draft-save-success: Saved {{PLURAL:$1|a minute ago|$1 minutes ago|0=just now}}, cx-save-draft-saving: Saving..., cx-save-draft-tooltip: Translation drafts are saved automatically, - cx-contributions: New contribution, + cx-contributions-new-contributions: New contribution, + cx-contributions-new-article: New page, cx-contributions-translation: Translation, - cx-contributions-media: Upload media file, + cx-contributions-upload: Upload media, + cx-contributions-new-article-tooltip: Start writing a new page, + cx-contributions-translation-tooltip: Translate existing pages, + cx-contributions-upload-tooltip: Upload pictures, audio and video to use in pages, cx-publishing-dialog-message: The page $1 already exists. The current content will be replaced by your translation. Do you want to publish anyway?, cx-publishing-dialog-keep-button: Keep both versions, cx-publishing-dialog-publish-anyway-button: Publish anyway, diff --git a/i18n/qqq.json b/i18n/qqq.json index a546ece..2f2e59c 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -139,9 +139,13 @@ cx-save-draft-save-success: \Saved\ refers to a draft of a translated page that was saved recently., cx-save-draft-saving: Label of button to save the translation as draft while saving is in progress\n{{Identical|Saving}}, cx-save-draft-tooltip: Tooltip text shown for the save status indicator text in the header of [[Special:ContentTranslation]].\n\nParameters: \n* $1 - the number of minutes ago the translation was saved., - cx-contributions: Text of a button which opens a dropdown, - cx-contributions-translation: Dropdown item\n{{Identical|Translation}}, - cx-contributions-media: Dropdown item, + cx-contributions-new-contributions: Header text shown in [[Special:Contributions]], + cx-contributions-new-article: Button label, + cx-contributions-translation: Button label, + cx-contributions-upload: Button label, + cx-contributions-new-article: Button label tooltip, +
[MediaWiki-commits] [Gerrit] Improve contributions page entry point by adding 3 ways to c... - change (mediawiki...ContentTranslation)
Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/200120 Change subject: Improve contributions page entry point by adding 3 ways to contribute .. Improve contributions page entry point by adding 3 ways to contribute Bug: T92939 Change-Id: If6670eb05106516637221a24f0a64e084f27626b --- M Resources.php M i18n/en.json M i18n/qqq.json M modules/entrypoint/ext.cx.contributions.js D modules/entrypoint/images/dropdown.svg A modules/entrypoint/images/editarticle.png A modules/entrypoint/images/editarticle.svg A modules/entrypoint/images/translation.png A modules/entrypoint/images/translation.svg A modules/entrypoint/images/upload.png A modules/entrypoint/images/upload.svg M modules/entrypoint/styles/ext.cx.contributions.less 12 files changed, 105 insertions(+), 94 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/20/200120/1 diff --git a/Resources.php b/Resources.php index 4304ade..8028cb0 100644 --- a/Resources.php +++ b/Resources.php @@ -26,9 +26,12 @@ 'mediawiki.ui.button', ), 'messages' = array( - 'cx-contributions', + 'cx-contributions-new-article', 'cx-contributions-translation', - 'cx-contributions-media', + 'cx-contributions-upload', + 'cx-contributions-new-article-tooltip', + 'cx-contributions-translation-tooltip', + 'cx-contributions-upload-tooltip', ), ) + $resourcePaths; diff --git a/i18n/en.json b/i18n/en.json index aba65c9..d64a71f 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -132,9 +132,12 @@ cx-save-draft-save-success: Saved {{PLURAL:$1|a minute ago|$1 minutes ago|0=just now}}, cx-save-draft-saving: Saving..., cx-save-draft-tooltip: Translation drafts are saved automatically, - cx-contributions: New contribution, + cx-contributions-new-article: Start a draft, cx-contributions-translation: Translation, - cx-contributions-media: Upload media file, + cx-contributions-upload: Upload media, + cx-contributions-new-article-tooltip: Start writing a new article for wikipedia, + cx-contributions-translation-tooltip: Translate existing articles, + cx-contributions-upload-tooltip: Upload pictures, audio and video to use in articles, cx-publishing-dialog-message: The page $1 already exists. The current content will be replaced by your translation. Do you want to publish anyway?, cx-publishing-dialog-keep-button: Keep both versions, cx-publishing-dialog-publish-anyway-button: Publish anyway, diff --git a/i18n/qqq.json b/i18n/qqq.json index a546ece..08d5839 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -139,9 +139,12 @@ cx-save-draft-save-success: \Saved\ refers to a draft of a translated page that was saved recently., cx-save-draft-saving: Label of button to save the translation as draft while saving is in progress\n{{Identical|Saving}}, cx-save-draft-tooltip: Tooltip text shown for the save status indicator text in the header of [[Special:ContentTranslation]].\n\nParameters: \n* $1 - the number of minutes ago the translation was saved., - cx-contributions: Text of a button which opens a dropdown, - cx-contributions-translation: Dropdown item\n{{Identical|Translation}}, - cx-contributions-media: Dropdown item, + cx-contributions-new-article: Button label, + cx-contributions-translation: Button label, + cx-contributions-upload: Button label, + cx-contributions-new-article: Button label tooltip, + cx-contributions-translation: Button label tooltip, + cx-contributions-upload: Button label tooltip, cx-publishing-dialog-message: Message that shows in the publishing options dialog when there is an existing page with the same title already published.\n\nParameters:\n* $1 - The link to the existing page with just the title as text., cx-publishing-dialog-keep-button: Button label for publishing options dialog. Clicking button preserves both the existing translation and the new translation., cx-publishing-dialog-publish-anyway-button: Button label for publishing options dialog. Clicking button overwrites the existing translation with the new translation., diff --git a/modules/entrypoint/ext.cx.contributions.js b/modules/entrypoint/ext.cx.contributions.js index cbb42ff..786033c 100644 --- a/modules/entrypoint/ext.cx.contributions.js +++ b/modules/entrypoint/ext.cx.contributions.js @@ -11,13 +11,10 @@ /** * @class */ - function CXContributions( element, options ) { + function CXContributions( element ) { this.$element = $( element ); - this.options = $.extend( {}, $.fn.cxContributions.defaults, options ); +