r85937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85936‎ | r85937 | r85938 >
Date:04:14, 13 April 2011
Author:neilk
Status:deferred
Tags:
Comment:
Collapsible interface for third party licenses
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/uploadWizard.css (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js
@@ -206,7 +206,7 @@
207207 _this.authorInput = $j('<textarea class="mwe-author mwe-long-textarea" name="author" rows="1" cols="40"></textarea>' )
208208 .growTextArea()
209209 .attr( 'title', gM( 'mwe-upwiz-tooltip-author' ) );
210 - licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' );
 210+ licenseInputDiv = $j( '<div></div>' );
211211 _this.licenseInput = new mw.UploadWizardLicenseInput( licenseInputDiv,
212212 undefined,
213213 mw.UploadWizard.config.licensesThirdParty,
@@ -397,7 +397,6 @@
398398 _this.deed = deed;
399399 if ( deed === mw.UploadWizardNullDeed ) {
400400 $j( _this ).trigger( 'chooseNullDeed' );
401 - //_this.trigger( 'isNotReady' );
402401 _this.$selector
403402 .find( 'input.mwe-accept-deed' )
404403 .attr( 'checked', false );
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js
@@ -51,6 +51,7 @@
5252 */
5353 function appendLicenses( $el, config ) {
5454 if ( !mw.isDefined( config['licenses'] && typeof config['licenses'] === 'object' ) ) {
 55+ console.log( config );
5556 throw new Error( "improper license config" );
5657 }
5758 $j.each( config['licenses'], function( i, name ) {
@@ -104,18 +105,28 @@
105106 throw new Error( 'improper config' );
106107 }
107108 var $group = $j( '<div></div>' ).addClass( 'mwe-upwiz-deed-license-group' );
 109+ // if there is no header, just append licenses to the group div.
 110+ var $body = $group;
 111+ // if there is a header, make a toggle-to-expand div and append to that instead.
108112 if ( mw.isDefined( group['head'] ) ) {
109 - $group.append( $j( '<p></p>' ).addClass( 'mwe-upwiz-deed-license-group-head' ).msg( group.head, _this.count ) );
 113+ var $head = $j( '<div></div>' ).append(
 114+ $j( '<a>' )
 115+ .addClass( 'mwe-upwiz-deed-license-group-head mwe-upwiz-toggler' )
 116+ .msg( group.head, _this.count )
 117+ );
 118+ $body = $j( '<div></div>' ).addClass( 'mwe-upwiz-toggler-content' ).css( { 'marginBottom': '1em' } );
 119+ $group.append( $head, $body ).collapseToggle();
110120 }
111121 if ( mw.isDefined( group['subhead'] ) ) {
112 - $group.append( $j( '<p></p>' ).addClass( 'mwe-upwiz-deed-license-group-subhead' ).msg( group.subhead, _this.count ) );
 122+ $body.append( $j( '<div></div>' ).addClass( 'mwe-upwiz-deed-license-group-subhead' ).msg( group.subhead, _this.count ) );
113123 }
114124 var $licensesDiv = $j( '<div></div>' ).addClass( 'mwe-upwiz-deed-license' );
115125 appendLicenses( $licensesDiv, group );
116 - $group.append( $licensesDiv );
 126+ $body.append( $licensesDiv );
117127 _this.$selector.append( $group );
118128 } );
119129
 130+
120131 } else {
121132 appendLicenses( _this.$selector, config );
122133 }
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css
@@ -626,6 +626,10 @@
627627 background: url('images/toggle-open.png') no-repeat left center;
628628 }
629629
 630+.mwe-upwiz-toggler-content {
 631+ padding-left: 18px;
 632+}
 633+
630634 .mwe-upwiz-toggled {
631635 margin-top: 1em;
632636 }
@@ -682,16 +686,6 @@
683687 #upload-wizard .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
684688 #upload-wizard .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
685689
686 -.mwe-upwiz-deed-license-group {
687 - margin-top: 1em;
688 - margin-bottom: 1.5em;
689 -}
690 -
691 -.mwe-upwiz-deed-license-group-head {
692 - font-weight: bold;
693 - margin-bottom: 0em;
694 -}
695 -
696690 .mwe-upwiz-deed-license-group-subhead {
697691 color: #797979;
698692 margin-top: 0em;
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -1550,6 +1550,31 @@
15511551 return this;
15521552 };
15531553
 1554+ /**
 1555+ * jQuery plugin - collapse toggle
 1556+ * Given an element, makes contained elements of class mw-collapsible-toggle clickable to show/reveal
 1557+ * contained element(s) of class mw-collapsible-content.
 1558+ *
 1559+ * Somewhat recapitulates mw.UploadWizardUtil.makeToggler,
 1560+ * toggle() in vector.collapsibleNav.js, not to mention jquery.collapsible
 1561+ * but none of those do what we want, or are inaccessible to us
 1562+ */
 1563+ jQuery.fn.collapseToggle = function() {
 1564+ var $el = this;
 1565+ var $contents = $el.find( '.mwe-upwiz-toggler-content' ).hide();
 1566+ var $toggle = $el.find( '.mwe-upwiz-toggler' ).addClass( 'mwe-upwiz-more-options' );
 1567+ $toggle.click( function( e ) {
 1568+ e.stopPropagation();
 1569+ if ( $toggle.hasClass( 'mwe-upwiz-toggler-open' ) ) {
 1570+ $contents.slideUp( 250 );
 1571+ $toggle.removeClass( 'mwe-upwiz-toggler-open' );
 1572+ } else {
 1573+ $contents.slideDown( 250 );
 1574+ $toggle.addClass( 'mwe-upwiz-toggler-open' );
 1575+ }
 1576+ } );
 1577+ return this;
 1578+ };
15541579
15551580 $j.validator.setDefaults( {
15561581 debug: true,

Follow-up revisions

RevisionCommit summaryAuthorDate
r85946UploadWizard: Remove console.log() call introduced in r85937catrope13:41, 13 April 2011

Status & tagging log