This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update license explanation tooltip (#850)
Co-authored-by: Zack Krida <zackkrida@pm.me> Co-authored-by: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com>
- Loading branch information
1 parent
5b24e6f
commit cb1954f
Showing
18 changed files
with
316 additions
and
316 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<template> | ||
<div class="license-explanation w-full max-w-xs p-6"> | ||
<h5 class="text-base font-semibold"> | ||
<template v-if="isTechnicallyLicense">{{ | ||
$t('filters.license-explanation.license-definition') | ||
}}</template> | ||
<template v-else>{{ | ||
$t('filters.license-explanation.mark-definition', { | ||
mark: license.toUpperCase(), | ||
}) | ||
}}</template> | ||
</h5> | ||
|
||
<VLicenseElements | ||
v-if="license" | ||
size="small" | ||
class="my-4" | ||
:license="license" | ||
/> | ||
|
||
<i18n | ||
:path="`filters.license-explanation.more.${ | ||
isTechnicallyLicense ? 'license' : 'mark' | ||
}`" | ||
tag="p" | ||
class="text-sm" | ||
> | ||
<template #read-more> | ||
<VLink :href="`${getLicenseDeedLink(license)}`">{{ | ||
$t('filters.license-explanation.more.read-more') | ||
}}</VLink> | ||
</template> | ||
<template #mark>{{ license.toUpperCase() }}</template> | ||
</i18n> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { isLicense } from '~/utils/license' | ||
import VLicenseElements from '~/components/VLicenseElements.vue' | ||
import { DEPRECATED_LICENSES } from '~/constants/license' | ||
/** | ||
* Renders the explanation of the license passed to it by breaking it down to | ||
* its constituent clauses. | ||
*/ | ||
export default { | ||
name: 'VLicenseExplanation', | ||
components: { | ||
VLicenseElements, | ||
}, | ||
props: { | ||
/** | ||
* the code of the license whose elements need to be explained | ||
*/ | ||
license: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
/** | ||
* Public domain marks such as CC0 and PDM are not technically licenses. | ||
* @return {boolean} true if the license is not CC0 or PDM, false otherwise | ||
*/ | ||
isTechnicallyLicense() { | ||
return isLicense(this.license) | ||
}, | ||
}, | ||
methods: { | ||
getLicenseDeedLink(licenseTerm) { | ||
let fragment | ||
if (licenseTerm === 'cc0') { | ||
fragment = 'publicdomain/zero/1.0' | ||
} else if (licenseTerm === 'pdm') { | ||
fragment = 'publicdomain/mark/1.0' | ||
} else if (DEPRECATED_LICENSES.includes(licenseTerm)) { | ||
fragment = `licenses/${licenseTerm}/1.0` | ||
} else { | ||
fragment = `licenses/${licenseTerm}/4.0` | ||
} | ||
return `https://creativecommons.org/${fragment}/?ref=openverse` | ||
}, | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.