Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/276101

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/continue.png
A modules/dashboard/images/continue.svg
M modules/dashboard/styles/ext.cx.translationlist.less
7 files changed, 53 insertions(+), 33 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/01/276101/1

diff --git a/extension.json b/extension.json
index 72d8d65..1de3f29 100644
--- a/extension.json
+++ b/extension.json
@@ -888,6 +888,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 065af70..94b9625 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -213,5 +213,6 @@
        "cx-tools-linter-hide-details": "Hide details",
        "cx-translator-month-stats-label": "This month",
        "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-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-continue-translation": "Continue translation"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 7f0a3ee..28d5bef 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -219,5 +219,6 @@
        "cx-tools-linter-hide-details": "Label for abusefilter error 
hide/collapse link in linter card",
        "cx-translator-month-stats-label": "Label displayed in the translation 
statistics of current user.",
        "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-page-old-revision-loaded": "Warning message shown when the older 
revision of source page loaded",
+       "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/continue.png 
b/modules/dashboard/images/continue.png
new file mode 100644
index 0000000..466d029
--- /dev/null
+++ b/modules/dashboard/images/continue.png
Binary files differ
diff --git a/modules/dashboard/images/continue.svg 
b/modules/dashboard/images/continue.svg
new file mode 100644
index 0000000..faa9318
--- /dev/null
+++ b/modules/dashboard/images/continue.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg 
xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 48 48" height="48" 
width="48"><path d="M35.665 24.237l-17.683-10.25v20.465zm-11.272-24.481q6.587 0 
12.188 3.241 5.601 3.241 8.841 8.877 3.241 5.601 3.276 12.188-.035 6.587-3.276 
12.188-3.241 5.636-8.841 8.877-5.601 3.241-12.188 3.241-6.587 
0-12.223-3.241-5.636-3.241-8.877-8.877-3.241-5.601-3.241-12.188 0-6.587 
3.241-12.188 3.241-5.636 8.877-8.877 5.636-3.241 12.223-3.241z" id="path4140" 
fill="#00af89"/><style type="text/css" id="style3"/></svg>
diff --git a/modules/dashboard/styles/ext.cx.translationlist.less 
b/modules/dashboard/styles/ext.cx.translationlist.less
index 1af370a..e09254d 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/continue.svg', 
'../images/continuey.png');
+                       }
                }
 
                &:hover ul {

-- 
To view, visit https://gerrit.wikimedia.org/r/276101
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7aa6a23d7caf521fa236b60b2be0b12f5ac6136d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to