jenkins-bot has submitted this change and it was merged.

Change subject: Add a message tools menu
......................................................................


Add a message tools menu

The CSS that was used for the workflow state menu is reused
as a new "dropdown-menu" class and the workflow state
code is updated accordingly.

Bug: 46791
Bug: 46793
Change-Id: I605147a0fabdfdad4e497ecc762c750f7ccdfeec
---
M Resources.php
M Translate.i18n.php
M resources/css/ext.translate.editor.css
M resources/css/ext.translate.special.translate.css
M resources/css/ext.translate.workflowselector.css
M resources/js/ext.translate.editor.js
M resources/js/ext.translate.workflowselector.js
7 files changed, 94 insertions(+), 20 deletions(-)

Approvals:
  Siebrand: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Resources.php b/Resources.php
index f88a772..449ff5a 100644
--- a/Resources.php
+++ b/Resources.php
@@ -92,6 +92,8 @@
                'tux-editor-close-tooltip',
                'tux-editor-expand-tooltip',
                'tux-editor-collapse-tooltip',
+               'tux-editor-message-tools-history',
+               'tux-editor-message-tools-translations',
                'tux-editor-loading',
        ),
        'position' => 'top',
diff --git a/Translate.i18n.php b/Translate.i18n.php
index 653d250..94dd1dc 100644
--- a/Translate.i18n.php
+++ b/Translate.i18n.php
@@ -508,6 +508,8 @@
        'tux-editor-close-tooltip' => 'Close',
        'tux-editor-expand-tooltip' => 'Expand',
        'tux-editor-collapse-tooltip' => 'Collapse',
+       'tux-editor-message-tools-history' => 'History',
+       'tux-editor-message-tools-translations' => 'All translations',
        'tux-editor-loading' => 'Loading...',
        'translate-search-more-languages-info' => '$1 more 
{{PLURAL:$1|language|languages}}',
        'translate-statsbar-tooltip' => '$1% translated, $2% proofread',
@@ -1175,6 +1177,8 @@
 {{Identical|Expand}}',
        'tux-editor-collapse-tooltip' => 'Tooltip for the collapse icon of 
translate editor.
 {{Identical|Collapse}}',
+       'tux-editor-message-tools-history' => 'A link to message history. An 
item in a menu that appears when clicking on message title.',
+       'tux-editor-message-tools-translations' => 'A link to translations of a 
message to all languages. An item in a menu that appears when clicking on 
message title.',
        'tux-editor-loading' => 'Loading message while translation editor is 
being prepared with helper information.
 {{Identical|Loading}}',
        'translate-search-more-languages-info' => 'Information shown as number 
of languages matching the query using
diff --git a/resources/css/ext.translate.editor.css 
b/resources/css/ext.translate.editor.css
index 452569b..bbb5524 100644
--- a/resources/css/ext.translate.editor.css
+++ b/resources/css/ext.translate.editor.css
@@ -64,6 +64,7 @@
        font-size: 13px;
        font-weight: bold;
        padding: 5px 0 5px 10px;
+       cursor: pointer;
 }
 
 .tux-message-editor .messagekey .caret {
@@ -357,3 +358,23 @@
        font-size: 14px;
        color: #565656;
 }
+
+.tux-message-tools-menu li a {
+       color: #555555;
+       display: block;
+       font-size: 14px;
+       padding: 0 2px;
+       text-decoration: none;
+}
+
+.tux-message-tools-menu li a:hover {
+       cursor: pointer;
+       background-color: #f0f0f0;
+       color: #252525;
+}
+
+.tux-message-tools-menu li.selected {
+       /* @embed */
+       background: url(../images/label-tick.png) right no-repeat;
+       color: #252525;
+}
diff --git a/resources/css/ext.translate.special.translate.css 
b/resources/css/ext.translate.special.translate.css
index 43f7e6a..3761259 100644
--- a/resources/css/ext.translate.special.translate.css
+++ b/resources/css/ext.translate.special.translate.css
@@ -184,3 +184,21 @@
        width: 32px;
        margin-left: -24px;
 }
