dspace-angular
dspace-angular copied to clipboard
Add optional collection home page and descriptive collection content fields
References
Add references/links to any related issues or PRs. These may include:
- Fixes #3255
- Requires https://github.com/DSpace/DSpace/pull/9794
Description
Add new optional collection home page to display new descriptive collection content inputs.
This collection home page is routed to from the 'Subcommunities and collection' page of a community IF the DSpace Angular config.*.yml file has the following config collection.routeThrough.collectionHomePage = true.
All new collection content fields are only editable to Administrators on the DSpace Admin Collection 'Edit Metadata' form.
Instructions for Reviewers
List of changes in this PR:
- Adds new collection-home ts, html and scss files.
- Adds /home to collection-page-routes.ts
- Adds new collection.routeThrough.collectionHomePage config to config.example.yml and associated changes to src/config/collection-page-config.interface.ts and src/config/default-app-config.ts
- Routes through to the new collection-home ts/html page (from 'Subcommunities and collection' page of parent community) if the collection.routeThrough.collectionHomePage config is set to 'true'.
- Adds new getCollectionHomeRoute() function to collection-page-routing-paths.ts
- Adds new inputs to the DSpace Admin Collection 'Edit Metadata' form. These inputs are stored in metadata fields, and displayed on the collection-home html page.
Include guidance for how to test or review your PR. This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes.
-
In your web browser open the DSpace Angular home page
-
Go to: Communities & Collections
-
Click on a community
-
Click on the 'Subcommunities and collections' tab of the Browse element.
-
A 'Collections in this community' page will load. Hover over the collection links and notice they are formed as: URL/collections/<UUID>. For example: http://localhost:4000/collections/282164f5-d325-4740-8dd1-fa4d6d3e7200
-
Edit your config/config.*.yml file. Find '# Collection Page Config'. Underneath that set:
# Routing config for optional collection home page
routeThrough:
collectionHomePage: true
So your collection config looks like:
# Collection Page Config
collection:
edit:
undoTimeout: 10000 # 10 seconds
# Routing config for optional collection home page
routeThrough:
collectionHomePage: true
-
Restart and recompile your dev environment for this config change to take effect
-
Repeat steps 1, 2, 3, 4
-
The 'Collections in this community' page will load. Hover over the collection links and notice they now have /home on the end. For example: http://localhost:4000/collections/282164f5-d325-4740-8dd1-fa4d6d3e7200/home
-
Click on the collection link and notice a page successfully loads. From there you can browse the collection. You can add more custom content fields to this collection home page, which we will do next.
11A. If you have a local DSpace backend install, then checkout DSpace/Dspace#9794 to install 4 new metadata fields.
11B. If you do not have a DSpace backend install then add new metadata fields manually:
- Log into DSpace Admin
- Go to: Registries > Metadata
- Edit the existing 'dspace' registry.
- Add the following new fields to the 'dspace' metadata schema:
- Element = 'collection', Qualifier = 'customfooter', Scope note = 'Custom footer for the Collection home, browse page and collection item pages'
- Element = 'collection', Qualifier = 'headertext', Scope note = 'Custom header for the Collection home, browse page and collection item pages'
- Element = 'collection', Qualifier = 'homepageintrotext', Scope note = 'Custom introduction test for the Collection home. This is to share who curates this collection.'
- Element = 'collection', Qualifier = 'ownername', Scope note = 'Custom owner name for the Collection home. This is to share who curates this collection.'
- Go to: Edit > Collection
- Save content into the following new input fields:
- 'Collection home page footer text (HTML)' =
<footer>
<p>Author: Test University Name</p>
<p><a href="mailto:[email protected]">[email protected]</a></p>
</footer>
- 'Collection home page header text (HTML)' =
<h1>Welcome to the Mathematics collection!</h1> - 'Collection home page introductory text (HTML)' =
This collection is managed and curated by the Department of Mathematics - 'Collection home page owner name (HTML)' =
Mary Smith
-
Then navigate back to 'Subcommunities and collections' tab of the parent community.
-
Click on your collection link again. The /home page will load and the content you added into the 4 input fields in step 13 is now displaying. HTML content you entered is being rendered correctly.
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior 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 created against the
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch). - [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) - [ ] My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
- [ ] 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.
- [x] If my PR fixes an issue ticket, I've linked them together.