r91085 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91084‎ | r91085 | r91086 >
Date:17:47, 29 June 2011
Author:kaldari
Status:ok (Comments)
Tags:
Comment:
adding text template fall-back so that we dont have to repeat the same text template for every sub-type
Modified paths:
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
@@ -241,14 +241,14 @@
242242 'food': {
243243 name: 'Food and drink', // name of the type (appears in the types menu)
244244 select: 'Select food or drink item:', // subtype select label
 245+ text: '{| style="background-color: $5; border: 1px solid $6;"\n\
 246+|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
 247+|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
 248+|}', // custom text
245249 subtypes: { // some different subtypes
246250 // note that when not using subtypes you should use these subtype options
247251 // for the top-level type
248252 'baklava': {
249 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
250 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
251 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
252 -|}', // custom text
253253 fields: [ 'header', 'message' ], // fields to ask for in form
254254 option: 'Baklava', // option listed in the select list
255255 header: 'Some baklava for you!', // header that appears at the top of the talk page post (optional)
@@ -256,10 +256,6 @@
257257 imageSize: '135px' // size to display image
258258 },
259259 'beer': {
260 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
261 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
262 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
263 -|}',
264260 fields: [ 'header', 'message' ],
265261 option: 'Beer',
266262 header: 'A beer for you!',
@@ -267,10 +263,6 @@
268264 imageSize: '70px'
269265 },
270266 'brownie': {
271 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
272 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
273 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
274 -|}',
275267 fields: [ 'header', 'message' ],
276268 option: 'Brownie',
277269 header: 'A brownie for you!',
@@ -278,10 +270,6 @@
279271 imageSize: '120px'
280272 },
281273 'bubble tea': {
282 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
283 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
284 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
285 -|}', // custom text
286274 fields: [ 'header', 'message' ],
287275 option: 'Bubble tea',
288276 header: 'Some bubble tea for you!',
@@ -289,10 +277,6 @@
290278 imageSize: '65px'
291279 },
292280 'cheeseburger': {
293 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
294 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
295 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
296 -|}',
297281 fields: [ 'header', 'message' ],
298282 option: 'Cheeseburger',
299283 header: 'A cheeseburger for you!',
@@ -300,10 +284,6 @@
301285 imageSize: '120px'
302286 },
303287 'cookie': {
304 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
305 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
306 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
307 -|}',
308288 fields: [ 'header', 'message' ],
309289 option: 'Cookie',
310290 header: 'A cookie for you!',
@@ -311,10 +291,6 @@
312292 imageSize: '120px'
313293 },
314294 'coffee': {
315 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
316 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
317 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
318 -|}',
319295 fields: [ 'header', 'message' ],
320296 option: 'Cup of coffee',
321297 header: 'A cup of coffee for you!',
@@ -322,10 +298,6 @@
323299 imageSize: '120px'
324300 },
325301 'tea': {
326 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
327 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
328 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
329 -|}',
330302 fields: [ 'header', 'message' ],
331303 option: 'Cup of tea',
332304 header: 'A cup of tea for you!',
@@ -333,10 +305,6 @@
334306 imageSize: '120px'
335307 },
336308 'cupcake': {
337 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
338 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
339 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
340 -|}',
341309 fields: [ 'header', 'message' ],
342310 option: 'Cupcake',
343311 header: 'A cupcake for you!',
@@ -344,10 +312,6 @@
345313 imageSize: '120px'
346314 },
347315 'pie': {
348 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
349 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
350 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
351 -|}',
352316 fields: [ 'header', 'message' ],
353317 option: 'Pie',
354318 header: 'A pie for you!',
@@ -355,10 +319,6 @@
356320 imageSize: '120px'
357321 },
358322 'stroopwafels': {
359 - text: '{| style="background-color: $5; border: 1px solid $6;"\n\
360 -|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
361 -|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
362 -|}',
363323 fields: [ 'header', 'message' ],
364324 option: 'Stroopwafels',
365325 header: 'Some stroopwafels for you!',
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -411,7 +411,7 @@
412412 * After the form is validated, perform preview.
413413 */
414414 submitPreview: function() {
415 - var text = $.wikiLove.prepareMsg( currentTypeOrSubtype.text || options.defaultText );
 415+ var text = $.wikiLove.prepareMsg( currentTypeOrSubtype.text || options.types[currentTypeId].text || options.defaultText );
416416 $.wikiLove.doPreview( '==' + $( '#mw-wikilove-header' ).val() + "==\n" + text );
417417 },
418418
@@ -544,7 +544,7 @@
545545
546546 var submitData = {
547547 'header': $( '#mw-wikilove-header' ).val(),
548 - 'text': $.wikiLove.prepareMsg( currentTypeOrSubtype.text || options.defaultText ),
 548+ 'text': $.wikiLove.prepareMsg( currentTypeOrSubtype.text || options.types[currentTypeId].text || options.defaultText ),
549549 'message': $( '#mw-wikilove-message' ).val(),
550550 'type': currentTypeId
551551 + (currentSubtypeId !== null ? '-' + currentSubtypeId : '')

Comments

#Comment by Krinkle (talk | contribs)   18:10, 29 June 2011

Nice bandwidth/loadtime saver there.

Status & tagging log