r110294 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110293‎ | r110294 | r110295 >
Date:15:20, 30 January 2012
Author:yonishostak
Status:ok (Comments)
Tags:aft 
Comment:
AFTv5: major layout changes in the feedback page, per requirements changes
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -86,8 +86,8 @@
8787 'articlefeedbackv5-form-unoversight' => 'Unmark for oversight',
8888 'articlefeedbackv5-form-undelete' => 'Un-delete (oversight)',
8989 'articlefeedbackv5-form-header' => 'Feedback #$1, at $2',
90 - 'articlefeedbackv5-form1-header-found' => '{{GENDER:$1|$1}} found what they were looking for',
91 - 'articlefeedbackv5-form1-header-not-found' => '{{GENDER:$1|$1}} did not find what they were looking for',
 90+ 'articlefeedbackv5-form1-header-found' => 'found what they were looking for',
 91+ 'articlefeedbackv5-form1-header-not-found' => 'did not find what they were looking for',
9292 'articlefeedbackv5-form2-header-praise' => '{{GENDER:$1|$1}} had a praise:',
9393 'articlefeedbackv5-form2-header-problem' => '{{GENDER:$1|$1}} had a problem:',
9494 'articlefeedbackv5-form2-header-question' => '{{GENDER:$1|$1}} had a question:',
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css
@@ -113,52 +113,33 @@
114114 /*color: #bf0a0a;*/
115115 }
116116 .articleFeedbackv5-feedback .articleFeedbackv5-feedback-tools {
117 - display: none;
 117+ /* display: none; */
 118+ width: 140px;
118119 position: absolute;
119 - top: 0;
 120+ top: 10px;
120121 right: 10px;
121 - width: 140px;
 122+ border: solid 1px #c5c5c5;
122123 }
123124 .articleFeedbackv5-feedback .articleFeedbackv5-feedback-tools h3 {
124 - background: #5171B7;
125 - -moz-border-radius-bottomright: 5px;
126 - -moz-border-radius-bottomleft: 5px;
127 - -webkit-border-bottom-right-radius: 5px;
128 - -webkit-border-bottom-left-radius: 5px;
129 - -ms-border-radius-bottomleft: 5px;
130 - -ms-border-radius-bottomright: 5px;
131 - border-radius-bottomleft: 5px;
132 - border-radius-bottomright: 5px;
133 - color: #fff;
 125+ background: #d2e5f7;
134126 text-align: center;
135127 font-weight: normal;
136128 font-size: 1em;
137 - position: absolute;
138 - z-index: 150;
139129 width: 140px;
140130 height: 20px;
141131 line-height: 15px;
142132 margin: 0;
143133 cursor: pointer;
 134+ display: none;
144135 }
145136 .articleFeedbackv5-feedback .articleFeedbackv5-feedback-tools ul {
146 - position: relative;
147 - padding: 40px 10px 10px;
 137+ padding: 10px 10px 10px;
148138 background: #d2e5f7;
149 - border: solid 1px #c5c5c5;
150 - -moz-border-radius-bottomright: 5px;
151 - -moz-border-radius-bottomleft: 5px;
152 - -webkit-border-bottom-right-radius: 5px;
153 - -webkit-border-bottom-left-radius: 5px;
154 - -ms-border-radius-bottomleft: 5px;
155 - -ms-border-radius-bottomright: 5px;
156 - border-radius-bottomleft: 5px;
157 - border-radius-bottomright: 5px;
158139 margin: 0;
159140 list-style: none;
160141 }
161142 .articleFeedbackv5-feedback .articleFeedbackv5-feedback-tools ul li a:hover {
162 - cursor: pointer;
 143+ cursor: hand;
163144 }
164145 .articleFeedbackv5-feedback:hover {
165146 /*padding: -1px 10px;
@@ -180,6 +161,10 @@
181162 margin: 10px 0;
182163 padding: 0;
183164 font-size: 1.25em;
 165+ display: block;
 166+ float: left;
 167+ clear: left;
 168+ padding-right: 160px;
184169 }
185170 .articleFeedbackv5-feedback .articleFeedbackv5-comment-details {
186171 padding-top: 30px;
@@ -187,8 +172,18 @@
188173 width: 140px;
189174 }
190175 .articleFeedbackv5-feedback .articleFeedbackv5-comment-details-updates {
191 - padding-top: 15px;
 176+ float: right;
 177+ margin-right: 10px;
192178 }
 179+.articleFeedbackv5-comment-details-date {
 180+ float: left;
 181+ clear: right;
 182+ display: block;
 183+ line-height: 24px;
 184+ margin: 0 5px 0 0;
 185+ position: relative;
 186+ top: 18px;
 187+}
193188 #articleFeedbackv5-special-add-feedback {
194189 /*color:white;
195190 display: block;
@@ -208,7 +203,7 @@
209204 clear:both;
210205 }
211206 #articleFeedbackv5-show-feedback .articleFeedbackv5-abuse-link {
212 - margin-left: 150px;
 207+
213208 }
214209 #articleFeedbackv5-show-feedback .articleFeedbackv5-abuse-link.abusive {
215210 color: red;
@@ -216,7 +211,13 @@
217212 #articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot {
218213 line-height: 22px;
219214 float: left;
 215+ width: 520px;
220216 }
 217+.articleFeedbackv5-vote-wrapper {
 218+ float: left;
 219+ width: 100%;
 220+ margin-bottom: 8px;
 221+}
221222 #articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-helpful-caption {
222223 margin: 0 15px 0 0;
223224 }
@@ -266,7 +267,10 @@
267268 color: #888;
268269 }
269270 .articleFeedbackv5-feedback .articleFeedbackv5-comment-wrap h3 {
270 - line-height: 24px;
 271+ display: block;
 272+ float: left;
 273+ width: 520px;
 274+ line-height: 24px;
271275 }
272276 .articleFeedbackv5-feedback .articleFeedbackv5-comment-wrap h3 .icon {
273277 display: inline-block;
@@ -331,6 +335,9 @@
332336 background: url(images/bg-button.png) !important;
333337 color: white !important;
334338 }
 339+.articleFeedbackv5-comment-wrap {
 340+ width: 100%;
 341+}
335342 .articleFeedbackv5-feedback-hidden .articleFeedbackv5-comment-wrap {
336343 opacity : 0.4;
337344 filter: alpha(opacity=40); // msie
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -556,19 +556,6 @@
557557 $( '#articleFeedbackv5-show-feedback' ).append( $newList );
558558 $( '#articleFeedbackv5-feedback-count-total' ).text( data['articlefeedbackv5-view-feedback'].count );
559559 $.articleFeedbackv5special.listControls.continue = data['articlefeedbackv5-view-feedback'].continue;
560 - // set effects on toolboxes
561 - $( '.articleFeedbackv5-feedback-tools > ul' ).hide();
562 - $( '.articleFeedbackv5-feedback-tools' ).hover(
563 - function( eventObj ) {
564 - //alert(this);
565 - var id = $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-feedback-tools-' );
566 - $( '#articleFeedbackv5-feedback-tools-list-' + id ).slideDown( 200 );
567 - },
568 - function( eventObj ) {
569 - var id = $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-feedback-tools-' );
570 - $( '#articleFeedbackv5-feedback-tools-list-' + id ).slideUp( 200 );
571 - }
572 - );
573560 } else {
574561 $( '#articleFeedbackv5-show-feedback' ).text( mw.msg( 'articlefeedbackv5-error-loading-feedback' ) );
575562 }
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php
@@ -271,14 +271,14 @@
272272 $wgHooks['ArticleSaveComplete'][] = 'ArticleFeedbackv5Hooks::trackEditSuccess';
273273
274274 // API Registration
275 -#$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5';
276 -#$wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5';
277 -#$wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5';
 275+$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5';
 276+$wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5';
 277+$wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5';
278278 $wgAPIModules['articlefeedbackv5'] = 'ApiArticleFeedbackv5';
279279
280280 // Special Page
281 -#$wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5';
282 -#$wgSpecialPageGroups['ArticleFeedbackv5'] = 'other';
 281+$wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5';
 282+$wgSpecialPageGroups['ArticleFeedbackv5'] = 'other';
283283
284284 $wgAvailableRights[] = 'aftv5-hide-feedback';
285285 $wgAvailableRights[] = 'aftv5-delete-feedback';
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
@@ -315,37 +315,9 @@
316316 $can_hide = $wgUser->isAllowed( 'aftv5-hide-feedback' );
317317 $can_delete = $wgUser->isAllowed( 'aftv5-delete-feedback' );
318318
319 - // Taken from the Moodbar extension.
320 - $now = wfTimestamp( TS_UNIX );
321 - $timestamp = wfTimestamp( TS_UNIX, $record[0]->af_created );
322 - $date;
323 -
324 - // Relative dates for 48 hours, normal timestamps later.
325 - if ( $timestamp > ( $now - ( 86400 * 2 ) ) ) {
326 - $time = $wgLang->formatTimePeriod(
327 - ( $now - $timestamp ), 'avoidseconds'
328 - );
329 - $date = wfMessage( 'articleFeedbackv5-comment-ago', $time )->escaped();
330 - } elseif( $timestamp ) {
331 - $date = $wgLang->timeanddate($record[0]->af_created );
332 - }
333 -
334319 $details = Html::openElement( 'div', array(
335 - 'class' => 'articleFeedbackv5-comment-details'
336 - ) )
337 - . Html::openElement( 'div', array(
338 - 'class' => 'articleFeedbackv5-comment-details-date'
339 - ) )
340 - . Html::element( 'a', array(
341 - 'class' => 'articleFeedbackv5-permalink',
342 - 'id' => "articleFeedbackv5-permalink-$id",
343 - 'href' => "#id=$id"
344 - ), $date )
345 - . Html::closeElement( 'div' )
346 - . Html::openElement( 'div', array(
347320 'class' => 'articleFeedbackv5-comment-details-updates'
348321 ) );
349 -
350322 if( $record[0]->age > 0 ) {
351323 $details .= Linker::link(
352324 Title::newFromText( $record[0]->page_title ),
@@ -358,14 +330,12 @@
359331 )
360332 );
361333 }
 334+ $details .= Html::closeElement( 'div' );
362335
363 - $details .= Html::closeElement( 'div' )
364 - . Html::closeElement( 'div' );
365 -
366336 $footer_links = Html::openElement( 'div', array(
367337 'class' => 'articleFeedbackv5-vote-wrapper'
368338 ) )
369 - . Html::openElement( 'p', array( 'class' => 'articleFeedbackv5-comment-foot' ) );
 339+ . Html::openElement( 'div', array( 'class' => 'articleFeedbackv5-comment-foot' ) );
370340
371341 if ( $can_vote ) {
372342 $footer_links .= Html::element( 'span', array(
@@ -384,6 +354,7 @@
385355 'class' => 'articleFeedbackv5-helpful-votes',
386356 'id' => "articleFeedbackv5-helpful-votes-$id"
387357 ), wfMessage( 'articlefeedbackv5-form-helpful-votes', $record[0]->af_helpful_count, $record[0]->af_unhelpful_count ) );
 358+ $footer_links .= Html::closeElement( 'div' );
388359 if ( $can_flag ) {
389360 $aclass = 'articleFeedbackv5-abuse-link';
390361 global $wgArticleFeedbackv5AbusiveThreshold;
@@ -395,8 +366,7 @@
396367 'class' => $aclass
397368 ), wfMessage( 'articlefeedbackv5-form-abuse', $record[0]->af_abuse_count )->text() );
398369 }
399 - $footer_links .= Html::closeElement( 'p' )
400 - . Html::closeelement( 'div' );
 370+ $footer_links .= $details . Html::closeElement( 'div' );
401371
402372 /*$footer_links .= Html::element( 'span', array(
403373 'class' => 'articleFeedbackv5-helpful-votes'
@@ -486,11 +456,42 @@
487457 . $content
488458 . $footer_links
489459 . Html::closeElement( 'div' )
490 - . $details
 460+ //. $details
491461 . $tools
492462 . Html::closeElement( 'div' );
493463 }
 464+
 465+ private function renderPermalinkTimestamp( $record ) {
 466+ global $wgLang;
 467+ $id = $record->af_id;
 468+
 469+ // Taken from the Moodbar extension.
 470+ $now = wfTimestamp( TS_UNIX );
 471+ $timestamp = wfTimestamp( TS_UNIX, $record->af_created );
 472+ $date = '';
494473
 474+ // Relative dates for 48 hours, normal timestamps later.
 475+ if ( $timestamp > ( $now - ( 86400 * 2 ) ) ) {
 476+ $time = $wgLang->formatTimePeriod(
 477+ ( $now - $timestamp ), 'avoidseconds'
 478+ );
 479+ $date = wfMessage( 'articleFeedbackv5-comment-ago', $time )->escaped();
 480+ } elseif( $timestamp ) {
 481+ $date = $wgLang->timeanddate($record->af_created );
 482+ }
 483+
 484+ // format the element
 485+ return Html::openElement( 'span', array(
 486+ 'class' => 'articleFeedbackv5-comment-details-date'
 487+ ) )
 488+ . Html::element( 'a', array(
 489+ 'class' => 'articleFeedbackv5-permalink',
 490+ 'id' => "articleFeedbackv5-permalink-$id",
 491+ 'href' => "#id=$id"
 492+ ), $date )
 493+ . Html::closeElement( 'span' );
 494+ }
 495+
495496 private function renderBucket1( $record ) {
496497 if ( $record['found']->aa_response_boolean ) {
497498 $msg = 'articlefeedbackv5-form1-header-found';
@@ -632,7 +633,8 @@
633634 array( 'class' => 'result' ),
634635 wfMessage( $message, $gender, $extra )->text()
635636 )
636 - . Html::closeElement( 'h3' );
 637+ . Html::closeElement( 'h3' )
 638+ . $this->renderPermalinkTimestamp( $record );
637639 }
638640
639641 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r110366partly revert r110294: Revert removal of {{GENDER:$1|$1}}. Parameter was remo...raymond08:02, 31 January 2012

Comments

#Comment by Raymond (talk | contribs)   16:34, 30 January 2012

Why do you remove $1 from the messages? The username is still submitted via feedbackHead()

-	'articlefeedbackv5-form1-header-found' => '{{GENDER:$1|$1}} found what they were looking for',
-	'articlefeedbackv5-form1-header-not-found' => '{{GENDER:$1|$1}} did not find what they were looking for',
+	'articlefeedbackv5-form1-header-found' => 'found what they were looking for',
+	'articlefeedbackv5-form1-header-not-found' => 'did not find what they were looking for',
#Comment by Catrope (talk | contribs)   07:55, 31 January 2012

OK otherwise.

#Comment by Raymond (talk | contribs)   08:02, 31 January 2012

Setting status to OK per Roan.

Status & tagging log