mw.Feedback: Terms of use always appended and allows for link
authorMoriel Schottlender <moriel@gmail.com>
Fri, 6 Mar 2015 01:42:38 +0000 (17:42 -0800)
committerJforrester <jforrester@wikimedia.org>
Fri, 6 Mar 2015 01:45:21 +0000 (01:45 +0000)
Bring the terms of use link outside of the general checkbox message
and have it appear regardless of whether the checkbox is shown.
Also make sure it is parsed correctly if/when it has a link.

Change-Id: Ic1072690e33927e472f8ba529b16fa32280a6abc

resources/src/mediawiki/mediawiki.feedback.js

index 227d129..9a671c0 100644 (file)
@@ -48,8 +48,7 @@
         * @cfg {boolean} [showUseragentCheckbox=false] Show a Useragent agreement checkbox as part of the form.
         * @cfg {boolean} [useragentCheckboxMandatory=false] Make the Useragent checkbox mandatory.
         * @cfg {string|jQuery} [useragentCheckboxMessage] Supply a custom message for the useragent checkbox.
-        *  defaults to a combination of 'feedback-terms' and 'feedback-termsofuse' which includes a link to the
-        *  wiki's Term of Use page.
+        *  defaults to the message 'feedback-terms'.
         */
        mw.Feedback = function MwFeedback( config ) {
                config = config || {};
@@ -68,9 +67,7 @@
                this.useragentCheckboxShow = !!config.showUseragentCheckbox;
                this.useragentCheckboxMandatory = !!config.useragentCheckboxMandatory;
                this.useragentCheckboxMessage = config.useragentCheckboxMessage ||
-                       $( '<p>' )
-                               .append( mw.msg( 'feedback-terms' ) )
-                               .add( $( '<p>' ).append( mw.message( 'feedback-termsofuse' ).parse() ) );
+                       $( '<p>' ).append( mw.msg( 'feedback-terms' ) );
 
                // Message dialog
                this.thankYouDialog = new OO.ui.MessageDialog();
         */
        mw.Feedback.Dialog.prototype.initialize = function () {
                var feedbackSubjectFieldLayout, feedbackMessageFieldLayout,
-                       feedbackFieldsetLayout;
+                       feedbackFieldsetLayout, termsOfUseLabel;
 
                // Parent method
                mw.Feedback.Dialog.super.prototype.initialize.call( this );
                        align: 'inline'
                } );
 
+               termsOfUseLabel = new OO.ui.LabelWidget( {
+                       classes: [ 'mw-feedbackDialog-feedback-termsofuse' ],
+                       label: $( '<p>' ).append( mw.msg( 'feedback-termsofuse' ) )
+               } );
+
                this.feedbackPanel.$element.append(
                        this.feedbackMessageLabel.$element,
                        feedbackFieldsetLayout.$element,
-                       this.useragentFieldLayout.$element
+                       this.useragentFieldLayout.$element,
+                       termsOfUseLabel.$element
                );
 
                // Events
                                if ( settings.useragentCheckbox.show ) {
                                        this.useragentFieldLayout.setLabel( settings.useragentCheckbox.message );
                                }
+
                                this.useragentMandatory = settings.useragentCheckbox.mandatory;
                                this.useragentFieldLayout.toggle( settings.useragentCheckbox.show );