Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -39,7 +39,8 @@ |
40 | 40 | 'articlefeedbackv5-bucket1-toggle-found-no' => 'No', |
41 | 41 | 'articlefeedbackv5-bucket1-toggle-found-yes-full' => 'Yes, I found what I was looking for.', |
42 | 42 | 'articlefeedbackv5-bucket1-toggle-found-no-full' => 'No, I did not find what I was looking for.', |
43 | | - 'articlefeedbackv5-bucket1-question-comment' => 'What\'s missing? Any suggestions for improvement?', |
| 43 | + 'articlefeedbackv5-bucket1-question-comment-yes' => 'What did you like most? Share your praise with the editors.', |
| 44 | + 'articlefeedbackv5-bucket1-question-comment-no' => 'What\'s missing? Any suggestions for improvement?', |
44 | 45 | 'articlefeedbackv5-bucket1-disclosure' => 'Your Feedback will be shared $1. Seee our $2 for more details.', |
45 | 46 | 'articlefeedbackv5-bucket1-disclosure-shared-linktext' => 'here', |
46 | 47 | 'articlefeedbackv5-bucket1-disclosure-privacy-policy-linktext' => 'privacy policy', |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css |
— | — | @@ -449,7 +449,7 @@ |
450 | 450 | cursor: pointer; |
451 | 451 | text-decoration: none; |
452 | 452 | } |
453 | | -.articleFeedbackv5-panel .button-placeholder { |
| 453 | +.articleFeedbackv5-panel .articleFeedbackv5-button-placeholder { |
454 | 454 | display: inline-block; |
455 | 455 | height: 20px; |
456 | 456 | width: 50px; |
— | — | @@ -477,11 +477,11 @@ |
478 | 478 | .articleFeedbackv5-panel .buttons input { |
479 | 479 | display: none; |
480 | 480 | } |
481 | | -.articleFeedbackv5-panel .buttons .button-placeholder:hover { |
| 481 | +.articleFeedbackv5-panel .buttons .articleFeedbackv5-button-placeholder:hover { |
482 | 482 | background: url(images/bg-button.png) repeat-x; |
483 | 483 | cursor: pointer; |
484 | 484 | } |
485 | | -.articleFeedbackv5-panel .buttons .button-placeholder-active { |
| 485 | +.articleFeedbackv5-panel .buttons .articleFeedbackv5-button-placeholder-active { |
486 | 486 | background: url(images/bg-button.png) repeat-x; |
487 | 487 | } |
488 | 488 | .articleFeedbackv5-panel .feedback-text { |
— | — | @@ -519,4 +519,4 @@ |
520 | 520 | text-align: center; |
521 | 521 | color: #fff; |
522 | 522 | text-shadow: 1px 1px 1px #000; |
523 | | -} |
\ No newline at end of file |
| 523 | +} |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -145,18 +145,18 @@ |
146 | 146 | </div>\ |
147 | 147 | <div class="clear"></div>\ |
148 | 148 | </div>\ |
149 | | - <div class="form-row">\ |
| 149 | + <div class="form-row articleFeedbackv5-bucket1-toggle">\ |
150 | 150 | <p class="instructions-left"><html:msg key="bucket1-question-toggle" /></p>\ |
151 | 151 | <div class="buttons">\ |
152 | | - <div class="form-item">\ |
153 | | - <label for="find-yes"><html:msg key="bucket1-toggle-found-yes-full" /></label>\ |
154 | | - <span class="button-placeholder"><html:msg key="bucket1-toggle-found-yes" /></span>\ |
155 | | - <input type="radio" name="toggle" id="find-yes" class="query-button" />\ |
| 152 | + <div class="form-item" rel="yes" id="articleFeedbackv5-bucket1-toggle-wrapper-yes">\ |
| 153 | + <label for="articleFeedbackv5-bucket1-toggle-yes"><html:msg key="bucket1-toggle-found-yes-full" /></label>\ |
| 154 | + <span class="articleFeedbackv5-button-placeholder"><html:msg key="bucket1-toggle-found-yes" value="yes" /></span>\ |
| 155 | + <input type="radio" name="toggle" id="articleFeedbackv5-bucket1-toggle-yes" class="query-button" />\ |
156 | 156 | </div>\ |
157 | | - <div class="form-item">\ |
158 | | - <label for="find-no"><html:msg key="bucket1-toggle-found-no-full" /></label>\ |
159 | | - <span class="button-placeholder"><html:msg key="bucket1-toggle-found-no" /></span>\ |
160 | | - <input type="radio" name="toggle" id="find-no" class="query-button last" />\ |
| 157 | + <div class="form-item" rel="no" id="articleFeedbackv5-bucket1-toggle-wrapper-no">\ |
| 158 | + <label for="articleFeedbackv5-bucket1-toggle-no"><html:msg key="bucket1-toggle-found-no-full" /></label>\ |
| 159 | + <span class="articleFeedbackv5-button-placeholder"><html:msg key="bucket1-toggle-found-no" /></span>\ |
| 160 | + <input type="radio" name="toggle" id="articleFeedbackv5-bucket1-toggle-no" class="query-button last" value="no" />\ |
161 | 161 | </div>\ |
162 | 162 | <div class="clear"></div>\ |
163 | 163 | </div>\ |
— | — | @@ -177,10 +177,6 @@ |
178 | 178 | // Start out the tooltip hidden |
179 | 179 | $block.find( '.articleFeedbackv5-tooltip' ).hide(); |
180 | 180 | |
181 | | - // Set the default comment text |
182 | | - $block.find( '.articleFeedbackv5-comment textarea' ) |
183 | | - .val( mw.msg( 'articlefeedbackv5-bucket1-question-comment' ) ); |
184 | | - |
185 | 181 | // Fill in the disclosure text |
186 | 182 | $block.find( '.articleFeedbackv5-disclosure p' ) |
187 | 183 | .html( $.articleFeedbackv5.buildLink( |
— | — | @@ -221,6 +217,7 @@ |
222 | 218 | */ |
223 | 219 | bindEvents: function ( $block ) { |
224 | 220 | |
| 221 | + // Tooltip |
225 | 222 | $block.find( '.articleFeedbackv5-tooltip-trigger' ).hover( function () { |
226 | 223 | // mouse on |
227 | 224 | $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-tooltip' ).show(); |
— | — | @@ -232,26 +229,52 @@ |
233 | 230 | // Clear out the question on focus |
234 | 231 | $block.find( '.articleFeedbackv5-comment textarea' ) |
235 | 232 | .focus( function () { |
236 | | - var def_msg = mw.msg( 'articlefeedbackv5-bucket1-question-comment' ); |
| 233 | + var def_msg = ''; |
| 234 | + var val = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-bucket1-toggle input:checked' ).val(); |
| 235 | + if ( val == 'yes' ) { |
| 236 | + def_msg = mw.msg( 'articlefeedbackv5-bucket1-question-comment-yes' ); |
| 237 | + } else if ( val == 'no' ) { |
| 238 | + def_msg = mw.msg( 'articlefeedbackv5-bucket1-question-comment-no' ); |
| 239 | + } |
237 | 240 | if ( $( this ).val() == def_msg ) { |
238 | 241 | $( this ).val( '' ); |
239 | 242 | } |
240 | 243 | } ) |
241 | 244 | .blur( function () { |
| 245 | + var def_msg = ''; |
| 246 | + var val = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-bucket1-toggle input:checked' ).val(); |
| 247 | + if ( val == 'yes' ) { |
| 248 | + def_msg = mw.msg( 'articlefeedbackv5-bucket1-question-comment-yes' ); |
| 249 | + } else if ( val == 'no' ) { |
| 250 | + def_msg = mw.msg( 'articlefeedbackv5-bucket1-question-comment-no' ); |
| 251 | + } |
242 | 252 | if ( $( this ).val() == '' ) { |
243 | | - $( this ).val( mw.msg( 'articlefeedbackv5-bucket1-question-comment' ) ); |
| 253 | + $( this ).val( def_msg ); |
244 | 254 | } |
245 | 255 | } ); |
246 | 256 | |
247 | | - // Enable submission on toggle selection |
248 | | - $block.find( '.articleFeedbackv5-bucket1-toggle input' ) |
249 | | - .change( function () { |
250 | | - var $h = $.articleFeedbackv5.$holder; |
251 | | - if ( $h.find( '.articleFeedbackv5-bucket1-toggle input:checked' ).length > 0 ) { |
252 | | - $.articleFeedbackv5.currentBucket().enableSubmission( true ); |
253 | | - } else { |
254 | | - $.articleFeedbackv5.currentBucket().enableSubmission( false ); |
| 257 | + // Enable submission and switch out the comment default on toggle selection |
| 258 | + $block.find( '.articleFeedbackv5-button-placeholder' ) |
| 259 | + .click( function ( e ) { |
| 260 | + var new_val = $( this ).parent().attr( 'rel' ); |
| 261 | + var old_val = ( new_val == 'yes' ? 'no' : 'yes' ); |
| 262 | + var $wrap = $.articleFeedbackv5.$holder.find( '#articleFeedbackv5-bucket1-toggle-wrapper-' + new_val ); |
| 263 | + var $other_wrap = $.articleFeedbackv5.$holder.find( '#articleFeedbackv5-bucket1-toggle-wrapper-' + old_val ); |
| 264 | + // make the button blue |
| 265 | + $wrap.find( 'span' ).addClass( 'articleFeedbackv5-button-placeholder-active' ); |
| 266 | + $other_wrap.find( 'span' ).removeClass( 'articleFeedbackv5-button-placeholder-active' ); |
| 267 | + // check/uncheck radio buttons |
| 268 | + $wrap.find( 'input' ).attr( 'checked', 'checked' ); |
| 269 | + $other_wrap.find( 'input' ).attr( 'checked', '' ); |
| 270 | + // set default comment message |
| 271 | + var $txt = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-comment textarea' ); |
| 272 | + var def_msg_yes = mw.msg( 'articlefeedbackv5-bucket1-question-comment-yes' ); |
| 273 | + var def_msg_no = mw.msg( 'articlefeedbackv5-bucket1-question-comment-no' ); |
| 274 | + if ( $txt.val() == '' || $txt.val() == def_msg_yes || $txt.val() == def_msg_no ) { |
| 275 | + $txt.val( new_val == 'yes' ? def_msg_yes : def_msg_no ); |
255 | 276 | } |
| 277 | + // enable submission |
| 278 | + $.articleFeedbackv5.currentBucket().enableSubmission( true ); |
256 | 279 | } ); |
257 | 280 | |
258 | 281 | // Attach the submit |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -69,7 +69,8 @@ |
70 | 70 | 'articlefeedbackv5-bucket1-toggle-found-yes-full', |
71 | 71 | 'articlefeedbackv5-bucket1-toggle-found-no', |
72 | 72 | 'articlefeedbackv5-bucket1-toggle-found-no-full', |
73 | | - 'articlefeedbackv5-bucket1-question-comment', |
| 73 | + 'articlefeedbackv5-bucket1-question-comment-yes', |
| 74 | + 'articlefeedbackv5-bucket1-question-comment-no', |
74 | 75 | 'articlefeedbackv5-bucket1-disclosure', |
75 | 76 | 'articlefeedbackv5-bucket1-disclosure-shared-linktext', |
76 | 77 | 'articlefeedbackv5-bucket1-disclosure-privacy-policy-linktext', |