dspace-angular
dspace-angular copied to clipboard
Make the CC license field component configurable in DSpace 8.0
References
This PR does not directly address an open issue, but improves PR #3010 that addressed #3002. Requires: https://github.com/DSpace/DSpace/pull/9882
Description
The ItemPageCcLicenseFieldComponent
implemented in #3010 has some configuration properties that, however, are hardcoded in the component itself and require manual modifications of the typescript code.
Since at least two configuration properties are indeed easily configurable in the back end (license URI field and license name field), makes sense that the front-end allows to configure them too.
This PR adds these configuration options (and some others) to the application config, so that no more modifications are required at the code level.
Instructions for Reviewers
- Run the front-end with the default DSpace 8.0 configuration.
- Create an item, and set its
dc.rights.uri
anddc.rights
to a valid value (e.g.,https://creativecommons.org/licenses/by-nc-nd/4.0/
andCC BY-NC-ND 4.0
respectively) and see the Creative Commons badge to appear. - Delete the
dc.rights
metadata value and refresh the item. The CC badge will not show (theItemPageCcLicenseFieldComponent
requires both the CC uri and CC name to be set). - Create a new
dc.rights.license
metadata value with the valueCC BY-NC-ND 4.0
. Refresh the item, and the badge will still not be shown (since onlydc.right.uri
will be found with the default configuration). - Shutdown the front-end, and add the following configuration to your app config:
ccLicense:
# Field name containing the CC license name, as configured in the back-end, in the 'dspace.cfg' file, property 'cc.license'
# Defaults to 'dc.rights'
nameField: dc.rights.license
- Start the front-end, and the CC badge will now appear in the item.
Other properties that ca be configured are:
# Creative Commons metadata fields
ccLicense:
# Icon variant:
# 'full' variant shows image, a disclaimer (optional) and name (always), better for the item page content.
# 'small' (default) variant shows image and name (optional), better for the item page sidebar
variant: small
# Field name containing the CC license URI, as configured in the back-end, in the 'dspace.cfg' file, property 'cc.license.uri'
# Defaults to 'dc.rights.uri'
uriField: dc.rights.uri
# Field name containing the CC license name, as configured in the back-end, in the 'dspace.cfg' file, property 'cc.license'
# Defaults to 'dc.rights'
nameField: dc.rights
# Shows the CC license name with the image. Always show if image fails to load
showName: true
# Shows the disclaimer in the 'full' variant of the component
showDisclaimer: true
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
- [x] My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
- [x] My PR passes ESLint validation using
yarn lint
- [x] My PR doesn't introduce circular dependencies (verified via
yarn check-circ-deps
) - [x] My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
- [x] My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
- [ ] My PR aligns with Accessibility guidelines if it makes changes to the user interface.
- [ ] My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
- [x] My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
- [ ] If my PR includes new libraries/dependencies (in
package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation. - [x] If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
- [ ] If my PR fixes an issue ticket, I've linked them together.