Anomie has uploaded a new change for review.

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


Change subject: Make ManageMyGrants look more like /authorize
......................................................................

Make ManageMyGrants look more like /authorize

* Instead of radio buttons to select "update" or "revoke", use two
  separate buttons.
* Rearrange fields to match the order on /authorize
* Make description text rather than a read-only form field
* Remove "consumer key" field

Bug: 53964
Change-Id: Ifea6f6195a959444ca69c3ea30215d4169fad950
---
M frontend/specialpages/SpecialMWOAuthManageMyGrants.php
1 file changed, 24 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth 
refs/changes/49/83849/1

diff --git a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php 
b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
index f5fd6a2..2a0d460 100644
--- a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
+++ b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
@@ -139,17 +139,20 @@
                                        'label-message' => 
'mwoauth-consumer-version',
                                        'default' => $cmr->get( 'version' )
                                ),
-                               'consumerKey' => array(
-                                       'type' => 'info',
-                                       'label-message' => 
'mwoauth-consumer-key',
-                                       'default' => $cmr->get( 'consumerKey' )
-                               ),
                                'description' => array(
-                                       'type' => 'textarea',
+                                       'type' => 'info',
                                        'label-message' => 
'mwoauth-consumer-description',
                                        'default' => $cmr->get( 'description' ),
-                                       'readonly' => true,
-                                       'rows' => 5
+                               ),
+                               'usedOnWiki' => array(
+                                       'type' => 'info',
+                                       'label-message' => 
'mwoauth-consumer-wiki',
+                                       'default' => $cmr->get( 'wiki' )
+                               ),
+                               'wiki' => array(
+                                       'type' => 'text',
+                                       'label-message' => 
'mwoauthmanagemygrants-wikiallowed',
+                                       'default' => $cmra->get( 'wiki' )
                                ),
                                'grants'  => array(
                                        'type' => 'checkmatrix',
@@ -177,24 +180,6 @@
                                                )
                                        )
                                ),
-                               'usedOnWiki' => array(
-                                       'type' => 'info',
-                                       'label-message' => 
'mwoauth-consumer-wiki',
-                                       'default' => $cmr->get( 'wiki' )
-                               ),
-                               'wiki' => array(
-                                       'type' => 'text',
-                                       'label-message' => 
'mwoauthmanagemygrants-wikiallowed',
-                                       'default' => $cmra->get( 'wiki' )
-                               ),
-                               'action' => array(
-                                       'type' => 'radio',
-                                       'label-message' => 
'mwoauthmanagemygrants-action',
-                                       'required' => true,
-                                       'options' => array(
-                                               $this->msg( 
'mwoauthmanagemygrants-update' )->escaped() => 'update',
-                                               $this->msg( 
'mwoauthmanagemygrants-renounce' )->escaped() => 'renounce' )
-                               ),
                                'acceptanceId' => array(
                                        'type' => 'hidden',
                                        'default' => $cmra->get( 'id' )
@@ -204,7 +189,13 @@
                );
                $act = null;
                $form->setSubmitCallback( function( array $data, IContextSource 
$context ) use ( &$act ) {
-                       $act = $data['action']; // this will be valid on success
+                       $request = $this->getRequest();
+                       if ( $request->getCheck( 'update' ) ) {
+                               $data['action'] = $act = 'update';
+                       }
+                       if ( $request->getCheck( 'renounce' ) ) {
+                               $data['action'] = $act = 'renounce';
+                       }
                        $data['grants'] = FormatJSON::encode( // adapt form to 
controller
                                preg_replace( '/^grant-/', '', $data['grants'] 
) );
 
@@ -214,7 +205,12 @@
                } );
 
                $form->setWrapperLegendMsg( 
'mwoauthmanagemygrants-confirm-legend' );
-               $form->setSubmitTextMsg( 'mwoauthmanagemygrants-confirm-submit' 
);
+               $opts = array(
+                       'class' => 'mw-htmlform-submit',
+               );
+               $form->suppressDefaultSubmit();
+               $form->addButton( 'update', $this->msg( 
'mwoauthmanagemygrants-update' )->escaped(), null, $opts );
+               $form->addButton( 'renounce', $this->msg( 
'mwoauthmanagemygrants-renounce' )->escaped(), null, $opts );
                $form->addPreText(
                        $this->msg( 'mwoauthmanagemygrants-confirm-text' 
)->parseAsBlock() );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifea6f6195a959444ca69c3ea30215d4169fad950
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>

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

Reply via email to