r78417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78416‎ | r78417 | r78418 >
Date:00:27, 15 December 2010
Author:tparscal
Status:deferred
Tags:
Comment:
Updated images, added PSD file.
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images.psd (added) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/question-hover.png (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/segment-full.png (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-full-hover.png (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-new-down.png (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-new-hover.png (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/segment-full.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-new-down.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-new-hover.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/question-hover.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-full-hover.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images.psd
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images.psd
___________________________________________________________________
Added: svn:mime-type
11 + application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js
@@ -97,6 +97,9 @@
9898 },
9999 'success': function( data ) {
100100 var context = this;
 101+
 102+ console.log( data );
 103+
101104 if ( typeof data.query.articlefeedback == undefined ) {
102105 // ERROR!
103106 console.log( '<loadReport success with bad data />' );
@@ -113,24 +116,41 @@
114117 var field = $.articleFeedback.cfg.fields[ratings[i].ratingid];
115118 var rating = ratings[i].userrating;
116119 var count = ratings[i].count;
117 - var average = Math.max( Math.min( ( ratings[i].total / count ), 5 ), 0 );
118120 var $rating =
119121 context.$ui.find( '.articleFeedback-rating[rel="' + field + '"]' );
120 - $rating
121 - .find( '.articleFeedback-rating-average' )
122 - .text( average % 1 == 0 ? average + '.0' : average )
123 - .end()
124 - .find( '.articleFeedback-rating-meter div' )
125 - .css( 'width', average >= 1 ? ( average * 20 + 'px' ) : 0 )
126 - .end()
127 - .find( '.articleFeedback-rating-count' )
128 - .text(
129 - count === 0
130 - ? mediaWiki.msg( 'articlefeedback-beta-report-empty' )
131 - : '(' + count + ') ' + mediaWiki.msg( 'articlefeedback-beta-report-ratings' ) )
132 - .end()
133 - .find( '.articleFeedback-rating-fields input[value="' + rating + '"]' )
134 - .attr( 'checked', true );
 122+ if ( count > 0 ) {
 123+ var average = Math.max( Math.min( ratings[i].total / count, 5 ), 0 );
 124+ var text = ( average - ( average % 1 ) ) + '.' +
 125+ Math.round( ( average % 1 ) * 10 );
 126+ $rating
 127+ .find( '.articleFeedback-rating-average' )
 128+ .text( text )
 129+ .end()
 130+ .find( '.articleFeedback-rating-meter div' )
 131+ .css( 'width', Math.round( average * 20 ) + 'px' )
 132+ .end()
 133+ .find( '.articleFeedback-rating-count' )
 134+ .text(
 135+ '(' + count + ') ' +
 136+ mediaWiki.msg( 'articlefeedback-beta-report-ratings' )
 137+ )
 138+ .end()
 139+ .find( 'input[value="' + rating + '"]' )
 140+ .attr( 'checked', true );
 141+ } else {
 142+ $rating
 143+ .find( '.articleFeedback-rating-average' )
 144+ .text( '' )
 145+ .end()
 146+ .find( '.articleFeedback-rating-meter div' )
 147+ .css( 'width', 0 )
 148+ .end()
 149+ .find( '.articleFeedback-rating-count' )
 150+ .text( mediaWiki.msg( 'articlefeedback-beta-report-empty' ) )
 151+ .end()
 152+ .find( 'input' )
 153+ .attr( 'checked', false );
 154+ }
135155 $.articleFeedback.fn.updateRating.call( $rating );
136156 }
137157 // If being called just after a submit, we need to un-new the rating controls

Follow-up revisions

RevisionCommit summaryAuthorDate
r78419Left a console.log in r78417 - oops.tparscal00:28, 15 December 2010

Status & tagging log