mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-27 17:40:06 +00:00
Change "view terms" to "hide terms" once clicked
metadataPanel overrides the grow() and shrink() methods in Permission class instance, so the text is changed also when user clicks the "view more" link inside the box. Bug: T71233 Change-Id: I66fe57980c6f469d86e3d52b67d01e06a3a14270
This commit is contained in:
parent
ed5d49f1b6
commit
dac77cafc4
|
@ -594,6 +594,7 @@ $wgResourceModules += array(
|
|||
|
||||
// for license messages see end of file
|
||||
'multimediaviewer-permission-link',
|
||||
'multimediaviewer-permission-link-hide',
|
||||
|
||||
'multimediaviewer-geoloc-north',
|
||||
'multimediaviewer-geoloc-east',
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
"multimediaviewer-license-default": "View license",
|
||||
"multimediaviewer-permission-title": "Permission details",
|
||||
"multimediaviewer-permission-link": "view terms",
|
||||
"multimediaviewer-permission-link-hide": "hide terms",
|
||||
"multimediaviewer-permission-viewmore": "View more",
|
||||
"multimediaviewer-about-mmv": "About Media Viewer",
|
||||
"multimediaviewer-discuss-mmv": "Discuss this feature",
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
"multimediaviewer-license-pd": "Very short label for Public Domain images, used in a link to the file information page that has more licensing information.\n{{Identical|Public domain}}",
|
||||
"multimediaviewer-license-default": "Short label for a link to generic license information.",
|
||||
"multimediaviewer-permission-title": "Title of the box containing additional permission (by the copyright owner via OTRS) terms",
|
||||
"multimediaviewer-permission-link": "Text of the link (on top of the metadata box) which shows additional permission (by the copyright owner via OTRS) terms",
|
||||
"multimediaviewer-permission-link": "Text of the link (on top of the metadata box) which shows additional permission (by the copyright owner via OTRS) terms\n\nSee also:\n* {{msg-mw|multimediaviewer-permission-link-hide}}",
|
||||
"multimediaviewer-permission-link-hide": "Text of the link (on top of the metadata box) which hides additional permission terms\n\nSee also:\n* {{msg-mw|multimediaviewer-permission-link}}",
|
||||
"multimediaviewer-permission-viewmore": "Text of the link (at the cutoff of the permission term preview) which shows additional permission (by the copyright owner via OTRS) terms.\n{{Identical|View more}}",
|
||||
"multimediaviewer-about-mmv": "Text for a link to a page with more information about Media Viewer software.",
|
||||
"multimediaviewer-discuss-mmv": "Text for a link to a page where the user can discuss the Media Viewer software.",
|
||||
|
|
|
@ -104,6 +104,12 @@
|
|||
}
|
||||
} ).on( 'mouseenter.mmv-mp', function () {
|
||||
clearTimeout( panel.panelShrinkTimeout );
|
||||
} ).on( 'mmv-permission-grow.mmv-mp', function() {
|
||||
panel.$permissionLink
|
||||
.text( mw.message( 'multimediaviewer-permission-link-hide' ).text() );
|
||||
} ).on( 'mmv-permission-shrink.mmv-mp', function() {
|
||||
panel.$permissionLink
|
||||
.text( mw.message( 'multimediaviewer-permission-link' ).text() );
|
||||
} );
|
||||
|
||||
this.handleEvent( 'jq-fullscreen-change.lip', function() {
|
||||
|
@ -321,8 +327,12 @@
|
|||
.appendTo( this.$licenseLi )
|
||||
.hide()
|
||||
.on( 'click', function() {
|
||||
panel.permission.grow();
|
||||
panel.scroller.toggle( 'up' );
|
||||
if ( panel.permission.isFullSize() ) {
|
||||
panel.permission.shrink();
|
||||
} else {
|
||||
panel.permission.grow();
|
||||
panel.scroller.toggle( 'up' );
|
||||
}
|
||||
return false;
|
||||
} );
|
||||
};
|
||||
|
|
|
@ -135,6 +135,7 @@
|
|||
|
||||
/**
|
||||
* Enlarge the box, show HTML instead of text.
|
||||
* @fires mmv-permission-grow
|
||||
*/
|
||||
P.grow = function() {
|
||||
mw.mmv.actionLogger.log( 'terms-open' );
|
||||
|
@ -143,13 +144,24 @@
|
|||
.stop( true )
|
||||
.animate( { backgroundColor: '#FFFFA0' }, 500)
|
||||
.animate( { backgroundColor: '#FFFFFF' }, 500);
|
||||
this.$container.trigger( 'mmv-permission-grow' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Limit the size of the box, show text only.
|
||||
* @fires mmv-permission-shrink
|
||||
*/
|
||||
P.shrink = function() {
|
||||
this.$box.removeClass( 'full-size' );
|
||||
this.$container.trigger( 'mmv-permission-shrink' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether the box is full-size.
|
||||
* @returns boolean
|
||||
*/
|
||||
P.isFullSize = function() {
|
||||
return this.$box.hasClass( 'full-size' );
|
||||
};
|
||||
|
||||
mw.mmv.ui.Permission = Permission;
|
||||
|
|
|
@ -101,4 +101,19 @@
|
|||
|
||||
$.fn.animate = oldAnimate;
|
||||
} );
|
||||
|
||||
QUnit.test( 'isFullSize()', 3, function( assert ) {
|
||||
var $qf = $( '#qunit-fixture' ),
|
||||
permission = new mw.mmv.ui.Permission( $qf ),
|
||||
text = 'Nothing to see here.';
|
||||
// animation would keep running, conflict with other tests
|
||||
this.sandbox.stub( $.fn, 'animate' ).returnsThis();
|
||||
|
||||
permission.set( text );
|
||||
assert.ok( !permission.isFullSize(), 'permission is not full-size' );
|
||||
permission.grow();
|
||||
assert.ok( permission.isFullSize(), 'permission is full-size' );
|
||||
permission.shrink();
|
||||
assert.ok( !permission.isFullSize(), 'permission is not full-size again' );
|
||||
} );
|
||||
}( mediaWiki, jQuery ) );
|
||||
|
|
Loading…
Reference in a new issue