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 |
1 | 1 | + 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 |
2 | 2 | + 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 |
3 | 3 | + 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 |
4 | 4 | + 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 |
5 | 5 | + 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 |
6 | 6 | + application/octet-stream |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.css |
— | — | @@ -117,24 +117,22 @@ |
118 | 118 | |
119 | 119 | .articleFeedback-rating-labels label { |
120 | 120 | float: left; |
121 | | - height: 21px; |
122 | | - width: 21px; |
| 121 | + height: 2em; |
| 122 | + width: 2em; |
123 | 123 | margin: 0; |
124 | 124 | padding: 0; |
125 | | - background-image: url(images/rating.png); |
| 125 | + background-image: url(images/star-empty.png); |
126 | 126 | background-repeat: no-repeat; |
127 | | - background-position: -24px 0px; |
| 127 | + background-position: center center; |
128 | 128 | cursor: pointer; |
129 | 129 | } |
130 | 130 | |
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); |
134 | 133 | } |
135 | 134 | |
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); |
139 | 137 | } |
140 | 138 | |
141 | 139 | .articleFeedback-rating { |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback-beta/ext.articleFeedback-beta.js |
— | — | @@ -6,6 +6,23 @@ |
7 | 7 | |
8 | 8 | $.articleFeedback = { |
9 | 9 | '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 | + }, |
10 | 27 | 'build': function( context ) { |
11 | 28 | context.$ui |
12 | 29 | .addClass( 'articleFeedback articleFeedback-form' ) |
— | — | @@ -30,22 +47,22 @@ |
31 | 48 | <div class="articleFeedback-rating" rel="wellsourced">\ |
32 | 49 | <span class="articleFeedback-label" title-msg="field-wellsourced-tip"><msg key="field-wellsourced-label" /></span>\ |
33 | 50 | <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>\ |
35 | 52 | </div>\ |
36 | 53 | <div class="articleFeedback-rating" rel="neutral">\ |
37 | 54 | <span class="articleFeedback-label" title-msg="field-neutral-tip"><msg key="field-neutral-label" /></span>\ |
38 | 55 | <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>\ |
40 | 57 | </div>\ |
41 | 58 | <div class="articleFeedback-rating" rel="complete">\ |
42 | 59 | <span class="articleFeedback-label" title-msg="field-complete-tip"><msg key="field-complete-label" /></span>\ |
43 | 60 | <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>\ |
45 | 62 | </div>\ |
46 | 63 | <div class="articleFeedback-rating" rel="readable">\ |
47 | 64 | <span class="articleFeedback-label" title-msg="field-readable-tip"><msg key="field-readable-label" /></span>\ |
48 | 65 | <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>\ |
50 | 67 | </div>\ |
51 | 68 | <div style="clear:both;"></div>\ |
52 | 69 | </div>\ |
— | — | @@ -71,12 +88,38 @@ |
72 | 89 | ' ) |
73 | 90 | .localize( { 'prefix': 'articlefeedback-beta-' } ) |
74 | 91 | .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 | + } ) |
76 | 99 | .end() |
77 | 100 | // Hide report elements initially |
78 | 101 | .find( '.articleFeedback-report' ) |
79 | 102 | .hide() |
80 | 103 | .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() |
81 | 124 | // Setup tab behavior |
82 | 125 | .find( '.articleFeedback-tab' ) |
83 | 126 | .click( function( e ) { |
— | — | @@ -95,7 +138,21 @@ |
96 | 139 | } ); |
97 | 140 | e.preventDefault(); |
98 | 141 | 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 | + ); |
100 | 157 | } |
101 | 158 | } |
102 | 159 | }; |