X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki%2Fmediawiki.feedback.js;h=bfd5c060452dbcde324c82399883def6ef27e040;hb=74136a25a6a7f1b072bbcbf6d487eeee29e9571a;hp=e0785b6100ae36f8c102c8f54593c5b041e19a3e;hpb=2fdcd7bfdd95a3b1515b9a94289d67eb60add484;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki/mediawiki.feedback.js b/resources/src/mediawiki/mediawiki.feedback.js index e0785b6100..bfd5c06045 100644 --- a/resources/src/mediawiki/mediawiki.feedback.js +++ b/resources/src/mediawiki/mediawiki.feedback.js @@ -6,7 +6,6 @@ * @author Moriel Schottlender, 2015 * @since 1.19 */ -/*global OO*/ ( function ( mw, $ ) { /** * This is a way of getting simple feedback from users. It's useful @@ -84,8 +83,7 @@ /** * Respond to dialog submit event. If the information was - * submitted, either successfully or with an error, open - * a MessageDialog to thank the user. + * submitted successfully, open a MessageDialog to thank the user. * * @param {string} [status] A status of the end of operation * of the main feedback dialog. Empty if the dialog was @@ -93,37 +91,36 @@ * to the external task reporting site. */ mw.Feedback.prototype.onDialogSubmit = function ( status ) { - var dialogConfig = {}; - switch ( status ) { - case 'submitted': - dialogConfig = { - title: mw.msg( 'feedback-thanks-title' ), - message: $( '' ).msg( - 'feedback-thanks', - this.feedbackPageTitle.getNameText(), - $( '' ).attr( { - target: '_blank', - href: this.feedbackPageTitle.getUrl() - } ) - ), - actions: [ - { - action: 'accept', - label: mw.msg( 'feedback-close' ), - flags: 'primary' - } - ] - }; - break; + var dialogConfig; + + if ( status !== 'submitted' ) { + return; } + dialogConfig = { + title: mw.msg( 'feedback-thanks-title' ), + message: $( '' ).msg( + 'feedback-thanks', + this.feedbackPageTitle.getNameText(), + $( '' ).attr( { + target: '_blank', + href: this.feedbackPageTitle.getUrl() + } ) + ), + actions: [ + { + action: 'accept', + label: mw.msg( 'feedback-close' ), + flags: 'primary' + } + ] + }; + // Show the message dialog - if ( !$.isEmptyObject( dialogConfig ) ) { - this.constructor.static.windowManager.openWindow( - this.thankYouDialog, - dialogConfig - ); - } + this.constructor.static.windowManager.openWindow( + this.thankYouDialog, + dialogConfig + ); }; /** @@ -237,12 +234,10 @@ classes: [ 'mw-feedbackDialog-welcome-message' ] } ); this.feedbackSubjectInput = new OO.ui.TextInputWidget( { - indicator: 'required', - multiline: false + indicator: 'required' } ); - this.feedbackMessageInput = new OO.ui.TextInputWidget( { - autosize: true, - multiline: true + this.feedbackMessageInput = new OO.ui.MultilineTextInputWidget( { + autosize: true } ); feedbackSubjectFieldLayout = new OO.ui.FieldLayout( this.feedbackSubjectInput, { label: mw.msg( 'feedback-subject' ) @@ -288,14 +283,14 @@ */ mw.Feedback.Dialog.prototype.validateFeedbackForm = function () { var isValid = ( - ( - !this.useragentMandatory || - this.useragentCheckbox.isSelected() - ) && - this.feedbackSubjectInput.getValue() - ); - - this.actions.setAbilities( { submit: isValid } ); + ( + !this.useragentMandatory || + this.useragentCheckbox.isSelected() + ) && + this.feedbackSubjectInput.getValue() + ); + + this.actions.setAbilities( { submit: isValid } ); }; /** @@ -424,14 +419,8 @@ * @return {OO.ui.Error} */ mw.Feedback.Dialog.prototype.getErrorMessage = function () { - switch ( this.status ) { - case 'error1': - case 'error2': - case 'error3': - case 'error4': - // Messages: feedback-error1, feedback-error2, feedback-error3, feedback-error4 - return new OO.ui.Error( mw.msg( 'feedback-' + this.status ) ); - } + // Messages: feedback-error1, feedback-error2, feedback-error3, feedback-error4 + return new OO.ui.Error( mw.msg( 'feedback-' + this.status ) ); }; /** @@ -457,10 +446,10 @@ if ( secondaryCode === 'http' ) { fb.status = 'error3'; // ajax request failed - mw.log.warn( 'Feedback report failed with HTTP error: ' + details.textStatus ); + mw.log.warn( 'Feedback report failed with HTTP error: ' + details.textStatus ); } else { fb.status = 'error2'; - mw.log.warn( 'Feedback report failed with API error: ' + secondaryCode ); + mw.log.warn( 'Feedback report failed with API error: ' + secondaryCode ); } } else { fb.status = 'error1';