r52585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52584‎ | r52585 | r52586 >
Date:22:01, 29 June 2009
Author:tparscal
Status:deferred
Tags:
Comment:
Solved problems with cookie-stored state of booklets not being handled by pages
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -220,16 +220,20 @@
221221 var indexDiv = $( '<div />' )
222222 .attr( 'class', 'index' )
223223 .appendTo( $(this) );
224 -
 224+ // Builds name name of booklet state cookie
225225 var bookletCookie = 'edittoolbar-' + $(this).attr( 'id' ) + '-booklet-' + id;
 226+ // Gets ID of selected page
226227 var selectedID = $.cookie( bookletCookie );
227 -
228228 // Loops over each page
229229 for ( page in section.pages ) {
 230+ // Fallback to current (first) page for selectedID
 231+ if ( selectedID === null ) {
 232+ selectedID = page;
 233+ }
230234 // Appends index entry
231235 indexDiv.append(
232236 $( '<div />' )
233 - .attr( 'class', page == selectedID ? 'current' : null )
 237+ .attr( 'class', page === selectedID ? 'current' : null )
234238 .text( msg( section.pages[page], 'label' ) )
235239 .data( 'page', page )
236240 .data( 'cookie', bookletCookie )
@@ -252,6 +256,7 @@
253257 // Appends page
254258 var pageDiv = $( '<div />' )
255259 .attr( 'class', 'page page-' + page )
 260+ .css( 'display', page === selectedID ? 'block' : 'none' )
256261 .appendTo( pagesDiv );
257262 // Checks if there's content for this page
258263 switch ( section.pages[page].layout ) {
@@ -721,27 +726,27 @@
722727 }
723728 }
724729 },
725 - 'newline': {
726 - labelMsg: 'edittoolbar-tool-newline',
 730+ 'table': {
 731+ labelMsg: 'edittoolbar-tool-table',
727732 type: 'button',
728 - icon: 'insert-newline.png',
 733+ icon: 'insert-table.png',
729734 action: {
730735 type: 'encapsulate',
731736 options: {
732 - pre: "<br />\n"
 737+ pre: "{| class=\"wikitable\" border=\"1\"\n|",
 738+ periMsg: 'edittoolbar-tool-table-example',
 739+ post: "\n|}"
733740 }
734741 }
735742 },
736 - 'table': {
737 - labelMsg: 'edittoolbar-tool-table',
 743+ 'newline': {
 744+ labelMsg: 'edittoolbar-tool-newline',
738745 type: 'button',
739 - icon: 'insert-table.png',
 746+ icon: 'insert-newline.png',
740747 action: {
741748 type: 'encapsulate',
742749 options: {
743 - pre: "{| class=\"wikitable\" border=\"1\"\n|",
744 - periMsg: 'edittoolbar-tool-table-example',
745 - post: "\n|}"
 750+ pre: "<br />\n"
746751 }
747752 }
748753 }

Status & tagging log