Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | </span> \ |
58 | 58 | <span class="article-assessment-rating-count"></span> \ |
59 | 59 | </div>', |
60 | | - 'staleMSG': '<span class="article-assessment-stale-msg">{MSG}</span>' |
| 60 | + 'staleMSG': '<span class="article-assessment-stale-msg"></span>' |
61 | 61 | }, |
62 | 62 | |
63 | 63 | 'fn' : { |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | var settings = $( '#article-assessment' ).data( 'articleAssessment-context' ).settings; |
251 | 251 | // add the correct data to the markup |
252 | 252 | if ( data.query.articleassessment && data.query.articleassessment.length > 0 ) { |
253 | | - for ( var r in data.query.articleassessment[0].ratings) { |
| 253 | + for ( var r in data.query.articleassessment[0].ratings ) { |
254 | 254 | var rating = data.query.articleassessment[0].ratings[r], |
255 | 255 | $rating = $( '#' + rating.ratingdesc ), |
256 | 256 | count = rating.count, |
— | — | @@ -272,9 +272,7 @@ |
273 | 273 | $( '.ui-stars-star-on' ) |
274 | 274 | .addClass( 'ui-stars-star-stale' ); |
275 | 275 | // add the stale message |
276 | | - var msg = $.ArticleAssessment.fn.getMsg( 'articleassessment-stalemessage-revisioncount' ) |
277 | | - .replace( /'''([^']*)'''/g, '<strong>$1</strong>' ) |
278 | | - .replace( /''([^']*)''/g, '<em>$1</em>' ); |
| 276 | + var msg = $.ArticleAssessment.fn.getMsg( 'articleassessment-stalemessage-revisioncount' ); |
279 | 277 | $.ArticleAssessment.fn.flashNotice( msg, { 'class': 'article-assessment-stale-msg' } ); |
280 | 278 | } else { |
281 | 279 | // if it's not a stale rating, we want to make the stars blue |
— | — | @@ -320,28 +318,29 @@ |
321 | 319 | 'format': 'json' |
322 | 320 | }, |
323 | 321 | dataType: 'json', |
324 | | - success: function( data ) { |
325 | | - // update the ratings |
326 | | - $.ArticleAssessment.fn.getRatingData(); |
327 | | - // set the stars to rated status |
328 | | - $( '.ui-stars-star-on' ).addClass( 'ui-stars-star-rated' ); |
329 | | - // unlock the stars & submit |
330 | | - $( '.rating-field' ).stars( 'enable' ); |
331 | | - $( '#article-assessment input:disabled' ).removeAttr( 'disabled' ); |
332 | | - // update the results |
333 | | - |
334 | | - // show the results |
335 | | - $( '#article-assessment .article-assessment-show-ratings a' ).click(); |
336 | | - // say thank you |
337 | | - $.ArticleAssessment.fn.flashNotice( $.ArticleAssessment.fn.getMsg( 'articleassessment-thanks' ), |
338 | | - { 'class': 'article-assessment-success-msg' } ); |
339 | | - }, |
| 322 | + success: $.ArticleAssessment.fn.afterSubmitRating, |
340 | 323 | error: function( XMLHttpRequest, textStatus, errorThrown ) { |
341 | 324 | $.ArticleAssessment.fn.flashNotice( $.ArticleAssessment.fn.getMsg( 'articleassessment-error' ), |
342 | 325 | { 'class': 'article-assessment-error-msg' } ); |
343 | 326 | } |
344 | 327 | } ); |
345 | 328 | }, |
| 329 | + 'afterSubmitRating': function ( data ) { |
| 330 | + // update the ratings |
| 331 | + $.ArticleAssessment.fn.getRatingData(); |
| 332 | + // set the stars to rated status |
| 333 | + $( '.ui-stars-star-on' ).addClass( 'ui-stars-star-rated' ); |
| 334 | + // unlock the stars & submit |
| 335 | + $( '.rating-field' ).stars( 'enable' ); |
| 336 | + $( '#article-assessment input:disabled' ).removeAttr( 'disabled' ); |
| 337 | + // update the results |
| 338 | + |
| 339 | + // show the results |
| 340 | + $( '#article-assessment .article-assessment-show-ratings a' ).click(); |
| 341 | + // say thank you |
| 342 | + $.ArticleAssessment.fn.flashNotice( $.ArticleAssessment.fn.getMsg( 'articleassessment-thanks' ), |
| 343 | + { 'class': 'article-assessment-success-msg' } ); |
| 344 | + }, |
346 | 345 | // places a message on the interface |
347 | 346 | 'flashNotice': function( text, options ) { |
348 | 347 | if ( arguments.length == 0 ) { |
— | — | @@ -380,7 +379,7 @@ |
381 | 380 | var msg = $.ArticleAssessment.messages[key]; |
382 | 381 | if ( typeof args == 'object' || typeof args == 'array' ) { |
383 | 382 | for ( var i = 0; i < args.length; i++ ) { |
384 | | - msg = msg.replace( new RegExp( '\$' + ( parseInt( i ) + 1 ), 'g' ), args[i] ); |
| 383 | + msg = msg.replace( new RegExp( '\\$' + ( parseInt( i ) + 1 ), 'g' ), args[i] ); |
385 | 384 | } |
386 | 385 | } else if ( typeof args == 'string' || typeof args == 'number' ) { |
387 | 386 | msg = msg.replace( /\$1/g, args ); |