diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditSourceModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditSourceModal.vue index 523bd1ad11..839f19a896 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditSourceModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditSourceModal.vue @@ -2,7 +2,6 @@
{ generalActions = { showSnackbarSimple: jest.fn(), }; - generalGetters = { - isAboutLicensesModalOpen: () => false, - }; store = new Vuex.Store({ actions: generalActions, - getters: generalGetters, modules: { contentNode: { namespaced: true, diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue index 655b8fb6e1..2dba69cc0f 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue @@ -122,9 +122,6 @@ - - !state.connection.online, }), - ...mapGetters(['isAboutLicensesModalOpen']), ...mapGetters('contentNode', ['getContentNode']), ...mapGetters('currentChannel', ['currentChannel', 'canEdit', 'canManage', 'rootId']), rootNode() { diff --git a/contentcuration/contentcuration/frontend/shared/views/AboutLicensesModal.vue b/contentcuration/contentcuration/frontend/shared/views/AboutLicensesModal.vue deleted file mode 100644 index 2c11725383..0000000000 --- a/contentcuration/contentcuration/frontend/shared/views/AboutLicensesModal.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - \ No newline at end of file diff --git a/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue b/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue index 64b9ac92d8..5c48b116ad 100644 --- a/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue +++ b/contentcuration/contentcuration/frontend/shared/views/LicenseDropdown.vue @@ -23,19 +23,38 @@ :class="{ 'with-trailing-input-icon': box }" :attach="attach" @focus="$emit('focus')" - > - - + /> +

+ +

+
+

+ {{ licenseItem.name }} +

+

+ {{ licenseItem.description }} +

+

+ +

+
- import { mapMutations } from 'vuex'; + import RequestForm from '../../settings/pages/Storage/RequestForm.vue'; import { getLicenseValidators, getLicenseDescriptionValidators, @@ -70,9 +89,12 @@ import { LicensesList } from 'shared/leUtils/Licenses'; import { constantsTranslationMixin } from 'shared/mixins'; import DropdownWrapper from 'shared/views/form/DropdownWrapper'; + import { crossComponentTranslator } from 'shared/i18n'; const MIXED_VALUE = 'mixed'; + const allowedHosts = ['creativecommons.org']; + export default { name: 'LicenseDropdown', components: { @@ -114,6 +136,12 @@ default: false, }, }, + data() { + return { + requestFormStrings: crossComponentTranslator(RequestForm), + showAboutLicense: false, + }; + }, computed: { license: { get() { @@ -178,17 +206,36 @@ ? getLicenseDescriptionValidators().map(translateValidator) : []; }, + licences() { + return LicensesList.filter(license => license.id).map(license => ({ + ...license, + name: this.translateConstant(license.license_name), + description: this.translateConstant(license.license_name + '_description'), + })); + }, }, methods: { - ...mapMutations({ - setShowAboutLicenses: 'SET_SHOW_ABOUT_LICENSES', - }), translate(item) { if (item.id === MIXED_VALUE) { return this.$tr('mixed'); } return (item.id && item.id !== '' && this.translateConstant(item.license_name)) || ''; }, + toggleAboutLicenseDisplay() { + this.showAboutLicense = !this.showAboutLicense; + }, + getLicenseUrl(license) { + const { license_url } = license; + const language = window.languageCode || 'en'; + try { + const url = new URL(license_url); + return allowedHosts.includes(url.hostname) + ? `${license_url}deed.${language}` + : license_url; + } catch { + return license_url; + } + }, }, $trs: { mixed: 'Mixed', @@ -202,10 +249,6 @@