r110197 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110196‎ | r110197 | r110198 >
Date:00:40, 28 January 2012
Author:rsterbin
Status:ok
Tags:aft 
Comment:
Delete/Undelete is now a toggle:
- ArticleFeedbackv5.i18n.php:
- Removed old messages
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js:
- Updated setBinds() to make delete work as a toggle
- Updated flagFeedback() to change the link text on delete/undelete
- api/ApiViewFeedbackArticleFeedbackv5.php:
- Removed undelete link class/id
- ArticleFeedbackv5.hooks.php:
- Updated to send 'articlefeedbackv5-form-delete' and
'articlefeedbackv5-form-undelete' to the special js
- Dropped 'articlefeedbackv5-delete-saved',
'articlefeedbackv5-undelete-saved',
'articlefeedbackv5-oversight-saved', and
'articlefeedbackv5-unoversight-saved' from the special js
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -97,11 +97,7 @@
9898 'articlefeedbackv5-form5-header' => '{{GENDER:$1|$1}} rated this page:',
9999 'articlefeedbackv5-form-not-shown' => '{{GENDER:$1|$1}} was not shown a feedback form.',
100100 'articlefeedbackv5-form-invalid' => 'Invalid feedback form ID.',
101 - 'articlefeedbackv5-delete-saved' => 'Feedback deleted',
102101 'articlefeedbackv5-abuse-saved' => 'Flagged as abuse',
103 - 'articlefeedbackv5-unhelpful-saved' => 'No',
104 - 'articlefeedbackv5-helpful-saved' => 'Yes',
105 - 'articlefeedbackv5-undelete-saved' => 'Feedback shown',
106102 'articlefeedbackv5-oversight-saved' => 'Marked for oversight',
107103 'articlefeedbackv5-unoversight-saved' => 'Oversight flag removed',
108104 'articlefeedbackv5-error-loading-feedback' => 'Error loading feedback',
@@ -354,7 +350,6 @@
355351 'articlefeedbackv5-form2-header-suggestion' => 'Parameters:
356352 * $1 is a user name.',
357353 'articlefeedbackv5-form4-header' => 'Messages in the feedback dashboard to indicate that a user was only presented with a Call To Action form. This is a feedback form that asks a user to do something, rather than provide feedback.',
358 - 'articlefeedbackv5-unhelpful-saved' => '{{Identical|No}}',
359354 'articlefeedbackv5-oversight-saved' => 'Oversight request saved successfully',
360355 'articlefeedbackv5-unoversight-saved' => 'Request for oversight removed successfully',
361356 'articlefeedbackv5-discussion-page' => '{{Identical|Discussion}}',
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -178,7 +178,7 @@
179179 } )
180180 } );
181181
182 - // Flag as abuse
 182+ // Flag/Unflag as abuse
183183 $( '.articleFeedbackv5-abuse-link' ).live( 'click', function( e ) {
184184 e.preventDefault();
185185 var $l = $( e.target );
@@ -207,11 +207,17 @@
208208 }
209209 } );
210210
211 - $.each( ['undelete', 'oversight', 'delete', 'unoversight'], function ( index, value ) {
212 - $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) {
213 - e.preventDefault();
214 - $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-' + value + '-link-' ), value, 1 );
215 - } )
 211+ // Delete/Undelete this post
 212+ $( '.articleFeedbackv5-delete-link' ).live( 'click', function( e ) {
 213+ e.preventDefault();
 214+ var $l = $( e.target );
 215+ var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' );
 216+ var activity = $.articleFeedbackv5special.getActivity( id );
 217+ if ( activity.delete ) {
 218+ $.articleFeedbackv5special.flagFeedback( id, 'delete', -1 );
 219+ } else {
 220+ $.articleFeedbackv5special.flagFeedback( id, 'delete', 1 );
 221+ }
216222 } );
217223 }
218224
@@ -465,9 +471,13 @@
466472 $l.text( mw.msg( 'articlefeedbackv5-form-hide' ) );
467473 $.articleFeedbackv5special.unmarkHidden( $l.closest( '.articleFeedbackv5-feedback' ) );
468474 }
469 - } else {
470 - msg = 'articlefeedbackv5-' + type + '-saved';
471 - $( '#articleFeedbackv5-' + type + '-link-' + id ).text( mw.msg( msg ) );
 475+ } else if ( 'delete' == type ) {
 476+ var $l = $( '#articleFeedbackv5-delete-link-' + id );
 477+ if ( dir > 0 ) {
 478+ $l.text( mw.msg( 'articlefeedbackv5-form-undelete' ) );
 479+ } else {
 480+ $l.text( mw.msg( 'articlefeedbackv5-form-delete' ) );
 481+ }
472482 }
473483 // Save activity
474484 if ( !( id in $.articleFeedbackv5special.activity ) ) {
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
@@ -436,15 +436,15 @@
437437 }
438438
439439 if ( $can_delete ) {
440 - # delete
441 - $link = 'delete';
442440 if ( $record[0]->af_is_deleted > 0 ) {
443 - $link = 'undelete';
 441+ $msg = 'undelete';
 442+ } else {
 443+ $msg = 'delete';
444444 }
445445 $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array(
446 - 'id' => "articleFeedbackv5-$link-link-$id",
447 - 'class' => "articleFeedbackv5-$link-link"
448 - ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_is_deleted )->text() ) );
 446+ 'id' => "articleFeedbackv5-delete-link-$id",
 447+ 'class' => "articleFeedbackv5-delete-link"
 448+ ), wfMessage( "articlefeedbackv5-form-" . $msg )->text() ) );
449449 }
450450
451451 /*
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -169,11 +169,9 @@
170170 'articlefeedbackv5-abuse-saved',
171171 'articlefeedbackv5-form-hide',
172172 'articlefeedbackv5-form-unhide',
 173+ 'articlefeedbackv5-form-delete',
 174+ 'articlefeedbackv5-form-undelete',
173175 'articlefeedbackv5-hidden',
174 - 'articlefeedbackv5-delete-saved',
175 - 'articlefeedbackv5-undelete-saved',
176 - 'articlefeedbackv5-oversight-saved',
177 - 'articlefeedbackv5-unoversight-saved',
178176 'articlefeedbackv5-comment-more',
179177 'articlefeedbackv5-comment-less'
180178 ),

Status & tagging log