Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.i18n.php |
— | — | @@ -26,14 +26,14 @@ |
27 | 27 | 'articleassessment-thanks' => 'Thanks! Your ratings have been saved.', |
28 | 28 | |
29 | 29 | # This special page doesn't exist yet, but it will soon. |
30 | | - 'articleassessment-featurefeedback' => 'Give us [[Special:ArticleAssessmentFeedback|feedback]] about this feature.', |
| 30 | + 'articleassessment-featurefeedback' => 'Give us <span class="feedbacklink">feedback</span> about this feature.', |
31 | 31 | 'articleassessment-noratings' => '$1 ($2 {{PLURAL:$2|rating|ratings}})', |
32 | 32 | 'articleassessment-stalemessage-norevisioncount' => "This page has been ''revised'' since you last reviewed it. |
33 | 33 | You may wish to rate it again.", |
34 | 34 | |
35 | 35 | # Links get rewritten in javascript. |
36 | | - 'articleassessment-results-show' => "(Results hidden. [[#|Show]] them.)", |
37 | | - 'articleassessment-results-hide' => "([[#|Hide results]])", |
| 36 | + 'articleassessment-results-show' => '(Results hidden. <span class="showlink">Show</span> them.)', |
| 37 | + 'articleassessment-results-hide' => '(<span class="hidelink">Hide results</span>)', |
38 | 38 | ); |
39 | 39 | |
40 | 40 | /** Message documentation (Message documentation) |
— | — | @@ -67,9 +67,9 @@ |
68 | 68 | 'articleassessment-stalemessage-greaterthancount' => 'This is a message shown to the user when their ratings are "stale". It allows for not looking up the total number of revisions.', |
69 | 69 | 'articleassessment-stalemessage-norevisioncount' => 'This is a message shown to the user when their ratings are "stale" and does NOT include the number of revisions. This is an ambiguous reason, and allows for us to have complicated staleness patterns. This is the preferred message.', |
70 | 70 | 'articleassessment-results-show' => 'This is an explanatory control that, when clicked, will display hidden aggregate ratings. |
71 | | -The incomplete looking wikilinks get rewritten in javascript.', |
| 71 | +The span tag gets rewritten in JavaScript to become a link.', |
72 | 72 | 'articleassessment-results-hide' => 'This is a control that, when clicked, will hide the aggregate ratings. |
73 | | -The incomplete looking wikilinks get rewritten in javascript.', |
| 73 | +The span tag gets rewritten in JavaScript to become a link.', |
74 | 74 | ); |
75 | 75 | |
76 | 76 | /** Afrikaans (Afrikaans) |
— | — | @@ -83,8 +83,8 @@ |
84 | 84 | 'articleassessment-rating-completeness' => 'Volledig:', |
85 | 85 | 'articleassessment-rating-readability' => 'Leesbaar:', |
86 | 86 | 'articleassessment-articlerating' => 'Artikel gradering', |
87 | | - 'articleassessment-results-show' => '(Resultate versteek. [[#|Wys]] hulle.)', |
88 | | - 'articleassessment-results-hide' => '([[#|Versteek resultate]])', |
| 87 | + 'articleassessment-results-show' => '(Resultate versteek. <span class="showlink">Wys</span> hulle.)', |
| 88 | + 'articleassessment-results-hide' => '(<span class="hidelink">Versteek resultate</span>)', |
89 | 89 | ); |
90 | 90 | |
91 | 91 | /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | 'articleassessment-error' => 'Ein Fehler ist aufgetreten. |
127 | 127 | Bitte versuche es später erneut.', |
128 | 128 | 'articleassessment-thanks' => 'Vielen Dank! Deine Einschätzung wurde gespeichert.', |
129 | | - 'articleassessment-featurefeedback' => 'Gebe uns bitte eine [[Special:Article Assessment Feedback|Rückmeldung]] zu dieser Funktion zur Einschätzung eines Artikels.', |
| 129 | + 'articleassessment-featurefeedback' => 'Gebe uns bitte eine <span class="feedbacklink">Rückmeldung</span> zu dieser Funktion zur Einschätzung eines Artikels.', |
130 | 130 | 'articleassessment-noratings' => '$1 ($2 {{PLURAL:$2|Einschätzung|Einschätzungen}})', |
131 | 131 | 'articleassessment-stalemessage-revisioncount' => "Dieser Artikel wurde seit deiner letzten Einschätzung „$1-mal“ ''bearbeitet''. |
132 | 132 | Vielleicht möchtest du ihn erneut einschätzen.", |
— | — | @@ -133,8 +133,8 @@ |
134 | 134 | Vielleicht möchtest du ihn erneut einschätzen.", |
135 | 135 | 'articleassessment-stalemessage-norevisioncount' => "Dieser Artikel wurde seit deiner letzten Einschätzung ''bearbeitet''. |
136 | 136 | Vielleicht möchtest du ihn erneut einschätzen.", |
137 | | - 'articleassessment-results-show' => '(Ergebnisse sind ausgeblendet. [[#|Einblenden]].)', |
138 | | - 'articleassessment-results-hide' => '([[#|Ergebnisse ausblenden]])', |
| 137 | + 'articleassessment-results-show' => '(Ergebnisse sind ausgeblendet. <span class="showlink">Einblenden</span>.)', |
| 138 | + 'articleassessment-results-hide' => '(<span class="hidelink">Ergebnisse ausblenden</span>)', |
139 | 139 | ); |
140 | 140 | |
141 | 141 | /** Galician (Galego) |
— | — | @@ -152,10 +152,10 @@ |
153 | 153 | 'articleassessment-articlerating' => 'Avaliación do artigo', |
154 | 154 | 'articleassessment-error' => 'Houbo un erro. |
155 | 155 | Inténteo de novo máis tarde.', |
156 | | - 'articleassessment-featurefeedback' => 'Déanos [[Special:Article Assessment Feedback|a súa opinión]] sobre esta característica.', |
| 156 | + 'articleassessment-featurefeedback' => 'Déanos <span class="feedbacklink">a súa opinión</span> sobre esta característica.', |
157 | 157 | 'articleassessment-noratings' => '$1 ($2 {{PLURAL:$2|avaliación|avaliacións}})', |
158 | | - 'articleassessment-results-show' => '(Resultados agochados. [[#|Mostralos]].)', |
159 | | - 'articleassessment-results-hide' => '([[#|Agochar os resultados]])', |
| 158 | + 'articleassessment-results-show' => '(Resultados agochados. <span class="showlink">Mostralos</span>.)', |
| 159 | + 'articleassessment-results-hide' => '(<span class="hidelink">Agochar os resultados</span>)', |
160 | 160 | ); |
161 | 161 | |
162 | 162 | /** Japanese (日本語) |
— | — | @@ -205,8 +205,8 @@ |
206 | 206 | Probéiert w.e.g. méi spéit nach emol.', |
207 | 207 | 'articleassessment-thanks' => 'Merci! Är Bewäertung gouf gespäichert.', |
208 | 208 | 'articleassessment-noratings' => '$1 ($2 {{PLURAL:$2|Bewäertung|Bewäertungen}})', |
209 | | - 'articleassessment-results-show' => "(D'Resultater si verstopp. Resultater [[#|weisen]].)", |
210 | | - 'articleassessment-results-hide' => '([[#|Resultater verstoppen]])', |
| 209 | + 'articleassessment-results-show' => "(D'Resultater si verstopp. Resultater <span class="showlink">weisen</span>.)", |
| 210 | + 'articleassessment-results-hide' => '(<span class="hidelink">Resultater verstoppen</span>)', |
211 | 211 | ); |
212 | 212 | |
213 | 213 | /** Macedonian (Македонски) |
— | — | @@ -230,7 +230,7 @@ |
231 | 231 | 'articleassessment-error' => 'Се појави грешка. |
232 | 232 | Обидете се подоцна.', |
233 | 233 | 'articleassessment-thanks' => 'Ви благодариме! Вашите оценки се зачувани.', |
234 | | - 'articleassessment-featurefeedback' => 'Дајте ваше [[Special:Article Assessment Feedback|мислење]] за оваа функција.', |
| 234 | + 'articleassessment-featurefeedback' => 'Дајте ваше <span class="feedbacklink">мислење</span> за оваа функција.', |
235 | 235 | 'articleassessment-noratings' => '$1 ($2 {{PLURAL:$2|оценка|оценки}})', |
236 | 236 | 'articleassessment-stalemessage-revisioncount' => "Статијава е ''преработена'' '''$1 пати''' од последниот преглед наваму. |
237 | 237 | Ви предлагаме да ја преоцените.", |
— | — | @@ -238,8 +238,8 @@ |
239 | 239 | Ви предлагаме да ја преоцените.", |
240 | 240 | 'articleassessment-stalemessage-norevisioncount' => "Статијава е ''преработена'' од последниот преглеед наваму. |
241 | 241 | Ви предлагаме да ја преоцените.", |
242 | | - 'articleassessment-results-show' => '(Резултатите се скриени. [[#|Прикажи]] ги.)', |
243 | | - 'articleassessment-results-hide' => '([[#|Сокриј резултати]])', |
| 242 | + 'articleassessment-results-show' => '(Резултатите се скриени. <span class="showlink">Прикажи</span> ги.)', |
| 243 | + 'articleassessment-results-hide' => '(<span class="hidelink">Сокриј резултати</span>)', |
244 | 244 | ); |
245 | 245 | |
246 | 246 | /** Piedmontese (Piemontèis) |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | 'articleassessment-error' => "Un eror a l'é capità. |
265 | 265 | Për piasì preuva torna pi tard.", |
266 | 266 | 'articleassessment-thanks' => 'Mersì! Toe valutassion a son ëstàite salvà.', |
267 | | - 'articleassessment-featurefeedback' => 'Dane [[Special:Article Assessment Feedback|artorn]] su sta funsion.', |
| 267 | + 'articleassessment-featurefeedback' => 'Dane <span class="feedbacklink">artorn</span> su sta funsion.', |
268 | 268 | 'articleassessment-noratings' => '$1 ($2 {{PLURAL:$2|valutassion|valutassion}})', |
269 | 269 | 'articleassessment-stalemessage-revisioncount' => "Sto artìcol a l'é stàit ''revisionà'' '''$1 vire''' da l'ùltima vira ch'it l'has revisionalo. |
270 | 270 | It podrìe vorejlo revaluté.", |
— | — | @@ -271,8 +271,8 @@ |
272 | 272 | It podrìe vorejlo revaluté.", |
273 | 273 | 'articleassessment-stalemessage-norevisioncount' => "Sto artìcol a l'é stàit ''revisionà'' da quand ch'it l'has revisionalo. |
274 | 274 | It podrìe vorejlo revaluté.", |
275 | | - 'articleassessment-results-show' => '(Arzultà stërmà. [[#|Mostlo]].)', |
276 | | - 'articleassessment-results-hide' => '([[#|Stërma arzultà]])', |
| 275 | + 'articleassessment-results-show' => '(Arzultà stërmà. <span class="showlink">Mostlo</span>.)', |
| 276 | + 'articleassessment-results-hide' => '(<span class="hidelink">Stërma arzultà</span>)', |
277 | 277 | ); |
278 | 278 | |
279 | 279 | /** Vietnamese (Tiếng Việt) |
— | — | @@ -300,7 +300,7 @@ |
301 | 301 | Bạn có thể muốn đánh giá nó một lần nữa.", |
302 | 302 | 'articleassessment-stalemessage-norevisioncount' => "Bài này đã được ''chỉnh sửa'' sau lần cuối bạn xem xét nó. |
303 | 303 | Bạn có thể muốn đánh giá nó một lần nữa.", |
304 | | - 'articleassessment-results-show' => '(Các kết quả được ẩn. [[#|Hiện]] kết quả.)', |
305 | | - 'articleassessment-results-hide' => '([[#|Ẩn kết quả]])', |
| 304 | + 'articleassessment-results-show' => '(Các kết quả được ẩn. <span class="showlink">Hiện</span> kết quả.)', |
| 305 | + 'articleassessment-results-hide' => '(<span class="hidelink">Ẩn kết quả</span>)', |
306 | 306 | ); |
307 | 307 | |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
— | — | @@ -102,7 +102,10 @@ |
103 | 103 | ); |
104 | 104 | |
105 | 105 | foreach ( self::$messages as $i => $message ) { |
106 | | - $escapedMessageValue = Xml::escapeJsString( wfMsg( $message ) ); |
| 106 | + // TODO: Not parsing or even preprocessing the messages would be more efficient, |
| 107 | + // but we can't do that until we have such nice things as JS-side {{PLURAL}} |
| 108 | + // Should be OK for now in a limited deployment scenario |
| 109 | + $escapedMessageValue = Xml::escapeJsString( wfMsgExt( $message, array( 'parseinline' ) ) ); |
107 | 110 | $escapedMessageKey = Xml::escapeJsString( $message ); |
108 | 111 | self::$messages[$i] = |
109 | 112 | "'{$escapedMessageKey}':'{$escapedMessageValue}'"; |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js |
— | — | @@ -99,16 +99,25 @@ |
100 | 100 | .text( instructions ) |
101 | 101 | .end() |
102 | 102 | .find( '.article-assessment-rate-feedback' ) |
103 | | - .html( feedback.replace( /\[\[([^\|\]]*)\|([^\|\]]*)\]\]/g, '<a href="' + wgArticlePath + '">$2</a>' ) ) |
| 103 | + .html( feedback ) |
| 104 | + .find( '.feedbacklink' ) |
| 105 | + .wrap( $( '<a href="#"></a>' ).click( $.ArticleAssessment.fn.showFeedback ) ) |
| 106 | + .end() |
104 | 107 | .end() |
105 | 108 | .find( '#article-assessment-ratings legend' ) |
106 | 109 | .text( articlerating ) |
107 | 110 | .end() |
108 | 111 | .find( '.article-assessment-show-ratings' ) |
109 | | - .html( resultsshow.replace( /\[\[#\|([^\]]*)\]\]/, '<a href="#">$1</a>' ) ) |
| 112 | + .html( resultsshow ) |
| 113 | + .find( '.showlink' ) |
| 114 | + .wrap( $( '<a href="#"></a>' ).click( $.ArticleAssessment.fn.showRatings ) ) |
| 115 | + .end() |
110 | 116 | .end() |
111 | | - .find( '.article-assessment-hide-ratings') |
112 | | - .html( resultshide.replace( /\[\[#\|([^\]]*)\]\]/, '<a href="#">$1</a>' ) ) |
| 117 | + .find( '.article-assessment-hide-ratings' ) |
| 118 | + .html( resultshide ) |
| 119 | + .find ( '.hidelink' ) |
| 120 | + .wrap( $( '<a href="#"></a>' ).click( $.ArticleAssessment.fn.hideRatings ) ) |
| 121 | + .end() |
113 | 122 | .end(); |
114 | 123 | for ( var i = 0; i < settings.fieldMessages.length; i++ ) { |
115 | 124 | var $field = $( settings.fieldHTML ), |
— | — | @@ -146,43 +155,16 @@ |
147 | 156 | } |
148 | 157 | // store our settings and configuration for later |
149 | 158 | $structure.find( '#article-assessment' ).data( 'articleAssessment-context', { 'settings': settings, 'config': config } ); |
150 | | - // bind the ratings show/hide handlers |
151 | | - $structure |
152 | | - .find( '.article-assessment-show-ratings a' ) |
153 | | - .click( function() { |
154 | | - $( this ) |
155 | | - .parent() |
156 | | - .hide(); |
157 | | - $structure |
158 | | - .find( '#article-assessment-ratings' ) |
159 | | - .removeClass( 'article-assessment-ratings-disabled' ) |
160 | | - .end() |
161 | | - .find( '.article-assessment-hide-ratings' ) |
162 | | - .show(); |
163 | | - return false; |
164 | | - } ) |
165 | | - .end() |
166 | | - .find( '.article-assessment-hide-ratings a' ) |
167 | | - .click( function() { |
168 | | - $( this ) |
169 | | - .parent() |
170 | | - .hide(); |
171 | | - $structure |
172 | | - .find( '#article-assessment-ratings' ) |
173 | | - .addClass( 'article-assessment-ratings-disabled' ) |
174 | | - .end() |
175 | | - .find( '.article-assessment-show-ratings' ) |
176 | | - .show(); |
177 | | - return false; |
178 | | - } ) |
179 | | - .click(); |
180 | 159 | $( '#catlinks' ).before( $structure ); |
| 160 | + // Hide the ratings initially |
| 161 | + $.ArticleAssessment.fn.hideRatings(); |
| 162 | + |
181 | 163 | |
182 | 164 | // set the height of our smaller fieldset to match the taller |
183 | 165 | if ( $( '#article-assessment-rate' ).height() > $( '#article-assessment-ratings' ).height() ) { |
184 | 166 | $( '#article-assessment-ratings' ).css( 'minHeight', $( '#article-assessment-rate' ).height() ); |
185 | 167 | } else { |
186 | | - $( '#article-assessment-rate' ).css( 'minHeight', $( '#article-assessment-ratings' ).height() ); |
| 168 | + $( '#article-assessment-rate' ).css( 'minHeight', $( '#article-assessment-ratings' ).height() ); |
187 | 169 | } |
188 | 170 | // attempt to fetch the ratings |
189 | 171 | $.ArticleAssessment.fn.getRatingData(); |
— | — | @@ -220,6 +202,27 @@ |
221 | 203 | $( '#article-assessment input[type=submit]' ) |
222 | 204 | .attr( 'disabled', 'disabled' ); |
223 | 205 | }, |
| 206 | + 'showRatings': function() { |
| 207 | + $( '#article-assessment-ratings' ) |
| 208 | + .removeClass( 'article-assessment-ratings-disabled' ) |
| 209 | + .find( '.article-assessment-show-ratings' ) |
| 210 | + .hide() |
| 211 | + .end() |
| 212 | + .find( '.article-assessment-hide-ratings' ) |
| 213 | + .show(); |
| 214 | + return false; |
| 215 | + }, |
| 216 | + 'hideRatings': function() { |
| 217 | + $( '#article-assessment-ratings' ) |
| 218 | + .addClass( 'article-assessment-ratings-disabled' ) |
| 219 | + .find( '.article-assessment-hide-ratings' ) |
| 220 | + .hide() |
| 221 | + .end() |
| 222 | + .find( '.article-assessment-show-ratings' ) |
| 223 | + .show(); |
| 224 | + return false; |
| 225 | + |
| 226 | + }, |
224 | 227 | |
225 | 228 | // Request the ratings data for the current article |
226 | 229 | 'getRatingData': function() { |
— | — | @@ -336,7 +339,7 @@ |
337 | 340 | // update the results |
338 | 341 | |
339 | 342 | // show the results |
340 | | - $( '#article-assessment .article-assessment-show-ratings a' ).click(); |
| 343 | + $.ArticleAssessment.fn.showRatings(); |
341 | 344 | // say thank you |
342 | 345 | $.ArticleAssessment.fn.flashNotice( $.ArticleAssessment.fn.getMsg( 'articleassessment-thanks' ), |
343 | 346 | { 'class': 'article-assessment-success-msg' } ); |
— | — | @@ -363,6 +366,11 @@ |
364 | 367 | .append( $msg ); |
365 | 368 | } |
366 | 369 | }, |
| 370 | + 'showFeedback': function() { |
| 371 | + // TODO: Implement |
| 372 | + $.ArticleAssessment.fn.flashNotice( 'Not implemented yet', { 'class': 'article-assessment-error-msg' } ); |
| 373 | + return false; |
| 374 | + }, |
367 | 375 | 'addMessages': function( messages ) { |
368 | 376 | for ( var key in messages ) { |
369 | 377 | $.ArticleAssessment.messages[key] = messages[key]; |