Include license in title attribute of link in FileUsageDialog

The title attribute of the link that wraps the image
in "Use this file on another website" will be set to
the license and/or author of the image, if available.

Bug: 56588
Change-Id: I5f504964ec3a63e4927385cb68e90856eb4cfe37
This commit is contained in:
theopolisme 2013-12-18 17:20:58 -06:00
parent d98824f0a8
commit 343e82cc8c
2 changed files with 8 additions and 1 deletions

View file

@ -627,6 +627,9 @@
// Cannot display, fallback or fail
license = 'default';
msgname = 'multimediaviewer-license-default';
} else {
// License found, store the license data
ui.$license.data( 'license', mw.message( msgname ).text() );
}
if ( license ) {

View file

@ -327,6 +327,10 @@
pattern = /^\/[^\/]/,
finalLink = pattern.test(link) ? linkPrefix +link: link,
license = this.$license.data( 'license' ) || '',
author = this.$author.text(),
linkTitle = ( license + ( author ? ' (' + author + ')' : '' ) ).trim(),
owtId = 'mw-mlb-use-file-onwiki-thumb',
ownId = 'mw-mlb-use-file-onwiki-normal',
owId = 'mw-mlb-use-file-offwiki',
@ -373,7 +377,7 @@
.prop( 'id', owId )
.prop( 'readonly', true )
.focus( selectAllOnEvent )
.val( '<a href="' + finalLink + '"><img src="' + src + '" /></a>' ),
.val( '<a href="' + finalLink + ( linkTitle ? '" title="' + linkTitle : '' ) + '" ><img src="' + src + '" /></a>' ),
$offWiki = $( '<div>' )