r63443 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63442‎ | r63443 | r63444 >
Date:23:24, 8 March 2010
Author:tparscal
Status:deferred
Tags:
Comment:
Changed the layout of template dialogs to be more table-like. Added auto-sizing to the inputs.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.dialogs.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -22,18 +22,18 @@
2323 array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 7 ),
2424 array( 'src' => 'css/vector.footerCleanup.css', 'version' => 1 ),
2525 array( 'src' => 'css/wikiEditor.css', 'version' => 12 ),
26 - array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 23 ),
 26+ array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 24 ),
2727 array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ),
2828 array( 'src' => 'css/wikiEditor.toc.css', 'version' => 28 ),
2929 array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 11 ),
3030 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3131 ),
3232 'combined' => array(
33 - array( 'src' => 'css/combined.css', 'version' => 71 ),
 33+ array( 'src' => 'css/combined.css', 'version' => 72 ),
3434 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3535 ),
3636 'minified' => array(
37 - array( 'src' => 'css/combined.min.css', 'version' => 71 ),
 37+ array( 'src' => 'css/combined.min.css', 'version' => 72 ),
3838 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3939 ),
4040 )
@@ -78,14 +78,14 @@
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ),
82 - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 38 ),
 82+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 39 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 307 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 308 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 307 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 308 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.dialogs.css
@@ -227,16 +227,23 @@
228228 /* Template Editor Dialogs */
229229 .wikiEditor-template-dialog-fields label {
230230 text-transform: capitalize;
 231+ float: left;
 232+ width: 25%;
 233+ line-height: 1.5em;
231234 }
 235+.wikiEditor-template-dialog-fields textarea {
 236+ float: right;
 237+ width: 70%;
 238+ line-height: 1.5em;
 239+ height: 1.5em;
 240+}
232241 .wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper {
233 - padding: 0 0 25px 0;
 242+ padding: 0.75em 0.33em;
 243+ border-bottom: dashed 1px silver;
 244+ clear: both;
234245 }
235 -.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper label {
236 - display: block;
237 -}
238 -.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper input {
239 - width: 100%;
240 -}
 246+
 247+
