Filip has uploaded a new change for review. ( 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' Change-Id: Ibc9957503ad7d2b7c5b2083536730ec2f2b3ea00 --- M PictureGameHome.body.php M extension.json M i18n/en.json M picturegame/PictureGame.js 4 files changed, 40 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PictureGame refs/changes/83/333283/1 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..98b77c2 100644 --- a/extension.json +++ b/extension.json @@ -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": "< Back to the Picture Game", "picturegame-creategametitle": "Create a Picture Game", diff --git a/picturegame/PictureGame.js b/picturegame/PictureGame.js index c4d1355..f7825d3 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: newchange Gerrit-Change-Id: Ibc9957503ad7d2b7c5b2083536730ec2f2b3ea00 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PictureGame 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