jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/333283 )

Change subject: Added confirmation dialogs to 'Un-flag' and 'Delete' actions in 
admin panel
......................................................................


Added confirmation dialogs to 'Un-flag' and 'Delete' actions in admin panel

+ changed unclear 'Reinstate' to 'Un-flag'

Bug: T155322
Change-Id: Ibc9957503ad7d2b7c5b2083536730ec2f2b3ea00
---
M PictureGameHome.body.php
M extension.json
M i18n/en.json
A i18n/qqq.json
M picturegame/PictureGame.js
5 files changed, 49 insertions(+), 13 deletions(-)

Approvals:
  Jack Phoenix: Looks good to me, approved
  SamanthaNguyen: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/PictureGameHome.body.php b/PictureGameHome.body.php
index dbaa320..34e9905 100644
--- a/PictureGameHome.body.php
+++ b/PictureGameHome.body.php
@@ -537,7 +537,7 @@
                                </div>
                                <div class=\"admin-controls\">
                                        <a class=\"picgame-unflag-link\" 
href=\"javascript:void(0)\">" .
-                                               $this->msg( 
'picturegame-adminpanelreinstate' )->text() .
+                                               $this->msg( 
'picturegame-adminpanelunflag' )->text() .
                                        "</a> |
                                        <a class=\"picgame-delete-link\" 
href=\"javascript:void(0);\" data-row-img1=\"{$row->img1}\" 
data-row-img2=\"{$row->img2}\">"
                                                . $this->msg( 
'picturegame-adminpaneldelete' )->text() .
diff --git a/extension.json b/extension.json
index ff58669..5fb2bbb 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
        "name": "PictureGame",
-       "version": "3.4",
+       "version": "3.5",
        "author": [
                "Aaron Wright",
                "Ashish Datta",
@@ -56,11 +56,16 @@
                                "picturegame-js-error-upload-imgone",
                                "picturegame-js-error-upload-imgtwo", 
"picturegame-js-editing-imgone",
                                "picturegame-js-editing-imgtwo", 
"picturegame-protectimgconfirm",
-                               "picturegame-flagimgconfirm"
+                               "picturegame-flagimgconfirm", 
"picturegame-confirm-cancel",
+                               "picturegame-adminpaneldelete-confirm", 
"picturegame-adminpanelunflag-confirm",
+                               "picturegame-adminpaneldelete", 
"picturegame-adminpanelunflag",
+                               "picturegame-adminpaneldelete-confirm", 
"picturegame-confirm-cancel"
                        ],
                        "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 e2fd3e2..1e65ba1 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -20,8 +20,11 @@
        "picturegame-adminpaneltitle": "Picture Game Admin Panel",
        "picturegame-adminpanelflagged": "Flagged Images:",
        "picturegame-adminpanelprotected": "Protected Images:",
-       "picturegame-adminpanelreinstate": "Reinstate",
+       "picturegame-adminpanelunflag": "Un-flag",
+       "picturegame-adminpanelunflag-confirm": "Are you sure you want to 
un-flag this picture game?",
        "picturegame-adminpaneldelete": "Delete",
+       "picturegame-adminpaneldelete-confirm": "Are you sure you want to 
delete this picture game?",
+       "picturegame-confirm-cancel": "Cancel",
        "picturegame-adminpanelunprotect": "Unprotect",
        "picturegame-adminpanelbacktogame": "&lt; Back to the Picture Game",
        "picturegame-creategametitle": "Create a Picture Game",
diff --git a/i18n/qqq.json b/i18n/qqq.json
new file mode 100644
index 0000000..37d177e
--- /dev/null
+++ b/i18n/qqq.json
@@ -0,0 +1,8 @@
+{
+    "@metadata": {
+        "authors": []
+    },
+    "picturegame-adminpanelunflag-confirm": "Confirmation message shown in the 
un-flag dialog.",
+    "picturegame-confirm-cancel": "Cancel button message shown in dialogs",
+    "picturegame-adminpanelunflag-confirm": "Confirmation message shown in the 
delete dialog."
+}
diff --git a/picturegame/PictureGame.js b/picturegame/PictureGame.js
index c4d1355..920af11 100644
--- a/picturegame/PictureGame.js
+++ b/picturegame/PictureGame.js
@@ -447,18 +447,38 @@
 };
 
 jQuery( function() {
-       // Handle clicks on "Reinstate" links on the admin panel
+       // Handle clicks on "Un-flag" links on the admin panel
        jQuery( 'div.admin-controls a.picgame-unflag-link' ).on( 'click', 
function() {
-               PictureGame.unflag( jQuery( this ).parent().parent().attr( 'id' 
) );
+               var options = {
+                       actions: [
+                               { label: mw.msg( 'picturegame-confirm-cancel' ) 
},
+                               { label: mw.msg( 'picturegame-adminpanelunflag' 
), action: 'accept', flags: ['constructive'] }
+                       ]
+               };
+               OO.ui.confirm( mw.msg( 'picturegame-adminpanelunflag-confirm' 
), options ).done( function ( confirmed ) {
+                       if ( confirmed ) {
+                               PictureGame.unflag( jQuery( this 
).parent().parent().attr( 'id' ) );
+                       }
+               } );
        } );
 
        // Handle clicks on "Delete" links on the admin panel
        jQuery( 'div.admin-controls a.picgame-delete-link' ).on( 'click', 
function() {
-               PictureGame.deleteimg(
-                       jQuery( this ).parent().parent().attr( 'id' ),
-                       jQuery( this ).data( 'row-img1' ),
-                       jQuery( this ).data( 'row-img2' )
-               );
+               var options = {
+                       actions: [
+                               { label: mw.msg( 'picturegame-confirm-cancel' ) 
},
+                               { label: mw.msg( 'picturegame-adminpaneldelete' 
), action: 'accept', flags: ['destructive'] }
+                       ]
+               };
+               OO.ui.confirm( mw.msg( 'picturegame-adminpaneldelete-confirm' 
), options ).done( function ( confirmed ) {
+                       if ( confirmed ) {
+                               PictureGame.deleteimg(
+                                       jQuery( this ).parent().parent().attr( 
'id' ),
+                                       jQuery( this ).data( 'row-img1' ),
+                                       jQuery( this ).data( 'row-img2' )
+                               );
+                       }
+               } );
        } );
 
        // Handle clicks on "Unprotect" links on the admin panel
@@ -531,4 +551,4 @@
                        PictureGame.doHover( 'imageTwo' );
                }
        } );
-} );
\ No newline at end of file
+} );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc9957503ad7d2b7c5b2083536730ec2f2b3ea00
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/PictureGame
Gerrit-Branch: master
Gerrit-Owner: Filip <r...@protonmail.com>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: SamanthaNguyen <samanthanguyen1...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to