X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fsrc%2Fmediawiki%2Fmediawiki.feedback.js;h=bfd5c060452dbcde324c82399883def6ef27e040;hb=2fb365e2e8ef5eb83399edffcba4ad5151118cd9;hp=6abdf8387763701090ea56c906ac0979f309f43e;hpb=735c32ffe2ee17e7287270a9f1d8af99a52d827b;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki/mediawiki.feedback.js b/resources/src/mediawiki/mediawiki.feedback.js index 6abdf83877..bfd5c06045 100644 --- a/resources/src/mediawiki/mediawiki.feedback.js +++ b/resources/src/mediawiki/mediawiki.feedback.js @@ -83,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 @@ -92,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 + ); }; /** @@ -236,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' ) @@ -287,12 +283,12 @@ */ mw.Feedback.Dialog.prototype.validateFeedbackForm = function () { var isValid = ( - ( - !this.useragentMandatory || - this.useragentCheckbox.isSelected() - ) && - this.feedbackSubjectInput.getValue() - ); + ( + !this.useragentMandatory || + this.useragentCheckbox.isSelected() + ) && + this.feedbackSubjectInput.getValue() + ); this.actions.setAbilities( { submit: isValid } ); }; @@ -423,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 ) ); }; /**