+
+.dropdown-menu {
+       padding-top: 2em;
+       border: 1px solid #c9c9c9;
+       /* @noflip */
+       -webkit-box-shadow: 0 3px 3px -3px rgba(0, 0, 0, 0.5);
+       /* @noflip */
+       box-shadow: 0 3px 3px -3px rgba(0, 0, 0, 0.5);
+       font-size: 14px;
+       margin: 0 5px;
+       list-style: none;
+       padding: 4px;
+       width: 200px;
+       z-index: 300;
+       background: #fff;
+       display: block;
+       position: absolute;
+}
diff --git a/resources/css/ext.translate.workflowselector.css 
b/resources/css/ext.translate.workflowselector.css
index 7c25995..b39860d 100644
--- a/resources/css/ext.translate.workflowselector.css
+++ b/resources/css/ext.translate.workflowselector.css
@@ -22,26 +22,9 @@
        vertical-align: middle;
 }
 
-.tux-workflow-status-selector {
-       padding-top: 2em;
-       border: 1px solid #c9c9c9;
-       /* @noflip */
-       -webkit-box-shadow: 0 3px 3px -3px rgba(0, 0, 0, 0.5);
-       /* @noflip */
-       box-shadow: 0 3px 3px -3px rgba(0, 0, 0, 0.5);
-       font-size: 14px;
-       margin: 0 5px;
-       list-style: none;
-       padding: 4px;
-       width: 200px;
-       z-index: 10;
-       background: #fff;
-       display: block;
-       position: absolute;
-}
-
 .tux-workflow-status-selector li {
        color: #555555;
+       display: block;
        font-size: 14px;
        padding: 0 2px;
 }
diff --git a/resources/js/ext.translate.editor.js 
b/resources/js/ext.translate.editor.js
index e28c72c..1b56c8e 100644
--- a/resources/js/ext.translate.editor.js
+++ b/resources/js/ext.translate.editor.js
@@ -249,6 +249,43 @@
                        }
                },
 
+               createMessageTools: function () {
+                       var wgScript = mw.config.get( 'wgScript' ),
+                               historyUri = new mw.Uri(),
+                               translationsUri = new mw.Uri();
+
+                       historyUri.path = wgScript;
+                       historyUri.query = {
+                               title: this.message.title,
+                               action: 'history'
+                       };
+
+                       translationsUri.path = wgScript;
+                       translationsUri.query = {
+                               title: 'Special:Translations',
+                               message: this.message.title.replace( 
/\/[a-z\-]+$/, '' )
+                       };
+
+                       return $( '<ul>' )
+                               .addClass( 'dropdown-menu 
tux-message-tools-menu hide' )
+                               .append(
+                                       $( '<li>' ).append( $( '<a>' )
+                                               .attr( {
+                                                       href: 
historyUri.toString(),
+                                                       target: '_blank'
+                                               } )
+                                               .text( mw.msg( 
'tux-editor-message-tools-history' ) )
+                                       ),
+                                       $( '<li>' ).append( $( '<a>' )
+                                               .attr( {
+                                                       href: 
translationsUri.toString(),
+                                                       target: '_blank'
+                                               } )
+                                               .text( mw.msg( 
'tux-editor-message-tools-translations' ) )
+                                       )
+                               );
+               },
+
                prepareEditorColumn: function () {
                        var translateEditor = this,
                                sourceString,
@@ -272,6 +309,7 @@
                                $layoutActions,
                                $infoToggleIcon,
                                $messageList,
+                               $messageTools = 
translateEditor.createMessageTools(),
                                canTranslate = mw.translate.canTranslate();
 
                        $editorColumn = $( '<div>' )
@@ -280,7 +318,15 @@
                        $messageKeyLabel = $( '<div>' )
                                .addClass( 'ten columns messagekey' )
                                .text( this.message.title )
-                               .append( $( '<span>' ).addClass( 'caret' ) );
+                               .append(
+                                       $( '<span>' ).addClass( 'caret' ),
+                                       $messageTools
+                               )
+                               .on( 'click', function ( e ) {
+                                       $messageTools.toggleClass( 'hide' );
+                                       e.stopPropagation();
+                               } );
+
 
                        $closeIcon = $( '<span>' )
                                .addClass( 'one column close' )
diff --git a/resources/js/ext.translate.workflowselector.js 
b/resources/js/ext.translate.workflowselector.js
index 0fb5dce..064f258 100644
--- a/resources/js/ext.translate.workflowselector.js
+++ b/resources/js/ext.translate.workflowselector.js
@@ -95,7 +95,7 @@
                        }
 
                        $list = $( '<ul>' )
-                               .addClass( 'tux-workflow-status-selector hide' 
);
+                               .addClass( 'dropdown-menu 
tux-workflow-status-selector hide' );
 
                        $display = $( '<div>' )
                                .addClass( 'tux-workflow-status' )

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I605147a0fabdfdad4e497ecc762c750f7ccdfeec
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Pginer <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to