Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cc icons and location they are served from #173

Merged
merged 2 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32,669 changes: 16,391 additions & 16,278 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/assets/license-icons/by.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions src/assets/license-icons/cc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/assets/license-icons/nc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/assets/license-icons/nd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/assets/license-icons/sa.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/assets/license-icons/zero.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/components/LicenseDetailsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ export default {
background-size: 35px 35px;
}
.license-list-item.zero::before {
background-image: url("../assets/license-icons/cc-cc0_icon.svg");
background-image: url("../assets/license-icons/zero.svg");
}
.license-list-item.by::before {
background-image: url("../assets/license-icons/cc-by_icon.svg");
background-image: url("../assets/license-icons/by.svg");
}
.license-list-item.nc::before {
background-image: url("../assets/license-icons/cc-nc_icon.svg");
background-image: url("../assets/license-icons/nc.svg");
}
.license-list-item.nd::before {
background-image: url("../assets/license-icons/cc-nd_icon.svg");
background-image: url("../assets/license-icons/nd.svg");
}
.license-list-item.sa::before {
background-image: url("../assets/license-icons/cc-sa_icon.svg");
background-image: url("../assets/license-icons/sa.svg");
}
.readable-string {
padding-left:51px;
Expand Down
4 changes: 2 additions & 2 deletions src/components/LicenseIcons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
class="photo-license-icon"
alt="CC icon"
title="CC icon"
src="../assets/license-icons/cc_icon.svg"
src="../assets/license-icons/cc.svg"
>
<img
v-for="(license, index) in iconsArr"
:key="index"
class="photo-license-icon"
:alt="license + ' icon'"
:title="license + ' icon'"
:src="require(`../assets/license-icons/cc-${license.toLowerCase()}_icon.svg`)"
:src="require(`../assets/license-icons/${license.toLowerCase()}.svg`)"
>
</a>
</template>
Expand Down
12 changes: 7 additions & 5 deletions src/utils/license-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function attrToFull(attr) {

function licenseUrl(attr, mode) {
// Returns url to license from short license name with version number (eg. 'CC BY 4.0')
// mode: web/ print (?ref=ccchooser is added to the end of the link if mode is web)
const linkRef = mode === 'web' ? '/?ref=ccchooser' : ''
// mode: web/ print (?ref=chooser-v1 is added to the end of the link if mode is web)
const linkRef = mode === 'web' ? '/?ref=chooser-v1' : ''
if (attr.BY === false) {
return `https://creativecommons.org/publicdomain/zero/1.0${linkRef}`
}
Expand Down Expand Up @@ -125,13 +125,14 @@ function generateHTML(attributionDetails, shortLicenseName) {
' xmlns:cc="http://creativecommons.org/ns#"' +
' class="license-text">'
const iconStyle = 'style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;"'
const baseAssetsPath = 'https://search.creativecommons.org/static/img'
let licenseIcons = `<img ${iconStyle} src="${baseAssetsPath}/cc_icon.svg" />`
const baseAssetsPath = 'https://mirrors.creativecommons.org/presskit/icons'
const linkRef = '?ref=chooser-v1'
let licenseIcons = `<img ${iconStyle} src="${baseAssetsPath}/cc.svg/${linkRef}" />`
if (shortLicenseName.includes('CC0')) {
shortLicenseName = 'CC CC0 1.0'
}
licenseIcons += shortLicenseName.slice(3, shortLicenseName.length - 4).split('-').map(license =>
`<img ${iconStyle} src="${baseAssetsPath}/cc-${license.toLowerCase()}_icon.svg" />`
`<img ${iconStyle} src="${baseAssetsPath}/${license.toLowerCase()}.svg/${linkRef}" />`
).join('')
dataForHtmlGeneration.licenseIconsLink = `<a href="${licenseUrl(shortToAttr(shortLicenseName))}">${licenseIcons}</a>`

Expand All @@ -153,6 +154,7 @@ function generateHTML(attributionDetails, shortLicenseName) {
}
return dataForHtmlGeneration
}

export {
defaultAttributes, CC0Attributes, CCBYAttributes, shortToAttr, attrToShort,
attrToFull, licenseUrl, licenseSlug, licenseIconsArr, generateHTML, updateVisibleEnabledStatus
Expand Down