mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 12:53:24 +00:00
Merge "Fix commons icon to avoid pixelation"
This commit is contained in:
commit
6dae43b0cf
25
resources/mmv/ui/img/commons.svg
Normal file
25
resources/mmv/ui/img/commons.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 7.7 KiB |
|
@ -423,7 +423,7 @@
|
||||||
this.$repo.text( repositoryMessage );
|
this.$repo.text( repositoryMessage );
|
||||||
|
|
||||||
this.$repoLi.css( 'background-image',
|
this.$repoLi.css( 'background-image',
|
||||||
repoInfo.favIcon ? 'url("' + repoInfo.favIcon + '")' : null );
|
( repoInfo.favIcon && !isCommons ) ? 'url("' + repoInfo.favIcon + '")' : '' );
|
||||||
|
|
||||||
this.$repoLi.toggleClass( 'commons', isCommons );
|
this.$repoLi.toggleClass( 'commons', isCommons );
|
||||||
this.$repoSubtitle.text(
|
this.$repoSubtitle.text(
|
||||||
|
|
|
@ -157,6 +157,8 @@
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
|
|
||||||
&.commons { // there is an extra subtitle for Commons images, box should be larger
|
&.commons { // there is an extra subtitle for Commons images, box should be larger
|
||||||
|
/* @embed */
|
||||||
|
background-image: url(img/commons.svg);
|
||||||
@icon-size: 32px;
|
@icon-size: 32px;
|
||||||
min-height: @icon-size;
|
min-height: @icon-size;
|
||||||
padding-left: @icon-size + 2 * @padding;
|
padding-left: @icon-size + 2 * @padding;
|
||||||
|
|
|
@ -274,4 +274,27 @@
|
||||||
|
|
||||||
$qf.removeClass( 'invited' );
|
$qf.removeClass( 'invited' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
QUnit.test( 'Repo icon', 4, function ( assert ) {
|
||||||
|
var $qf = $( '#qunit-fixture' ),
|
||||||
|
panel = new mw.mmv.ui.MetadataPanel( $qf, $( '<div>' ).appendTo( $qf ) ),
|
||||||
|
favIcon = 'http://foo.com/bar',
|
||||||
|
repoData = {
|
||||||
|
favIcon: favIcon,
|
||||||
|
getArticlePath : function() { return 'Foo'; },
|
||||||
|
isCommons: function() { return false; }
|
||||||
|
};
|
||||||
|
|
||||||
|
panel.setRepoDisplay( repoData );
|
||||||
|
|
||||||
|
assert.ok( panel.$repoLi.css( 'background-image' ).indexOf( favIcon ) !== -1, 'Repo favicon is correctly applied' );
|
||||||
|
assert.ok( !panel.$repoLi.hasClass( 'commons' ), 'Repo does not have commons class' );
|
||||||
|
|
||||||
|
repoData.isCommons = function() { return true; };
|
||||||
|
|
||||||
|
panel.setRepoDisplay( repoData );
|
||||||
|
|
||||||
|
assert.ok( panel.$repoLi.css( 'background-image' ).indexOf( 'data:image/svg+xml' ) !== -1, 'Repo favicon is correctly replaced by svg for Commons' );
|
||||||
|
assert.ok( panel.$repoLi.hasClass( 'commons' ), 'Repo has commons class' );
|
||||||
|
} );
|
||||||
}( mediaWiki, jQuery ) );
|
}( mediaWiki, jQuery ) );
|
||||||
|
|
Loading…
Reference in a new issue