jenkins-bot has submitted this change and it was merged.
Change subject: Use checkboxShiftClick for "Copy Metadata" checkboxes
......................................................................
Use checkboxShiftClick for "Copy Metadata" checkboxes
With CheckboxShiftClick functionality, the user can change the state of
multiple checkboxes at once by pressing the shift key. This
functionality is enabled by default for all checkboxes that are present
when mw.hook('wikipage.content') is fired but not for checkboxes like
these that are dynamically generated using JavaScript.
Another way to achieve this would be firing the hook as soon as Upload
Wizard makes changes to the HTML DOM:
mw.hooks('wikipage.content').fire( <content that was newly created> );
This would have the downside that other scripts could interfere with
UploadWizards controls in unforeseeable ways.
Also did some cleanup:
* Marking instances of jQuery with $-prefix
* Declaring variables in the beginning of the function.
Change-Id: I97f95e10bcfd03105a7907d95c10a78d944083db
---
M UploadWizardHooks.php
M resources/mw.UploadWizardDetails.js
2 files changed, 17 insertions(+), 9 deletions(-)
Approvals:
Gilles: Looks good to me, approved
jenkins-bot: Verified
diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index fce286d..73e4d94 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -13,6 +13,7 @@
'dependencies' => array(
'jquery.arrowSteps',
'jquery.autoEllipsis',
+ 'jquery.checkboxShiftClick',
'jquery.client',
'jquery.ui.core',
'jquery.ui.dialog',
diff --git a/resources/mw.UploadWizardDetails.js
b/resources/mw.UploadWizardDetails.js
index 9a244c2..dc975da 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -611,14 +611,16 @@
* a metadata copy widget for the details view of this specific upload
*/
buildAndShowCopyMetadata: function() {
- var _this = this;
+ var _this = this,
+ $copyMetadataDiv = $( '<div
class="mwe-upwiz-metadata-copier"></div>' ),
+ $checkboxes = $();
+
if( mw.UploadWizard.config.copyMetadataFeature !== true ||
_this.copyMetadataCtrlDiv !== undefined ) {
return;
}
_this.copyMetadataCtrlDiv = $( '<div
class="mwe-upwiz-details-copy-metadata"></div>' );
- var copyMetadataDiv = $( '<div
class="mwe-upwiz-metadata-copier"></div>' );
$.each( _this.copyMetadataTypes, function addToMetadataDiv(
metadataName, defaultStatus ) {
var copyMessage = 'mwe-upwiz-copy-' + metadataName,
@@ -630,15 +632,20 @@
copyMetadataMsg = mw.message( copyMessage
).text();
}
$checkbox = $( '<input>' ).attr( 'type', 'checkbox'
).attr( 'name', copyMessage ).attr( 'id', copyMessage );
+ $checkboxes = $checkboxes.add( $checkbox );
if ( defaultStatus === true ) {
$checkbox.attr( 'checked', 'checked' );
}
- copyMetadataDiv.append( $checkbox );
- copyMetadataDiv.append( $( '<label for="' + copyMessage
+ '"></label>' ).text( copyMetadataMsg ) );
- copyMetadataDiv.append( $( '<br />' ) );
- } ) ;
- copyMetadataDiv.append(
+ $copyMetadataDiv
+ .append( $checkbox )
+ .append( $( '<label for="' + copyMessage +
'"></label>' ).text( copyMetadataMsg ) )
+ .append( $( '<br />' ) );
+ } ) ;
+ $checkboxes.checkboxShiftClick();
+
+
+ $copyMetadataDiv.append(
$( '<button type="button"
id="mwe-upwiz-copy-metadata-button"></button>' )
.msg( 'mwe-upwiz-copy-metadata-button' )
.button()
@@ -661,11 +668,11 @@
mw.UploadWizardUtil.makeToggler(
_this.copyMetadataCtrlDiv,
- copyMetadataDiv,
+ $copyMetadataDiv,
'mwe-upwiz-copy-metadata'
);
- _this.$form.append( _this.copyMetadataCtrlDiv, copyMetadataDiv
);
+ _this.$form.append( _this.copyMetadataCtrlDiv, $copyMetadataDiv
);
_this.copyMetadataCtrlDiv.show();
},
--
To view, visit https://gerrit.wikimedia.org/r/84003
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I97f95e10bcfd03105a7907d95c10a78d944083db
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Rillke <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Rillke <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits