r51525 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51524‎ | r51525 | r51526 >
Date:23:37, 5 June 2009
Author:tparscal
Status:deferred
Tags:
Comment:
Added filters to tools to allow them to only appear under certain conditions. Also added a signature button for talk namespaces and restricted the reference button to subject namespaces.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/images/insert-signature.png (added) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -134,6 +134,21 @@
135135 };
136136 // Loops over each tool
137137 for ( tool in section.groups[group] ) {
 138+ // Filters are jQuery selectors which must select 1 or more
 139+ // elements for this tool to apear. This is especailly
 140+ // useful for restricting some tools to certain namespaces
 141+ if ( 'filters' in section.groups[group][tool] ) {
 142+ var filters = section.groups[group][tool].filters;
 143+ var skip = false;
 144+ for ( filter in filters ) {
 145+ if ( $( filters[filter] ).size() == 0 ) {
 146+ skip = true;
 147+ }
 148+ }
 149+ if ( skip ) {
 150+ continue;
 151+ }
 152+ }
138153 // Creates context for use in action
139154 var context = { 'tool': section.groups[group][tool], 'textbox': textbox };
140155 // Creates the label of the tool
@@ -303,6 +318,7 @@
304319 },
305320 'reference': {
306321 labelMsg: 'edittoolbar-insert-reference',
 322+ filters: [ 'body.ns-subject' ],
307323 type: 'button',
308324 icon: 'insert-reference.png',
309325 action: {
@@ -313,6 +329,18 @@
314330 post: "</ref>"
315331 }
316332 }
 333+ },
 334+ 'signature': {
 335+ labelMsg: 'edittoolbar-insert-signature',
 336+ filters: [ 'body.ns-talk' ],
 337+ type: 'button',
 338+ icon: 'insert-signature.png',
 339+ action: {
 340+ type: 'encapsulate',
 341+ options: {
 342+ post: "--~~~~",
 343+ }
 344+ }
317345 }
318346 }
319347 }
Index: trunk/extensions/UsabilityInitiative/EditToolbar/images/insert-signature.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/UsabilityInitiative/EditToolbar/images/insert-signature.png
___________________________________________________________________
Added: svn:mime-type
320348 + application/octet-stream

Status & tagging log