Filip has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/332399 )

Change subject: Added confirmation dialog to delete action.
......................................................................

Added confirmation dialog to delete action.

Bug: T155324
Change-Id: I5bd74d2c22266acd1724a7d53f94096972fc657d
---
M extension.json
M i18n/en.json
M js/QuizGame.js
3 files changed, 25 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuizGame 
refs/changes/99/332399/1

diff --git a/extension.json b/extension.json
index 9ecf76e..7ffc1ed 100644
--- a/extension.json
+++ b/extension.json
@@ -81,11 +81,13 @@
                                "quizgame-lightbox-correct-points", 
"quizgame-lightbox-incorrect-correct",
                                "quizgame-create-edit-picture", "quizgame-edit",
                                "quizgame-ajax-nonnumeric-answer", 
"quizgame-ajax-already-answered",
-                               "quizgame-ajax-invalid-id"
+                               "quizgame-ajax-invalid-id", "quizgame-confirm"
                        ],
                        "dependencies": [
                                "ext.socialprofile.flash",
-                               "ext.socialprofile.LightBox"
+                               "ext.socialprofile.LightBox",
+                               "oojs-ui-core",
+                               "oojs-ui-windows"
                        ],
                        "position": "bottom"
                },
diff --git a/i18n/en.json b/i18n/en.json
index c0e0fec..67c7e03 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -8,6 +8,7 @@
        "quizgame-desc": "Adds an interactive [[Special:QuizGameHome|question 
game]]",
        "quizgame-edit": "Edit",
        "quizgame-delete": "Delete",
+       "quizgame-confirm": "Are you sure?",
        "quizgame-protect": "Protect",
        "quizgame-reinstate": "Re-instate",
        "quizgame-unprotect": "Unprotect",
diff --git a/js/QuizGame.js b/js/QuizGame.js
index 5055584..e7f815a 100644
--- a/js/QuizGame.js
+++ b/js/QuizGame.js
@@ -166,22 +166,26 @@
        },
 
        deleteQuestion: function() {
-               var gameKey = document.getElementById( 'quizGameKey' ).value;
-               var gameId = document.getElementById( 'quizGameId' ).value;
-               jQuery.getJSON(
-                       mw.util.wikiScript( 'api' ), {
-                               format: 'json',
-                               action: 'quizgame',
-                               quizaction: 'deleteItem',
-                               key: gameKey,
-                               id: gameId
-                       },
-                       function( data ) {
-                               document.getElementById( 'ajax-messages' 
).innerHTML = data.quizgame.output + '<br />' + mw.msg( 'quizgame-js-reloading' 
);
-                               document.location = mw.config.get( 
'wgScriptPath' ) +
-                                       
'/index.php?title=Special:QuizGameHome&questionGameAction=launchGame';
+               OO.ui.confirm( mw.msg( 'quizgame-confirm' ) ).done( function ( 
confirmed ) {
+                       if ( confirmed ) {
+                               var gameKey = document.getElementById( 
'quizGameKey' ).value;
+                               var gameId = document.getElementById( 
'quizGameId' ).value;
+                               jQuery.getJSON(
+                                       mw.util.wikiScript( 'api' ), {
+                                               format: 'json',
+                                               action: 'quizgame',
+                                               quizaction: 'deleteItem',
+                                               key: gameKey,
+                                               id: gameId
+                                       },
+                                       function( data ) {
+                                               document.getElementById( 
'ajax-messages' ).innerHTML = data.quizgame.output + '<br />' + mw.msg( 
'quizgame-js-reloading' );
+                                               document.location = 
mw.config.get( 'wgScriptPath' ) +
+                                               
'/index.php?title=Special:QuizGameHome&questionGameAction=launchGame';
+                                       }
+                               );
                        }
-               );
+               } );
        },
 
        showEditMenu: function() {
@@ -756,4 +760,4 @@
                        } );
                } );
        }
-} );
\ No newline at end of file
+} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5bd74d2c22266acd1724a7d53f94096972fc657d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuizGame
Gerrit-Branch: master
Gerrit-Owner: Filip <r...@protonmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to