jenkins-bot has submitted this change and it was merged. Change subject: Allow continuing a translation that was published ......................................................................
Allow continuing a translation that was published Translator need to decide on overwrite or not. Warnings will be shown about this before continuing translation and before publishing. Bug: T102966 Change-Id: I7aa6a23d7caf521fa236b60b2be0b12f5ac6136d --- M extension.json M i18n/en.json M i18n/qqq.json M modules/dashboard/ext.cx.translationlist.js A modules/dashboard/images/edit.png A modules/dashboard/images/edit.svg M modules/dashboard/styles/ext.cx.translationlist.less 7 files changed, 53 insertions(+), 33 deletions(-) Approvals: Nikerabbit: Checked; Looks good to me, approved jenkins-bot: Verified diff --git a/extension.json b/extension.json index 0959b2b..bc42c1c 100644 --- a/extension.json +++ b/extension.json @@ -890,6 +890,7 @@ "messages": [ "cx-dashboard-header", "cx-discard-translation", + "cx-continue-translation", "cx-translation-status-draft", "cx-translation-status-deleted", "cx-translation-status-published", diff --git a/i18n/en.json b/i18n/en.json index 460e78a..588ff8f 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -215,5 +215,6 @@ "cx-translator-total-translations-label": "Total", "cx-page-old-revision-loaded": "This translation is based on an older version of the content. The source page may have [$1 changed significantly]. You can continue this translation or start it again to use the updated content.", "cx-tools-mt-new-provider": "new", - "cx-tools-mt-new-providers-available": "with new options" + "cx-tools-mt-new-providers-available": "with new options", + "cx-continue-translation": "Continue translation" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 3ebf8d2..5af6889 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -221,5 +221,6 @@ "cx-translator-total-translations-label": "Label displayed in the translation statistics of current user.\n{{Identical|Total}}", "cx-page-old-revision-loaded": "Warning message shown when the older revision of source page loaded", "cx-tools-mt-new-provider": "Label indicating the machine translation provider is a new option\n{{Identical|New}}", - "cx-tools-mt-new-providers-available": "Label shown in machine translation card when there are new provider options" + "cx-tools-mt-new-providers-available": "Label shown in machine translation card when there are new provider options", + "cx-continue-translation": "Menu item label shown for published translations to continue translations" } diff --git a/modules/dashboard/ext.cx.translationlist.js b/modules/dashboard/ext.cx.translationlist.js index 9977372..a151828 100644 --- a/modules/dashboard/ext.cx.translationlist.js +++ b/modules/dashboard/ext.cx.translationlist.js @@ -198,29 +198,23 @@ * * @param {Object} translation */ - CXTranslationList.prototype.startTranslation = function ( translation ) { + CXTranslationList.prototype.continueTranslation = function ( translation ) { if ( translation.status === 'deleted' ) { return false; } - if ( translation.status === 'draft' ) { - // Set CX token as cookie. - mw.cx.siteMapper.setCXToken( - translation.sourceLanguage, - translation.targetLanguage, - translation.sourceTitle - ); - location.href = new mw.Uri( mw.cx.siteMapper.getCXUrl( - translation.sourceTitle, - translation.targetTitle, - translation.sourceLanguage, - translation.targetLanguage - ) ).toString(); - } - - if ( translation.status === 'published' ) { - location.href = translation.targetURL; - } + // Set CX token as cookie. + mw.cx.siteMapper.setCXToken( + translation.sourceLanguage, + translation.targetLanguage, + translation.sourceTitle + ); + location.href = new mw.Uri( mw.cx.siteMapper.getCXUrl( + translation.sourceTitle, + translation.targetTitle, + translation.sourceLanguage, + translation.targetLanguage + ) ).toString(); }; /** @@ -233,6 +227,7 @@ $translationLink, $sourceLanguage, $targetLanguage, $languageContainer, $status, $actionsTrigger, $deleteTranslation, $menu, $menuContainer, + $continueTranslation, $titleLanguageBlock, $translations = []; @@ -315,23 +310,26 @@ .addClass( 'status status-' + translation.status ) .text( mw.msg( 'cx-translation-status-' + translation.status ) ); + $actionsTrigger = $( '<div>' ) + .addClass( 'cx-tlitem__actions__trigger' ) + .text( '…' ); // If the translation is draft, allow deleting it if ( translation.status === 'draft' ) { - $actionsTrigger = $( '<div>' ) - .addClass( 'cx-tlitem__actions__trigger' ) - .text( '…' ); $deleteTranslation = $( '<li>' ) .addClass( 'cx-discard-translation' ) .text( mw.msg( 'cx-discard-translation' ) ); $menu = $( '<ul>' ) .append( $deleteTranslation ); - $menuContainer = $( '<div>' ) - .addClass( 'cx-tlitem__actions' ) - .append( $actionsTrigger, $menu ); - } else { - $menuContainer = $(); + } else if ( translation.status === 'published' ) { + $continueTranslation = $( '<li>' ) + .addClass( 'cx-continue-translation' ) + .text( mw.msg( 'cx-continue-translation' ) ); + $menu = $( '<ul>' ) + .append( $continueTranslation ); } - + $menuContainer = $( '<div>' ) + .addClass( 'cx-tlitem__actions' ) + .append( $actionsTrigger, $menu ); $titleLanguageBlock = $( '<div>' ) .addClass( 'cx-tlitem__details' ) .append( $translationLink, $progressbar, $lastUpdated, $languageContainer ); @@ -401,8 +399,22 @@ } ); } ); + this.$translationsList.on( 'click', '.cx-continue-translation', function ( e ) { + var translation; + + e.stopPropagation(); + translation = $( this ).closest( '.cx-tlitem' ).data( 'translation' ); + self.continueTranslation( translation ); + return false; + } ); + this.$translationsList.on( 'click', '.cx-tlitem', function () { - self.startTranslation( $( this ).data( 'translation' ) ); + var translation = $( this ).data( 'translation' ); + if ( translation.status === 'published' ) { + location.href = translation.targetURL; + } else { + self.continueTranslation( translation ); + } } ); // Attach a scroll handler diff --git a/modules/dashboard/images/edit.png b/modules/dashboard/images/edit.png new file mode 100644 index 0000000..2f8ae33 --- /dev/null +++ b/modules/dashboard/images/edit.png Binary files differ diff --git a/modules/dashboard/images/edit.svg b/modules/dashboard/images/edit.svg new file mode 100644 index 0000000..12c0bed --- /dev/null +++ b/modules/dashboard/images/edit.svg @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16 3l-12 12-1 5 5-1 12-12c0-2-2-4-4-4zm-9.8 13.5c-.3-.3-.7-.6-1-.8 2.3-2.3 11.3-11.4 11.3-11.4.4.1.7.3 1 .7l-11.3 11.5z" fill="#333"/></svg> diff --git a/modules/dashboard/styles/ext.cx.translationlist.less b/modules/dashboard/styles/ext.cx.translationlist.less index 1af370a..50c2b21 100644 --- a/modules/dashboard/styles/ext.cx.translationlist.less +++ b/modules/dashboard/styles/ext.cx.translationlist.less @@ -42,16 +42,20 @@ li { padding: 5px 30px; cursor: pointer; - .background-image-svg('../images/trash_lightgray.svg', '../images/trash_lightgray.png'); background-repeat: no-repeat; background-position: center left; background-size: 30px 20px; - + } + .cx-discard-translation { + .background-image-svg('../images/trash_lightgray.svg', '../images/trash_lightgray.png'); &:hover { .background-image-svg('../images/trash_orange.svg', '../images/trash_orange.png'); background-color: darken( white, 5% ); } } + .cx-continue-translation { + .background-image-svg('../images/edit.svg', '../images/edit.png'); + } } &:hover ul { -- To view, visit https://gerrit.wikimedia.org/r/276101 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7aa6a23d7caf521fa236b60b2be0b12f5ac6136d Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: KartikMistry <kartik.mis...@gmail.com> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> 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