r105570 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105569‎ | r105570 | r105571 >
Date:18:13, 8 December 2011
Author:jeroendedauw
Status:reverted
Tags:
Comment:
Follow up to r105567;
Modified paths:
  • /trunk/extensions/Reviews/Reviews.hooks.php (modified) (history)
  • /trunk/extensions/Reviews/includes/ReviewControl.php (modified) (history)
  • /trunk/extensions/Reviews/resources/jquery.reviewControl.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Reviews/includes/ReviewControl.php
@@ -1,12 +1,25 @@
22 <?php
33
 4+/**
 5+ * Review control.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file ReviewsControl.php
 10+ * @ingroup Reviews
 11+ *
 12+ * @licence GNU GPL v3+
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
415 class ReviewControl {
516
617 protected $review;
718 protected $context;
 19+ protected $reload;
820
9 - public function __construct( Review $review = null ) {
 21+ public function __construct( Review $review = null, $reload = false ) {
1022 $this->review = $review;
 23+ $this->reload = $reload;
1124 }
1225
1326 public function addToContext( ContextSource &$context = null ) {
@@ -38,7 +51,7 @@
3952 'rating' => 0,
4053 'ratings' => $ratings
4154 );
42 - }
 55+ }
4356 else {
4457 $out->addHTML( Html::element( 'h2', array( 'id' => 'reviews-edit' ), wfMsg( 'reviews-submission-edit-title' ) ) );
4558
@@ -46,8 +59,11 @@
4760 }
4861
4962 $attribs['data-review'] = FormatJson::encode( $review );
50 - $attribs['data-reload-target'] = $context->getTitle()->getLocalURL( array( 'action' => 'refresh' ) );
5163
 64+ if ( $this->reload ) {
 65+ $attribs['data-reload-target'] = $context->getTitle()->getLocalURL( array( 'action' => 'purge' ) );
 66+ }
 67+
5268 $out->addHTML( Html::element( 'div', $attribs ) );
5369 }
5470
Index: trunk/extensions/Reviews/resources/jquery.reviewControl.js
@@ -178,7 +178,10 @@
179179 // _this.successMessage.fadeOut( 'slow' );
180180 // }, 60000 );
181181 } );
182 - window.location = _this.reloadTarget;
 182+
 183+ if ( _this.reloadTarget !== undefined ) {
 184+ window.location = _this.reloadTarget;
 185+ }
183186 }
184187 else {
185188 alert( 'Review could not be saved' ); // TODO
Index: trunk/extensions/Reviews/Reviews.hooks.php
@@ -191,7 +191,8 @@
192192 ) );
193193
194194 if ( $review === false || $user->getOption( 'reviews_showedit' ) ) {
195 - $control = new ReviewControl( $review === false ? null : $review );
 195+ $review = $review === false ? null : $review;
 196+ $control = new ReviewControl( $review, true );
196197 $control->addToContext( $out );
197198 }
198199 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105567layout tweaks and cleanupjeroendedauw17:50, 8 December 2011

Status & tagging log