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 |
1 | 1 | + application/octet-stream |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js |
— | — | @@ -97,6 +97,9 @@ |
98 | 98 | }, |
99 | 99 | 'success': function( data ) { |
100 | 100 | var context = this; |
| 101 | + |
| 102 | + console.log( data ); |
| 103 | + |
101 | 104 | if ( typeof data.query.articlefeedback == undefined ) { |
102 | 105 | // ERROR! |
103 | 106 | console.log( '<loadReport success with bad data />' ); |
— | — | @@ -113,24 +116,41 @@ |
114 | 117 | var field = $.articleFeedback.cfg.fields[ratings[i].ratingid]; |
115 | 118 | var rating = ratings[i].userrating; |
116 | 119 | var count = ratings[i].count; |
117 | | - var average = Math.max( Math.min( ( ratings[i].total / count ), 5 ), 0 ); |
118 | 120 | var $rating = |
119 | 121 | 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 | + } |
135 | 155 | $.articleFeedback.fn.updateRating.call( $rating ); |
136 | 156 | } |
137 | 157 | // If being called just after a submit, we need to un-new the rating controls |