jenkins-bot has submitted this change and it was merged.

Change subject: Add icon for PD licenses
......................................................................


Add icon for PD licenses

Change-Id: I82c56a420d8d529a4a50cb66e64b191bbb36997f
---
M resources/mmv/model/mmv.model.License.js
A resources/mmv/ui/img/pd.svg
M resources/mmv/ui/mmv.ui.metadataPanel.js
M resources/mmv/ui/mmv.ui.metadataPanel.less
M tests/qunit/mmv/model/mmv.model.License.test.js
5 files changed, 86 insertions(+), 2 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



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/img/pd.svg b/resources/mmv/ui/img/pd.svg
new file mode 100644
index 0000000..eb4d750
--- /dev/null
+++ b/resources/mmv/ui/img/pd.svg
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   version="1.0"
+   width="64"
+   height="64"
+   viewBox="5.5 -3.5 64 64"
+   id="svg2">
+  <metadata
+     id="metadata12">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs10" />
+  <g
+     transform="matrix(0.89136054,0,0,0.89136054,431.08023,-311.5986)"
+     id="g29">
+    <path
+       d="m -434,375.8 c -0.2,-1.5 -0.7,-2.8 -1.5,-3.9 -1.1,-1.6 -2.9,-2.4 
-5.3,-2.4 -3.4,0 -5.8,1.7 -7.1,5.1 -0.7,1.8 -1,4.2 -1,7.2 0,2.9 0.3,5.1 1,6.9 
1.2,3.2 3.5,4.9 6.9,4.9 2.4,0 4.1,-0.6 5.1,-1.9 1,-1.3 1.6,-3 1.8,-5 h 10.4 c 
-0.2,3.1 -1.4,6 -3.4,8.8 -3.2,4.5 -7.9,6.7 -14.2,6.7 -6.3,0 -10.9,-1.9 
-13.8,-5.6 -3,-3.7 -4.4,-8.5 -4.4,-14.5 0,-6.7 1.6,-11.9 4.9,-15.6 3.3,-3.7 
7.8,-5.6 13.5,-5.6 4.9,0 8.9,1.1 12,3.3 3.1,2.2 5,6.1 5.5,11.6 H -434 z"
+       id="path31"
+       style="fill:#939598" />
+  </g>
+  <g
+     transform="translate(0,80)"
+     id="g3410">
+    <path
+       d="m 37.35,-83.5 c 9,0 16.6,3.1 22.9,9.4 3,3 5.3,6.4 6.9,10.3 1.6,3.9 
2.3,8 2.3,12.3 0,4.4 -0.8,8.5 -2.3,12.3 -1.5,3.8 -3.8,7.2 -6.8,10.1 -3.1,3.1 
-6.7,5.4 -10.6,7.1 -4,1.6 -8.1,2.5 -12.3,2.5 -4.2,0 -8.3,-0.8 -12.1,-2.4 
-3.9,-1.6 -7.3,-4 -10.4,-7 -3.1,-3.1 -5.4,-6.5 -7,-10.4 -1.6,-3.8 -2.4,-7.9 
-2.4,-12.2 0,-4.2 0.8,-8.3 2.4,-12.2 1.6,-3.9 4,-7.4 7.1,-10.5 5.9,-6.2 
13.4,-9.3 22.3,-9.3 l 0,0 z m 0.1,5.8 c -7.3,0 -13.5,2.6 -18.5,7.7 -2.5,2.6 
-4.4,5.4 -5.8,8.6 -1.4,3.2 -2,6.5 -2,10 0,3.4 0.7,6.7 2,9.9 1.4,3.2 3.3,6 
5.8,8.5 2.5,2.5 5.4,4.4 8.5,5.7 3.2,1.3 6.5,2 9.9,2 3.4,0 6.8,-0.7 10,-2 
3.2,-1.3 6.1,-3.3 8.7,-5.8 5,-4.9 7.5,-11 7.5,-18.3 0,-3.5 -0.6,-6.9 -1.9,-10.1 
-1.3,-3.2 -3.2,-6 -5.7,-8.5 -5.1,-5.1 -11.3,-7.7 -18.5,-7.7 l 0,0 z"
+       id="path6-0_1_-2"
+       style="fill:#939598" />
+    <rect
+       width="8.5010338"
+       height="55.099468"
+       x="5.6489754"
+       y="35.382771"
+       transform="matrix(-0.70710678,-0.70710678,0.70710678,-0.70710678,0,0)"
+       id="rect3025-8_1_-4"
+       style="fill:#939598" />
+  </g>
+</svg>
diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js 
b/resources/mmv/ui/mmv.ui.metadataPanel.js
index 69b5c4a..90cb257 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', isPd )
                        .removeClass( 'empty' );
        };
 
diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.less 
b/resources/mmv/ui/mmv.ui.metadataPanel.less
index 8996bda..e16d09d 100644
--- a/resources/mmv/ui/mmv.ui.metadataPanel.less
+++ b/resources/mmv/ui/mmv.ui.metadataPanel.less
@@ -125,6 +125,11 @@
                        background-image: url(img/cc.svg);
                }
 
+               &.mw-mmv-license-li.pd-license:before {
+                       /* @embed */
+                       background-image: url(img/pd.svg);
+               }
+
                &.mw-mmv-datetime-li:before {
                        /* @embed */
                        background-image: url(img/time.svg);
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: merged
Gerrit-Change-Id: I82c56a420d8d529a4a50cb66e64b191bbb36997f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: Pginer <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to