jenkins-bot has submitted this change and it was merged. Change subject: Show the history menu item only if it exists ......................................................................
Show the history menu item only if it exists If the message doesn't have a translation, the history link leads to an empty page. Now it's hidden for untranslated message and shown for translated messages. Change-Id: I35cd21fa7d80d3ff75d1e651178ca08cfa91c9d9 --- M resources/js/ext.translate.editor.js 1 file changed, 28 insertions(+), 17 deletions(-) Approvals: Nikerabbit: Looks good to me, approved Siebrand: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/js/ext.translate.editor.js b/resources/js/ext.translate.editor.js index c21f091..39bbfca 100644 --- a/resources/js/ext.translate.editor.js +++ b/resources/js/ext.translate.editor.js @@ -150,6 +150,11 @@ // immediately move to the next message. translateEditor.next(); + // Now the message definitely has a history, + // so make sure the history menu item is shown + translateEditor.$editor.find( '.message-tools-history' ) + .removeClass( 'hide' ); + api.postWithEditToken( { action: 'edit', title: translateEditor.message.title, @@ -250,7 +255,8 @@ }, createMessageTools: function () { - var wgScript = mw.config.get( 'wgScript' ), + var $historyItem, $translationsItem, + wgScript = mw.config.get( 'wgScript' ), historyUri = new mw.Uri(), translationsUri = new mw.Uri(); @@ -259,31 +265,36 @@ title: this.message.title, action: 'history' }; + $historyItem = $( '<li>' ) + .addClass( 'message-tools-history' + + ( ( this.message.translation === null ) ? ' hide' : '' ) + ) + .append( $( '<a>' ) + .attr( { + href: historyUri.toString(), + target: '_blank' + } ) + .text( mw.msg( 'tux-editor-message-tools-history' ) ) + ); translationsUri.path = wgScript; translationsUri.query = { title: 'Special:Translations', message: this.message.title.replace( /\/[a-z\-]+$/, '' ) }; + $translationsItem = $( '<li>' ) + .addClass( 'message-tools-translations' ) + .append( $( '<a>' ) + .attr( { + href: translationsUri.toString(), + target: '_blank' + } ) + .text( mw.msg( 'tux-editor-message-tools-translations' ) ) + ); 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' ) ) - ) - ); + .append( $historyItem, $translationsItem ); }, prepareEditorColumn: function () { -- To view, visit https://gerrit.wikimedia.org/r/59035 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I35cd21fa7d80d3ff75d1e651178ca08cfa91c9d9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits