Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -132,6 +132,8 @@ |
133 | 133 | * Recent lows: pages that got 70% or more low (2 stars or lower) ratings in any category in the last 24 hours. Only pages that have received at least 10 ratings in the last 24 hours are included.", |
134 | 134 | 'articlefeedbackv5' => 'Article feedback dashboard', |
135 | 135 | 'articlefeedbackv5-desc' => 'Article feedback', |
| 136 | + 'articlefeedbackv5-comment-more' => 'Label for the button to expand the truncated comment on feedback. Swaps to articlefeedbackv5-comment-less after being clicked.', |
| 137 | + 'articlefeedbackv5-comment-less' => 'Previous label (articlefeedbackv5-comment-more) switches to this after being clicked. This is the label for collapsing the expanded comments.', |
136 | 138 | |
137 | 139 | /* Feedback forms */ |
138 | 140 | /* Option 1 ("Did you find what you were looking for?") */ |
— | — | @@ -374,6 +376,8 @@ |
375 | 377 | |
376 | 378 | Please visit http://prototype.wikimedia.org/articleassess/Main_Page for a prototype installation.', |
377 | 379 | 'articlefeedbackv5-desc' => '{{desc}}', |
| 380 | + 'articlefeedbackv5-comment-more' => 'More', |
| 381 | + 'articlefeedbackv5-comment-less' => 'Less', |
378 | 382 | |
379 | 383 | /* Feedback forms */ |
380 | 384 | /* Option 1 ("Did you find what you were looking for?") */ |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css |
— | — | @@ -317,3 +317,7 @@ |
318 | 318 | background-repeat: no-repeat; |
319 | 319 | background-size: 11px 7px; |
320 | 320 | } |
| 321 | + |
| 322 | +.articleFeedbackv5-comment-full { |
| 323 | + display: none; |
| 324 | +} |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -114,6 +114,7 @@ |
115 | 115 | $.articleFeedbackv5special.loadFeedback( true ); |
116 | 116 | return false; |
117 | 117 | } ); |
| 118 | + |
118 | 119 | $( '.articleFeedbackv5-sort-link' ).bind( 'click', function( e ) { |
119 | 120 | id = $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-special-sort-' ); |
120 | 121 | oldId = $.articleFeedbackv5special.sort; |
— | — | @@ -135,11 +136,18 @@ |
136 | 137 | |
137 | 138 | return false; |
138 | 139 | } ); |
| 140 | + |
139 | 141 | $( '#articleFeedbackv5-show-more' ).bind( 'click', function( e ) { |
140 | 142 | $.articleFeedbackv5special.loadFeedback( false ); |
141 | 143 | return false; |
142 | 144 | } ); |
143 | 145 | |
| 146 | + $( '.articleFeedbackv5-comment-toggle' ).live( 'click', function( e ) { |
| 147 | +console.log('welp'); |
| 148 | + $.articleFeedbackv5special.toggleComment( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-comment-toggle-' ) ); |
| 149 | + return false; |
| 150 | + } ); |
| 151 | + |
144 | 152 | $.each( ['unhide', 'undelete', 'oversight', 'hide', 'abuse', 'delete', 'helpful', 'unhelpful', 'unoversight'], |
145 | 153 | function ( index, value ) { |
146 | 154 | $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) { |
— | — | @@ -153,6 +161,30 @@ |
154 | 162 | // }}} |
155 | 163 | // {{{ Utility methods |
156 | 164 | |
| 165 | + |
| 166 | + |
| 167 | + // {{{ toggleComment |
| 168 | + $.articleFeedbackv5special.toggleComment = function( id ) { |
| 169 | +console.log('id is ' + id); |
| 170 | + if( $( '#articleFeedbackv5-comment-toggle-' + id ).text() |
| 171 | + == mw.msg( 'articlefeedbackv5-comment-more' ) ) { |
| 172 | +console.log('show full'); |
| 173 | + $( '#articleFeedbackv5-comment-short-' + id ).hide(); |
| 174 | + $( '#articleFeedbackv5-comment-full-' + id ).show(); |
| 175 | + $( '#articleFeedbackv5-comment-toggle-' + id ).text( |
| 176 | + mw.msg( 'articlefeedbackv5-comment-less' ) |
| 177 | + ); |
| 178 | + } else { |
| 179 | +console.log('show short'); |
| 180 | + $( '#articleFeedbackv5-comment-short-' + id ).show(); |
| 181 | + $( '#articleFeedbackv5-comment-full-' + id ).hide(); |
| 182 | + $( '#articleFeedbackv5-comment-toggle-' + id ).text( |
| 183 | + mw.msg( 'articlefeedbackv5-comment-more' ) |
| 184 | + ); |
| 185 | + } |
| 186 | + } |
| 187 | + // }}} |
| 188 | + |
157 | 189 | // {{{ drawSortArrow |
158 | 190 | |
159 | 191 | $.articleFeedbackv5special.drawSortArrow = function() { |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -452,7 +452,7 @@ |
453 | 453 | } |
454 | 454 | |
455 | 455 | return $this->feedbackHead( $msg, $class, $record[0] ) |
456 | | - . $this->renderComment( $record['comment']->aa_response_text ); |
| 456 | + . $this->renderComment( $record['comment']->aa_response_text, $record[0]->af_id ); |
457 | 457 | } |
458 | 458 | |
459 | 459 | |
— | — | @@ -465,7 +465,7 @@ |
466 | 466 | // * articlefeedbackv5-form2-header-question |
467 | 467 | // * articlefeedbackv5-form2-header-suggestion |
468 | 468 | return $this->feedbackHead( "articlefeedbackv5-form2-header-$type", $class, $record[0], $type ) |
469 | | - . $this->renderComment( $record['comment']->aa_response_text ); |
| 469 | + . $this->renderComment( $record['comment']->aa_response_text, $record[0]->af_id ); |
470 | 470 | } |
471 | 471 | |
472 | 472 | private function renderBucket3( $record ) { |
— | — | @@ -474,7 +474,7 @@ |
475 | 475 | $class = $record['rating']->aa_response_rating >= 3 ? 'positive' : 'negative'; |
476 | 476 | |
477 | 477 | return $this->feedbackHead( 'articlefeedbackv5-form3-header', $class, $record[0], $record['rating']->aa_response_rating ) |
478 | | - . $this->renderComment( $record['comment']->aa_response_text ); |
| 478 | + . $this->renderComment( $record['comment']->aa_response_text, $record[0]->af_id ); |
479 | 479 | } |
480 | 480 | |
481 | 481 | private function renderBucket4( $record ) { |
— | — | @@ -535,16 +535,37 @@ |
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
539 | | - private function renderComment( $text ) { |
540 | | - if( strlen( $text ) <= 500 ) { |
541 | | - $rv = "<blockquote>" |
| 539 | + private function renderComment( $text, $feedbackId ) { |
| 540 | + global $wgLang; |
| 541 | + |
| 542 | + $short = $wgLang->truncate( $text, 500 ); |
| 543 | + |
| 544 | + $rv = Html::openElement( 'blockquote', |
| 545 | + array( |
| 546 | + 'class' => 'articleFeedbackv5-comment-short', |
| 547 | + 'id' => "articleFeedbackv5-comment-short-$feedbackId" |
| 548 | + ) ) |
| 549 | + . htmlspecialchars( $short ) |
| 550 | + . Html::closeElement( 'blockquote' ); |
| 551 | + |
| 552 | + // If the short string is the same size as the |
| 553 | + // original, no truncation happened, so no |
| 554 | + // controls are needed. |
| 555 | + if( $short != $text ) { |
| 556 | + // Show the short text, with the 'show more' control. |
| 557 | + $rv .= Html::openElement( 'blockquote', |
| 558 | + array( |
| 559 | + 'class' => 'articleFeedbackv5-comment-full', |
| 560 | + 'id' => "articleFeedbackv5-comment-full-$feedbackId" |
| 561 | + ) ) |
542 | 562 | . htmlspecialchars( $text ) |
543 | | - . '</blockquote>'; |
544 | | - } else { |
545 | | - $rv = "<blockquote>" |
546 | | - . htmlspecialchars( $text ) |
547 | | - . '</blockquote>'; |
| 563 | + . Html::closeElement( 'blockquote' ) |
| 564 | + . Html::element( 'a', array( |
| 565 | + 'class' => 'articleFeedbackv5-comment-toggle', |
| 566 | + 'id' => "articleFeedbackv5-comment-toggle-$feedbackId" |
| 567 | + ), wfMessage( 'articlefeedbackv5-comment-more' )->escaped() ); |
548 | 568 | } |
| 569 | + |
549 | 570 | return $rv; |
550 | 571 | } |
551 | 572 | |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -177,7 +177,9 @@ |
178 | 178 | 'articlefeedbackv5-unoversight-saved', |
179 | 179 | 'articlefeedbackv5-comment-link', |
180 | 180 | 'articlefeedbackv5-special-sort-asc', |
181 | | - 'articlefeedbackv5-special-sort-desc' |
| 181 | + 'articlefeedbackv5-special-sort-desc', |
| 182 | + 'articlefeedbackv5-comment-more', |
| 183 | + 'articlefeedbackv5-comment-less' |
182 | 184 | ), |
183 | 185 | 'dependencies' => array( |
184 | 186 | 'mediawiki.util', |