Gergő Tisza has uploaded a new change for review.
https://gerrit.wikimedia.org/r/169683
Change subject: Add icon for PD licenses
......................................................................
Add icon for PD licenses
Change-Id: I82c56a420d8d529a4a50cb66e64b191bbb36997f
---
M resources/mmv/model/mmv.model.License.js
M resources/mmv/ui/mmv.ui.metadataPanel.js
M tests/qunit/mmv/model/mmv.model.License.test.js
3 files changed, 28 insertions(+), 2 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer
refs/changes/83/169683/1
diff --git a/resources/mmv/model/mmv.model.License.js
b/resources/mmv/model/mmv.model.License.js
index abe651f..8e076e8 100644
--- a/resources/mmv/model/mmv.model.License.js
+++ b/resources/mmv/model/mmv.model.License.js
@@ -64,6 +64,14 @@
};
/**
+ * Check whether this is a public domain "license".
+ * @returns {boolean}
+ */
+ LP.isPd = function () {
+ return this.internalName === 'pd';
+ };
+
+ /**
* Returns the short name of the license:
* - if we have interface messages for this license (basically just CC
and PD), use those
* - otherwise use the short name from the license template (might or
might not be translated
diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js
b/resources/mmv/ui/mmv.ui.metadataPanel.js
index 69b5c4a..5281dcb 100644
--- a/resources/mmv/ui/mmv.ui.metadataPanel.js
+++ b/resources/mmv/ui/mmv.ui.metadataPanel.js
@@ -468,16 +468,17 @@
* @param {string} filePageUrl URL of the file description page
*/
MPP.setLicense = function ( license, filePageUrl ) {
- var shortName, url, isCc;
+ var shortName, url, isCc, isPd;
if ( license ) {
shortName = license.getShortName();
url = license.deedUrl || filePageUrl;
isCc = license.isCc();
+ isPd = license.isPd();
} else {
shortName = mw.message(
'multimediaviewer-license-default' ).text();
url = filePageUrl;
- isCc = false;
+ isCc = isPd = false;
}
this.$license
@@ -487,6 +488,7 @@
this.$licenseLi
.toggleClass( 'cc-license', isCc )
+ .toggleClass( 'pd-license', isCc )
.removeClass( 'empty' );
};
diff --git a/tests/qunit/mmv/model/mmv.model.License.test.js
b/tests/qunit/mmv/model/mmv.model.License.test.js
index 0aa59f2..8f3393e 100644
--- a/tests/qunit/mmv/model/mmv.model.License.test.js
+++ b/tests/qunit/mmv/model/mmv.model.License.test.js
@@ -116,4 +116,20 @@
license = new mw.mmv.model.License( 'MIT' );
assert.strictEqual( license.isCc(), false, 'Non-CC license with
no internal name not recognized' );
} );
+
+ QUnit.test( 'isPd()', 3, function( assert ) {
+ var license;
+
+ license = new mw.mmv.model.License( 'Public Domain', 'pd',
+ 'Public Domain for lack of originality' );
+ assert.strictEqual( license.isPd(), true, 'PD license
recognized' );
+
+ license = new mw.mmv.model.License( 'CC-BY-SA-2.0',
'cc-by-sa-2.0',
+ 'Creative Commons Attribution - ShareAlike 2.0',
+ 'http://creativecommons.org/licenses/by-sa/2.0/' );
+ assert.strictEqual( license.isPd(), false, 'Non-PD license not
recognized' );
+
+ license = new mw.mmv.model.License( 'MIT' );
+ assert.strictEqual( license.isPd(), false, 'Non-PD license with
no internal name not recognized' );
+ } );
}( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/169683
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82c56a420d8d529a4a50cb66e64b191bbb36997f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits