Amire80 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/57032


Change subject: Disable the submit button before the first preview
......................................................................

Disable the submit button before the first preview

This makes the functionality closer to what the bug requested:
"force preview".

This is a follow up to I803484ca2eb768d89d4c6b8172e6aa14b7c3884a.

Bug: 39075
Change-Id: Ic43888d57791e2637c4aa52fc792dccf7fa1fa16
---
M resources/ext.translationnotifications.notifytranslators.js
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslationNotifications 
refs/changes/32/57032/1

diff --git a/resources/ext.translationnotifications.notifytranslators.js 
b/resources/ext.translationnotifications.notifytranslators.js
index 3c12864..9855608 100644
--- a/resources/ext.translationnotifications.notifytranslators.js
+++ b/resources/ext.translationnotifications.notifytranslators.js
@@ -10,7 +10,8 @@
 jQuery( document ).ready( function( $, mw ) {
        'use strict';
 
-       var previewId = 'translation-notification-preview';
+       var previewId = 'translation-notification-preview',
+               sendId = 'translationnotifications-send-notification-button';
 
        // Show a datepicker.
        // Based on UploadWizard.
@@ -40,8 +41,11 @@
        /**
         * Notification preview
         */
-       // Add the preview button
+       // Initially disable the send button to force at least one preview
+       $( '#' + sendId )
+               .prop( 'disabled', true );
 
+       // Add the preview button
        $( '#notifytranslators-form' ).after(
                $( '<button>' )
                        .text( mw.msg( 
'translationnotifications-preview-notification-button' ) )
@@ -55,6 +59,10 @@
                                        $priority = $( '#mw-input-wpPriority 
:selected' ),
                                        deadlineDate = $( 
'#mw-input-wpDeadlineDate' ).val();
 
+                               // Enable the send button after the first 
preview
+                               $( '#' + sendId )
+                                       .prop( 'disabled', false );
+
                                uri.path = mw.config.get( 'wgScript' );
                                uri.query = {
                                        title: 'Special:Translate',

-- 
To view, visit https://gerrit.wikimedia.org/r/57032
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic43888d57791e2637c4aa52fc792dccf7fa1fa16
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslationNotifications
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to