241248 /* Self Clearing Floats */
242249 .wikieditor-toolbar-table-dimension-fields:after,
243250 .wikieditor-toolbar-dialog-wrapper:after {
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -474,16 +474,23 @@
475475 /* Template Editor Dialogs */
476476 .wikiEditor-template-dialog-fields label {
477477 text-transform: capitalize;
 478+ float: left;
 479+ width: 25%;
 480+ line-height: 1.5em;
478481 }
 482+.wikiEditor-template-dialog-fields textarea {
 483+ float: right;
 484+ width: 70%;
 485+ line-height: 1.5em;
 486+ height: 1.5em;
 487+}
479488 .wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper {
480 - padding: 0 0 25px 0;
 489+ padding: 0.75em 0.33em;
 490+ border-bottom: dashed 1px silver;
 491+ clear: both;
481492 }
482 -.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper label {
483 - display: block;
484 -}
485 -.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper input {
486 - width: 100%;
487 -}
 493+
 494+
488495 /* Self Clearing Floats */
489496 .wikieditor-toolbar-table-dimension-fields:after,
490497 .wikieditor-toolbar-dialog-wrapper:after {
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -451,16 +451,21 @@
452452 }
453453 .wikiEditor-template-dialog-fields label{
454454 text-transform:capitalize;
 455+float:left;
 456+width:25%;
 457+line-height:1.5em;
455458 }
 459+.wikiEditor-template-dialog-fields textarea{
 460+float:right;
 461+width:70%;
 462+line-height:1.5em;
 463+height:1.5em;
 464+}
456465 .wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper{
457 -padding:0 0 25px 0;
 466+padding:0.75em 0.33em;
 467+border-bottom:dashed 1px silver;
 468+clear:both;
458469 }
459 -.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper label{
460 -display:block;
461 -}
462 -.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper input{
463 -width:100%;
464 -}
465470 .wikieditor-toolbar-table-dimension-fields:after,
466471 .wikieditor-toolbar-dialog-wrapper:after{
467472 visibility:hidden;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -210,7 +210,7 @@
211211
212212 var $templateText = $templateDiv.children( '.wikiEditor-template-text' );
213213 var templateModel = $templateText.data( 'model' );
214 - $( this ).find( '.wikiEditor-template-dialog-field-wrapper input' ).each( function() {
 214+ $( this ).find( '.wikiEditor-template-dialog-field-wrapper textarea' ).each( function() {
215215 templateModel.setValue( $( this ).data( 'name' ), $( this ).val() );
216216 });
217217 //keep text consistent
@@ -258,10 +258,29 @@
259259 $( '<label />' )
260260 .text( paramText )
261261 .appendTo( $paramRow );
262 - $( '<input />' )
 262+ $( '<textarea />' )
263263 .data( 'name', param.name )
264264 .val( paramVal )
 265+ .bind( 'cut paste keypress click', function() {
 266+ $this = $(this);
 267+ setTimeout( function() {
 268+ var expanded = $this.data( 'expanded' );
 269+ if ( $this.val().length > 24 ) {
 270+ if ( !expanded ) {
 271+ $this.animate( { 'height': '4.5em' }, 'fast' );
 272+ $this.data( 'expanded', true );
 273+ }
 274+ } else {
 275+ if ( expanded ) {
 276+ $this.animate( { 'height': '1.5em' }, 'fast' );
 277+ $this.data( 'expanded', false );
 278+ }
 279+ }
 280+ }, 0 );
 281+ } )
265282 .appendTo( $paramRow );
 283+ $( '<div style="clear:both"></div>' )
 284+ .appendTo( $paramRow );
266285 $fields.append( $paramRow );
267286 }
268287 // Remove any leftover rows
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -9312,7 +9312,7 @@
93139313
93149314 var $templateText = $templateDiv.children( '.wikiEditor-template-text' );
93159315 var templateModel = $templateText.data( 'model' );
9316 - $( this ).find( '.wikiEditor-template-dialog-field-wrapper input' ).each( function() {
 9316+ $( this ).find( '.wikiEditor-template-dialog-field-wrapper textarea' ).each( function() {
93179317 templateModel.setValue( $( this ).data( 'name' ), $( this ).val() );
93189318 });
93199319 //keep text consistent
@@ -9360,10 +9360,29 @@
93619361 $( '<label />' )
93629362 .text( paramText )
93639363 .appendTo( $paramRow );
9364 - $( '<input />' )
 9364+ $( '<textarea />' )
93659365 .data( 'name', param.name )
93669366 .val( paramVal )
 9367+ .bind( 'cut paste keypress click', function() {
 9368+ $this = $(this);
 9369+ setTimeout( function() {
 9370+ var expanded = $this.data( 'expanded' );
 9371+ if ( $this.val().length > 24 ) {
 9372+ if ( !expanded ) {
 9373+ $this.animate( { 'height': '4.5em' }, 'fast' );
 9374+ $this.data( 'expanded', true );
 9375+ }
 9376+ } else {
 9377+ if ( expanded ) {
 9378+ $this.animate( { 'height': '1.5em' }, 'fast' );
 9379+ $this.data( 'expanded', false );
 9380+ }
 9381+ }
 9382+ }, 0 );
 9383+ } )
93679384 .appendTo( $paramRow );
 9385+ $( '<div style="clear:both"></div>' )
 9386+ .appendTo( $paramRow );
93689387 $fields.append( $paramRow );
93699388 }
93709389 // Remove any leftover rows
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -644,9 +644,9 @@
645645 <fieldset>\
646646 <div class="wikiEditor-template-dialog-title" />\
647647 <div class="wikiEditor-template-dialog-fields" />\
648 - </fieldset>',init:function(){$(this).find('[rel]').each(function(){$(this).text(mw.usability.getMsg($(this).attr('rel')));});},dialog:{width:600,height:400,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-template-editor-dialog-submit':function(){var $templateDiv=$(this).data('templateDiv');context.fn.highlightLine($templateDiv);var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');$(this).find('.wikiEditor-template-dialog-field-wrapper input').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$.wikiEditor.modules.templateEditor.fn.updateModel($templateText,templateModel);$(this).dialog('close');}},open:function(){var $templateDiv=$(this).data('templateDiv');var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');if($templateText.html()!=$templateText.data('oldHTML')){templateModel=$.wikiEditor.modules.templateEditor.fn.updateModel($templateText);}
 648+ </fieldset>',init:function(){$(this).find('[rel]').each(function(){$(this).text(mw.usability.getMsg($(this).attr('rel')));});},dialog:{width:600,height:400,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-template-editor-dialog-submit':function(){var $templateDiv=$(this).data('templateDiv');context.fn.highlightLine($templateDiv);var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');$(this).find('.wikiEditor-template-dialog-field-wrapper textarea').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$.wikiEditor.modules.templateEditor.fn.updateModel($templateText,templateModel);$(this).dialog('close');}},open:function(){var $templateDiv=$(this).data('templateDiv');var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');if($templateText.html()!=$templateText.data('oldHTML')){templateModel=$.wikiEditor.modules.templateEditor.fn.updateModel($templateText);}
649649 var params=templateModel.getAllInitialParams();var $fields=$(this).find('.wikiEditor-template-dialog-fields').empty();var $rows=$fields.find('.wikiEditor-template-dialog-field-wrapper');for(var paramIndex in params){var param=params[paramIndex];if(typeof param.name=='undefined'){continue;}
650 -var paramText=typeof param=='string'?param.name.replace(/[\_\-]/g,' '):param.name;var paramVal=templateModel.getValue(param.name);if($rows.length>0){var $row=$rows.eq(0);$row.children('label').text(paramText);$row.children('input').val(paramVal);$rows=$rows.not($row);}else{var $paramRow=$('<div />').addClass('wikiEditor-template-dialog-field-wrapper');$('<label />').text(paramText).appendTo($paramRow);$('<input />').data('name',param.name).val(paramVal).appendTo($paramRow);$fields.append($paramRow);}
 650+var paramText=typeof param=='string'?param.name.replace(/[\_\-]/g,' '):param.name;var paramVal=templateModel.getValue(param.name);if($rows.length>0){var $row=$rows.eq(0);$row.children('label').text(paramText);$row.children('input').val(paramVal);$rows=$rows.not($row);}else{var $paramRow=$('<div />').addClass('wikiEditor-template-dialog-field-wrapper');$('<label />').text(paramText).appendTo($paramRow);$('<textarea />').data('name',param.name).val(paramVal).bind('cut paste keypress click',function(){$this=$(this);setTimeout(function(){var expanded=$this.data('expanded');if($this.val().length>24){if(!expanded){$this.animate({'height':'4.5em'},'fast');$this.data('expanded',true);}}else{if(expanded){$this.animate({'height':'1.5em'},'fast');$this.data('expanded',false);}}},0);}).appendTo($paramRow);$('<div style="clear:both"></div>').appendTo($paramRow);$fields.append($paramRow);}
651651 $rows.remove();}
652652 $(this).parent('.ui-dialog').find('.ui-dialog-titlebar-close').removeClass('ui-state-focus');}}};function createDialog($templateDiv){context.$textarea.wikiEditor('addDialog',{'templateEditor':dialog});$('#'+dialog.id).data('templateDiv',$templateDiv).dialog('open');}},unwrapTemplate:function($wrapper){$wrapper.parent().replaceWith($wrapper);},updateModel:function($templateText,model){var context=$templateText.data('marker').context;var text;if(typeof model=='undefined'){text=context.fn.htmlToText($templateText.html());}else{text=model.getText();}
653653 $templateText.text(text);$templateText.html($templateText.html().replace(/\n/g,'<br />'));$templateText.data('oldHTML',$templateText.html());if(typeof model=='undefined'){model=new $.wikiEditor.modules.templateEditor.fn.model(text);$templateText.data('model',model);}

Follow-up revisions

RevisionCommit summaryAuthorDate
r63461UsabilityInitiative: Assorted fixes...catrope11:09, 9 March 2010

Status & tagging log