jenkins-bot has submitted this change and it was merged. Change subject: Add about link to disable/enable dialog ......................................................................
Add about link to disable/enable dialog This was the last issue with the dialogs. Tests included. Change-Id: Ic08af400893950a04489af4b166827d059561974 --- M MultimediaViewer.php M resources/mmv/logging/mmv.logging.ActionLogger.js M resources/mmv/ui/mmv.ui.viewingOptions.js M resources/mmv/ui/mmv.ui.viewingOptions.less M tests/qunit/mmv/ui/mmv.ui.viewingOptions.test.js 5 files changed, 37 insertions(+), 9 deletions(-) Approvals: Gilles: Looks good to me, approved jenkins-bot: Verified diff --git a/MultimediaViewer.php b/MultimediaViewer.php index 46bffd5..963005c 100644 --- a/MultimediaViewer.php +++ b/MultimediaViewer.php @@ -776,6 +776,7 @@ ), 'messages' => array( + 'multimediaviewer-options-learn-more', 'multimediaviewer-options-dialog-header', 'multimediaviewer-option-header-viewer', 'multimediaviewer-option-header-filepage', @@ -1013,7 +1014,7 @@ $wgHooks['EventLoggingRegisterSchemas'][] = function( array &$schemas ) { $schemas += array( - 'MediaViewer' => 10277480, + 'MediaViewer' => 10308479, 'MultimediaViewerNetworkPerformance' => 7917896, 'MultimediaViewerDuration' => 8572641, 'MultimediaViewerAttribution' => 9758179, diff --git a/resources/mmv/logging/mmv.logging.ActionLogger.js b/resources/mmv/logging/mmv.logging.ActionLogger.js index df3b7e9..c394570 100644 --- a/resources/mmv/logging/mmv.logging.ActionLogger.js +++ b/resources/mmv/logging/mmv.logging.ActionLogger.js @@ -111,7 +111,9 @@ 'download-open': 'User opened the dialog to download this file.', 'download-close': 'User closed the dialog to download this file.', 'options-open': 'User opened the enable/disable dialog.', - 'options-close': 'User either canceled an enable/disable action or closed a confirmation window.' + 'options-close': 'User either canceled an enable/disable action or closed a confirmation window.', + 'disable-about-link': 'User clicked on the "Learn more" link in the disable window.', + 'enable-about-link': 'User clicked on the "Learn more" link in the enable window.' }; /** diff --git a/resources/mmv/ui/mmv.ui.viewingOptions.js b/resources/mmv/ui/mmv.ui.viewingOptions.js index 1918949..fe180a7 100644 --- a/resources/mmv/ui/mmv.ui.viewingOptions.js +++ b/resources/mmv/ui/mmv.ui.viewingOptions.js @@ -67,7 +67,6 @@ mw.message( 'multimediaviewer-enable-confirmation-header' ).text(), mw.message( 'multimediaviewer-enable-confirmation-text', mw.config.get( 'wgSiteName' ) ).text() ] ); - }; /** @@ -233,6 +232,7 @@ .appendTo( $div ); this.addText( $div, msgs ); + this.addInfoLink( $div, ( enabled ? 'enable' : 'disable' ) + '-about-link' ); this.makeButtons( $div, smsg, enabled ); this[propName] = $div; @@ -350,6 +350,21 @@ }; /** + * Adds the info link to the panel. + * @param {jQuery} $div The panel to which we're adding the link. + */ + ODP.addInfoLink = function ( $div, eventName ) { + var self = this; + + $( '<a>' ) + .addClass( 'mw-mmv-project-info-link' ) + .prop( 'href', mw.config.get( 'wgMultimediaViewer' ).helpLink ) + .text( mw.message( 'multimediaviewer-options-learn-more' ) ) + .click( function ( e ) { self.trackLinkClick.call( this, eventName, e ); } ) + .appendTo( $div.find( '.mw-mmv-options-text' ) ); + }; + + /** * Checks the preference. */ ODP.isEnabled = function () { diff --git a/resources/mmv/ui/mmv.ui.viewingOptions.less b/resources/mmv/ui/mmv.ui.viewingOptions.less index ecccfce..f857b39 100644 --- a/resources/mmv/ui/mmv.ui.viewingOptions.less +++ b/resources/mmv/ui/mmv.ui.viewingOptions.less @@ -45,11 +45,11 @@ } .mw-mmv-options-enable { - height: 170px; + height: 180px; } .mw-mmv-options-disable { - height: 150px; + height: 160px; } .mw-mmv-enable-confirmation, diff --git a/tests/qunit/mmv/ui/mmv.ui.viewingOptions.test.js b/tests/qunit/mmv/ui/mmv.ui.viewingOptions.test.js index 3dda1a2..3da7d3b 100644 --- a/tests/qunit/mmv/ui/mmv.ui.viewingOptions.test.js +++ b/tests/qunit/mmv/ui/mmv.ui.viewingOptions.test.js @@ -27,9 +27,9 @@ assert.ok( dialog.$enableConfirmation, 'Enable confirmation is created.' ); } ); - QUnit.test( 'Disable', 17, function ( assert ) { + QUnit.test( 'Disable', 20, function ( assert ) { var $header, $icon, $text, $textHeader, $textBody, - $submitButton, $cancelButton, + $submitButton, $cancelButton, $aboutLink, dialog = makeDialog(), deferred = $.Deferred(); @@ -45,6 +45,7 @@ $text = dialog.$disableDiv.find( 'div.mw-mmv-options-text' ); $textHeader = $text.find( 'p.mw-mmv-options-text-header' ); $textBody = $text.find( 'p.mw-mmv-options-text-body' ); + $aboutLink = $text.find( 'a.mw-mmv-project-info-link' ); $submitButton = dialog.$disableDiv.find( 'button.mw-mmv-options-submit-button' ); $cancelButton = dialog.$disableDiv.find( 'button.mw-mmv-options-cancel-button' ); @@ -60,6 +61,10 @@ assert.strictEqual( $textBody.length, 1, 'Text body created successfully.' ); assert.strictEqual( $textBody.text(), 'You can enable it later through the file details page.', 'Text body has correct text (if this fails, it may be due to i18n differences)' ); + + assert.strictEqual( $aboutLink.length, 1, 'About link created successfully.' ); + assert.strictEqual( $aboutLink.text(), 'Learn more', 'About link has correct text (if this fails, it may be due to i18n differences)' ); + assert.strictEqual( $aboutLink.prop( 'href' ), 'http://mediawiki.org/wiki/Special:MyLanguage/Help:Extension:Media_Viewer', 'About link has correct href (depends on your current protocol, so if you are on https, this will fail).' ); assert.strictEqual( $submitButton.length, 1, 'Disable button created successfully.' ); assert.strictEqual( $submitButton.text(), 'Disable Media Viewer', 'Disable button has correct text (if this fails, it may be due to i18n differences)' ); @@ -80,8 +85,8 @@ assert.ok( dialog.$dialog.hasClass( 'mw-mmv-disable-confirmation-shown' ), 'Disable confirmation shown' ); } ); - QUnit.test( 'Enable', 15, function ( assert ) { - var $header, $icon, $text, $textHeader, + QUnit.test( 'Enable', 18, function ( assert ) { + var $header, $icon, $text, $textHeader, $aboutLink, $submitButton, $cancelButton, dialog = makeDialog(), deferred = $.Deferred(); @@ -97,6 +102,7 @@ $text = dialog.$enableDiv.find( 'div.mw-mmv-options-text' ); $textHeader = $text.find( 'p.mw-mmv-options-text-header' ); + $aboutLink = $text.find( 'a.mw-mmv-project-info-link' ); $submitButton = dialog.$enableDiv.find( 'button.mw-mmv-options-submit-button' ); $cancelButton = dialog.$enableDiv.find( 'button.mw-mmv-options-cancel-button' ); @@ -110,6 +116,10 @@ assert.strictEqual( $textHeader.length, 1, 'Text header created successfully.' ); assert.strictEqual( $textHeader.text(), 'Enable this media viewing feature for all files by default.', 'Text header has correct text (if this fails, it may be due to i18n differences)' ); + assert.strictEqual( $aboutLink.length, 1, 'About link created successfully.' ); + assert.strictEqual( $aboutLink.text(), 'Learn more', 'About link has correct text (if this fails, it may be due to i18n differences)' ); + assert.strictEqual( $aboutLink.prop( 'href' ), 'http://mediawiki.org/wiki/Special:MyLanguage/Help:Extension:Media_Viewer', 'About link has correct href (depends on your current protocol, so if you are on https, this will fail).' ); + assert.strictEqual( $submitButton.length, 1, 'Enable button created successfully.' ); assert.strictEqual( $submitButton.text(), 'Enable Media Viewer', 'Enable button has correct text (if this fails, it may be due to i18n differences)' ); -- To view, visit https://gerrit.wikimedia.org/r/168099 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic08af400893950a04489af4b166827d059561974 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/MultimediaViewer Gerrit-Branch: master Gerrit-Owner: MarkTraceur <mtrac...@member.fsf.org> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org> Gerrit-Reviewer: Gilles <gdu...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits