Kaldari has uploaded a new change for review.
https://gerrit.wikimedia.org/r/155792
Change subject: Adding attribution information to mobile media viewer
......................................................................
Adding attribution information to mobile media viewer
Bug: 69656
Change-Id: I49701d5f99311f30af128e7c82a9eba77290690f
---
M i18n/en.json
M i18n/qqq.json
M includes/Resources.php
M javascripts/modules/mediaViewer/ImageOverlay.js
M templates/modules/ImageOverlay.hogan
5 files changed, 20 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/92/155792/1
diff --git a/i18n/en.json b/i18n/en.json
index 56c0c0b..831368e 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -166,6 +166,8 @@
"mobile-frontend-mainpage-cta-button": "Improve this page",
"mobile-frontend-mainpage-cta-prompt": "This page needs your help!",
"mobile-frontend-media-details": "Details",
+ "mobile-frontend-media-author": "Author",
+ "mobile-frontend-media-author-unknown": "Unknown",
"mobile-frontend-media-license-link": "License information",
"mobile-frontend-meta-data-issues": "This page has some issues",
"mobile-frontend-meta-data-issues-header": "Issues",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4b47c3b..a9c9c3e 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -192,6 +192,8 @@
"mobile-frontend-mainpage-cta-button": "Used as label for
button.\n\nPreceded by {{msg-mw|Mobile-frontend-mainpage-cta-prompt}}.",
"mobile-frontend-mainpage-cta-prompt": "Shows on main page to logged in
users prompting them to edit.\n\nFollowed by the button
{{msg-mw|Mobile-frontend-mainpage-cta-button}}.",
"mobile-frontend-media-details": "Caption for a button leading to the
details of a media file (e.g. an image) in a preview.\n{{Identical|Detail}}",
+ "mobile-frontend-media-author": "Placeholder for the name of the
author.",
+ "mobile-frontend-media-author-unknown": "Message displayed when the
author is unknown.",
"mobile-frontend-media-license-link": "Link to license information in
media viewer.\n{{Identical|License information}}",
"mobile-frontend-meta-data-issues": "This should be several words and
should explain that a page has cleanup templates on it - meaning there is room
for improvement on the page. It appears in a button that when clicked opens the
overlay with heading {{msg-mw|mobile-frontend-meta-data-issues-header}}",
"mobile-frontend-meta-data-issues-header": "Heading for overlay listing
all cleanup templates",
diff --git a/includes/Resources.php b/includes/Resources.php
index 8feebdb..7b48a48 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -554,6 +554,8 @@
// mediaViewer.js
'mobile-frontend-media-details',
'mobile-frontend-media-license-link',
+ 'mobile-frontend-media-author',
+ 'mobile-frontend-media-author-unknown',
),
),
diff --git a/javascripts/modules/mediaViewer/ImageOverlay.js
b/javascripts/modules/mediaViewer/ImageOverlay.js
index 43362f1..b681163 100644
--- a/javascripts/modules/mediaViewer/ImageOverlay.js
+++ b/javascripts/modules/mediaViewer/ImageOverlay.js
@@ -17,7 +17,8 @@
defaults: {
detailsMsg: mw.msg( 'mobile-frontend-media-details' ),
- licenseLinkMsg: mw.msg(
'mobile-frontend-media-license-link' )
+ licenseLinkMsg: mw.msg(
'mobile-frontend-media-license-link' ),
+ authorMsg: mw.msg( 'mobile-frontend-media-author' )
},
postRender: function( options ) {
@@ -25,6 +26,8 @@
this._super( options );
api.getThumb( options.title ).done( function( data ) {
+ var author;
+
function removeLoader() {
self.$( '.image-wrapper' ).removeClass(
'loading' );
}
@@ -48,6 +51,15 @@
if ( data.extmetadata &&
data.extmetadata.LicenseShortName ) {
self.$( '.license a' ).text(
data.extmetadata.LicenseShortName.value );
}
+ // Add author information
+ if ( data.extmetadata &&
data.extmetadata.Artist ) {
+ // Strip any tags
+ author =
data.extmetadata.Artist.value.replace( /<.*?>/g, '' );
+ self.$( '.license .author' ).text(
author );
+ } else {
+ self.$( '.license .author' )
+ .text( mw.msg(
'mobile-frontend-media-author-unknown' ));
+ }
} );
$( window ).on( 'resize', $.proxy( this,
'_positionImage' ) );
diff --git a/templates/modules/ImageOverlay.hogan
b/templates/modules/ImageOverlay.hogan
index 1454b02..de69c8c 100644
--- a/templates/modules/ImageOverlay.hogan
+++ b/templates/modules/ImageOverlay.hogan
@@ -8,6 +8,6 @@
<div class="details">
<a class="mw-ui-button mw-ui-progressive button"
href="#">{{detailsMsg}}</a>
<p>{{caption}}</p>
- <p class="license"><a href="#">{{licenseLinkMsg}}</a></p>
+ <p class="license"><span class="author">{{authorMsg}}</span>
• <a href="#">{{licenseLinkMsg}}</a></p>
</div>
</div>
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/155792
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I49701d5f99311f30af128e7c82a9eba77290690f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits