r99131 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99130‎ | r99131 | r99132 >
Date:19:57, 6 October 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
* Cleaned up "cancel" button on review form to only show on diffs
* Review form HTML/CSS cleanup
Modified paths:
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/RevisionReviewFormUI.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.css (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php
@@ -1086,7 +1086,7 @@
10871087 }
10881088 # Build the review form as needed
10891089 if ( $rev && ( !$this->diffRevs || $this->isReviewableDiff ) ) {
1090 - $form = new RevisionReviewFormUI( $reqUser, $this->article, $rev );
 1090+ $form = new RevisionReviewFormUI( $this->getContext(), $this->article, $rev );
10911091 # Default tags and existence of "reject" button depend on context
10921092 if ( $this->diffRevs ) {
10931093 $form->setDiffPriorRev( $this->diffRevs['old'] );
Index: trunk/extensions/FlaggedRevs/presentation/RevisionReviewFormUI.php
@@ -15,12 +15,13 @@
1616
1717 /**
1818 * Generates a brief review form for a page
19 - * @param User $user
 19+ * @param RequestContext $context
2020 * @param FlaggedPage $article
2121 * @param Revision $rev
2222 */
23 - public function __construct( User $user, FlaggedPage $article, Revision $rev ) {
24 - $this->user = $user;
 23+ public function __construct( IContextSource $context, FlaggedPage $article, Revision $rev ) {
 24+ $this->user = $context->getUser();
 25+ $this->request = $context->getRequest();
2526 $this->article = $article;
2627 $this->rev = $rev;
2728 }
@@ -142,7 +143,7 @@
143144 } else {
144145 list( $u, $ts ) = FRUserActivity::getUserReviewingPage( $this->rev->getPage() );
145146 }
146 - $form .= "<p>";
 147+ $form .= Xml::openElement( 'p' );
147148 // Page under review (and not by this user)...
148149 if ( $u !== null && $u != $this->user->getName() ) {
149150 $form .= '<span class="fr-under-review">';
@@ -156,64 +157,69 @@
157158 } elseif ( !$frev ) { // rev not already reviewed
158159 $form .= '<span id="mw-fr-reviewing-status" style="display:none;"></span>'; // JS widget
159160 }
160 - $form .= "</p>\n";
 161+ $form .= Xml::closeElement( 'p' ) . "\n";
161162
162 - if ( $disabled ) {
163 - $form .= Xml::openElement( 'div', array( 'class' => 'fr-rating-controls-disabled',
164 - 'id' => 'fr-rating-controls-disabled' ) ) . "\n";
165 - } else {
166 - $form .= Xml::openElement( 'div', array( 'class' => 'fr-rating-controls',
167 - 'id' => 'fr-rating-controls' ) ) . "\n";
168 - }
 163+ # Start rating controls
 164+ $css = $disabled ? 'fr-rating-controls-disabled' : 'fr-rating-controls';
 165+ $form .= Xml::openElement( 'p', array( 'class' => $css, 'id' => 'fr-rating-controls') ) . "\n";
169166
170167 # Add main checkboxes/selects
171168 $form .= Xml::openElement( 'span',
172169 array( 'id' => 'mw-fr-ratingselects', 'class' => 'fr-rating-options' ) ) . "\n";
173 - $form .= self::ratingInputs( $this->user, $flags, (bool)$disabled, (bool)$frev );
 170+ $form .= self::ratingInputs( $this->user, $flags, (bool)$disabled, (bool)$frev ) . "\n";
174171 $form .= Xml::closeElement( 'span' ) . "\n";
175172
176 - # Get the file version used for File: pages as needed
177 - $fileKey = $this->getFileVersion();
178 - # Get template/file version info as needed
179 - list( $templateIDs, $imageSHA1Keys ) = $this->getIncludeVersions();
180 - # Convert these into flat string params
181 - list( $templateParams, $imageParams, $fileVersion ) =
182 - RevisionReviewForm::getIncludeParams( $templateIDs, $imageSHA1Keys, $fileKey );
 173+ # Don't put buttons & comment field on the same line as tag inputs.
 174+ if ( !$disabled && !FlaggedRevs::binaryFlagging() ) { // $disabled => no comment/buttons
 175+ $form .= "<br />";
 176+ }
183177
184 - $form .= Xml::openElement( 'span',
185 - array( 'style' => 'white-space: nowrap;' ) ) . "\n";
 178+ # Start comment & buttons
 179+ $form .= Xml::openElement( 'span', array( 'id' => 'mw-fr-confirmreview' ) ) . "\n";
 180+
186181 # Hide comment input if needed
187182 if ( !$disabled ) {
188 - if ( count( FlaggedRevs::getTags() ) > 1 ) {
189 - $form .= "<br />"; // Don't put too much on one line
190 - }
191 - $form .= "<span id='mw-fr-commentbox' style='clear:both'>" .
192 - Xml::inputLabel( wfMsg( 'revreview-log' ), 'wpReason', 'wpReason', 40, '',
193 - array( 'maxlength' => 255, 'class' => 'fr-comment-box' ) ) .
194 - "&#160;&#160;&#160;</span>\n";
 183+ $form .= Xml::inputLabel(
 184+ wfMsg( 'revreview-log' ), 'wpReason', 'wpReason', 40, '',
 185+ array( 'maxlength' => 255, 'id' => 'mw-fr-commentbox', 'class' => 'fr-comment-box' )
 186+ );
 187+ $form .= "&#160;&#160;&#160;" . "\n";
195188 }
196 - # Determine if there will be reject button
197 - $rejectId = $this->rejectRefRevId();
198189
199 - # Add the submit buttons
 190+ # Add the submit buttons...
 191+ $rejectId = $this->rejectRefRevId(); // determine if there will be reject button
200192 $form .= self::submitButtons( $rejectId, $frev, (bool)$disabled, $reviewIncludes );
201 - # Add "cancel" link
202 - $form .= Linker::link( $article->getTitle(), wfMsg( 'revreview-cancel' ) );
 193+ if ( $this->request->getVal( 'diff' ) ) {
 194+ $form .= Linker::link( $this->article->getTitle(), wfMsg( 'revreview-cancel' ) );
 195+ }
203196
204197 # Show stability log if there is anything interesting...
205198 if ( $article->isPageLocked() ) {
206199 $form .= ' ' . FlaggedRevsXML::logToggle( 'revreview-log-toggle-show' );
207200 }
208 - $form .= Xml::closeElement( 'span' ) . "\n";;
 201+
 202+ # End comment & buttons
 203+ $form .= Xml::closeElement( 'span' ) . "\n";
 204+
209205 # ..add the actual stability log body here
210 - if ( $article->isPageLocked() ) {
 206+ if ( $article->isPageLocked() ) {
211207 $form .= FlaggedRevsXML::stabilityLogExcerpt( $article );
212208 }
213 - $form .= Xml::closeElement( 'div' ) . "\n";
214209
 210+ # End rating controls
 211+ $form .= Xml::closeElement( 'p' ) . "\n";
 212+
215213 # Show explanatory text
216214 $form .= $this->bottomNotice;
217215
 216+ # Get the file version used for File: pages as needed
 217+ $fileKey = $this->getFileVersion();
 218+ # Get template/file version info as needed
 219+ list( $templateIDs, $imageSHA1Keys ) = $this->getIncludeVersions();
 220+ # Convert these into flat string params
 221+ list( $templateParams, $imageParams, $fileVersion ) =
 222+ RevisionReviewForm::getIncludeParams( $templateIDs, $imageSHA1Keys, $fileKey );
 223+
218224 # Hidden params
219225 $form .= Html::hidden( 'title', $reviewTitle->getPrefixedText() ) . "\n";
220226 $form .= Html::hidden( 'target', $article->getTitle()->getPrefixedDBKey() ) . "\n";
Index: trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.css
@@ -317,8 +317,12 @@
318318 color: GrayText;
319319 }
320320
 321+#mw-fr-confirmreview {
 322+ white-space: nowrap;
 323+}
321324 .fr-rating-options {
322325 margin-right: 1.5em;
 326+ white-space: nowrap;
323327 }
324328
325329 .fr-rating-option-0 {

Follow-up revisions

RevisionCommit summaryAuthorDate
r99177Followup to r99131: Provide mw-fr-comment-box id to hide the comment box....saper00:58, 7 October 2011

Comments

#Comment by Saper (talk | contribs)   08:00, 7 October 2011

r99182 removes the "Cancel" link in trunk

Status & tagging log