r77931 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77930‎ | r77931 | r77932 >
Date:23:21, 6 December 2010
Author:tparscal
Status:deferred
Tags:
Comment:
Basic star rating functionality working
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.css (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/question-hover.png (added) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/question.png (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/rating.png (deleted) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-empty.png (added) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-full.png (added) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-new.png (added) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/trash-hover.png (added) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/trash.png (added) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/rating.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-new.png
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/star-new.png
___________________________________________________________________
Added: svn:mime-type
11 + application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/trash.png
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/trash.png
___________________________________________________________________
Added: svn:mime-type
22 + application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/trash-hover.png
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/trash-hover.png
___________________________________________________________________
Added: svn:mime-type
33 + application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-empty.png
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/star-empty.png
___________________________________________________________________
Added: svn:mime-type
44 + application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/question.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
Property changes on: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/question-hover.png
___________________________________________________________________
Added: svn:mime-type
55 + application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/images/star-full.png
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/star-full.png
___________________________________________________________________
Added: svn:mime-type
66 + application/octet-stream
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.css
@@ -117,24 +117,22 @@
118118
119119 .articleFeedback-rating-labels label {
120120 float: left;
121 - height: 21px;
122 - width: 21px;
 121+ height: 2em;
 122+ width: 2em;
123123 margin: 0;
124124 padding: 0;
125 - background-image: url(images/rating.png);
 125+ background-image: url(images/star-empty.png);
126126 background-repeat: no-repeat;
127 - background-position: -24px 0px;
 127+ background-position: center center;
128128 cursor: pointer;
129129 }
130130
131 -.articleFeedback-rating-labels label.articleFeedback-rating-label-first {
132 - background-position: 0px 0px;
133 - width: 24px;
 131+.articleFeedback-rating-labels label.articleFeedback-rating-label-full {
 132+ background-image: url(images/star-full.png);
134133 }
135134
136 -.articleFeedback-rating-labels label.articleFeedback-rating-label-last {
137 - background-position: -45px 0px;
138 - width: 24px;
 135+.articleFeedback-rating-labels label.articleFeedback-rating-label-new {
 136+ background-image: url(images/star-new.png);
139137 }
140138
141139 .articleFeedback-rating {
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js
@@ -6,6 +6,23 @@
77
88 $.articleFeedback = {
99 'fn': {
 10+ 'updateRating': function() {
 11+ $(this)
 12+ .find( 'label' )
 13+ .removeClass( 'articleFeedback-rating-label-new' )
 14+ .each( function() {
 15+ if ( $( 'input#' + $(this).attr( 'for' ) + ':checked' ).length ) {
 16+ $(this)
 17+ .prevAll( 'label' )
 18+ .andSelf()
 19+ .addClass( 'articleFeedback-rating-label-full' )
 20+ .end()
 21+ .end()
 22+ .nextAll( 'label' )
 23+ .removeClass( 'articleFeedback-rating-label-full' );
 24+ }
 25+ } );
 26+ },
1027 'build': function( context ) {
1128 context.$ui
1229 .addClass( 'articleFeedback articleFeedback-form' )
@@ -30,22 +47,22 @@
3148 <div class="articleFeedback-rating" rel="wellsourced">\
3249 <span class="articleFeedback-label" title-msg="field-wellsourced-tip"><msg key="field-wellsourced-label" /></span>\
3350 <div class="articleFeedback-rating-fields articleFeedback-form"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
34 - <div class="articleFeedback-rating-labels articleFeedback-form"><label class="articleFeedback-rating-label-first"></label><label></label><label></label><label></label><label class="articleFeedback-rating-label-last"></label></div>\
 51+ <div class="articleFeedback-rating-labels articleFeedback-form"><label></label><label></label><label></label><label></label><label></label></div>\
3552 </div>\
3653 <div class="articleFeedback-rating" rel="neutral">\
3754 <span class="articleFeedback-label" title-msg="field-neutral-tip"><msg key="field-neutral-label" /></span>\
3855 <div class="articleFeedback-rating-fields articleFeedback-form"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
39 - <div class="articleFeedback-rating-labels articleFeedback-form"><label class="articleFeedback-rating-label-first"></label><label></label><label></label><label></label><label class="articleFeedback-rating-label-last"></label></div>\
 56+ <div class="articleFeedback-rating-labels articleFeedback-form"><label></label><label></label><label></label><label></label><label></label></div>\
4057 </div>\
4158 <div class="articleFeedback-rating" rel="complete">\
4259 <span class="articleFeedback-label" title-msg="field-complete-tip"><msg key="field-complete-label" /></span>\
4360 <div class="articleFeedback-rating-fields articleFeedback-form"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
44 - <div class="articleFeedback-rating-labels articleFeedback-form"><label class="articleFeedback-rating-label-first"></label><label></label><label></label><label></label><label class="articleFeedback-rating-label-last"></label></div>\
 61+ <div class="articleFeedback-rating-labels articleFeedback-form"><label></label><label></label><label></label><label></label><label></label></div>\
4562 </div>\
4663 <div class="articleFeedback-rating" rel="readable">\
4764 <span class="articleFeedback-label" title-msg="field-readable-tip"><msg key="field-readable-label" /></span>\
4865 <div class="articleFeedback-rating-fields articleFeedback-form"><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /><input type="radio" /></div>\
49 - <div class="articleFeedback-rating-labels articleFeedback-form"><label class="articleFeedback-rating-label-first"></label><label></label><label></label><label></label><label class="articleFeedback-rating-label-last"></label></div>\
 66+ <div class="articleFeedback-rating-labels articleFeedback-form"><label></label><label></label><label></label><label></label><label></label></div>\
5067 </div>\
5168 <div style="clear:both;"></div>\
5269 </div>\
@@ -71,12 +88,38 @@
7289 ' )
7390 .localize( { 'prefix': 'articlefeedback-beta-' } )
7491 .find( '[title]' )
75 - .tipsy( { 'gravity': 'nw', 'fade': true, 'center': false } )
 92+ .tipsy( {
 93+ 'gravity': 'nw',
 94+ 'center': false,
 95+ 'fade': true,
 96+ 'delayIn': 300,
 97+ 'delayOut': 100
 98+ } )
7699 .end()
77100 // Hide report elements initially
78101 .find( '.articleFeedback-report' )
79102 .hide()
80103 .end()
 104+ // Connect labels and fields
 105+ .find( '.articleFeedback-rating' )
 106+ .each( function() {
 107+ var rel = $(this).attr( 'rel' );
 108+ $(this)
 109+ .find( '.articleFeedback-rating-fields input' )
 110+ .attr( 'name', rel )
 111+ .each( function( i ) {
 112+ $(this)
 113+ .val( i + 1 )
 114+ .attr( 'id', 'articleFeedback-rating-field-' + rel + '-' + ( i + 1 ) );
 115+ } )
 116+ .end()
 117+ .find( '.articleFeedback-rating-labels label' )
 118+ .each( function( i ) {
 119+ $(this)
 120+ .attr( 'for', 'articleFeedback-rating-field-' + rel + '-' + ( i + 1 ) );
 121+ } );
 122+ } )
 123+ .end()
81124 // Setup tab behavior
82125 .find( '.articleFeedback-tab' )
83126 .click( function( e ) {
@@ -95,7 +138,21 @@
96139 } );
97140 e.preventDefault();
98141 return false;
99 - } );
 142+ } )
 143+ .end()
 144+ // Setup rating behavior
 145+ .find( '.articleFeedback-rating-labels label' )
 146+ .hover(
 147+ function() {
 148+ $(this).prevAll( 'label' ).andSelf()
 149+ .addClass( 'articleFeedback-rating-label-new' );
 150+ },
 151+ function() {
 152+ $.articleFeedback.fn.updateRating.call(
 153+ $(this).closest( '.articleFeedback-rating' )
 154+ );
 155+ }
 156+ );
100157 }
101158 }
102159 };

Status & tagging log