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

Admin user can save custom CSS styles for a collection in DSpace Admin interface #3254

Open
alexklbuckley opened this issue Aug 19, 2024 · 2 comments · May be fixed by #3250
Open

Admin user can save custom CSS styles for a collection in DSpace Admin interface #3254

alexklbuckley opened this issue Aug 19, 2024 · 2 comments · May be fixed by #3250
Labels
component: Collection Collection display or editing help wanted Needs a volunteer to claim to move forward needs discussion new feature themes

Comments

@alexklbuckley
Copy link

Is your feature request related to a problem? Please describe.

It would be helpful for admin users to be able to save CSS styling rules for a collection in the DSpace Admin collection forms.

This CSS would then be displayed on the collection browse page and collection item pages.

Describe the solution you'd like

  1. Add a new metadata field to the DSpace database for saving collection CSS
  2. Add a new 'Collection styles' input field to DSpace Admin collection form.
  3. Admin users can save raw CSS rules to 'Collection styles' input box.
  4. CSS rendered on collection browse page and item detail page.

These CSS rules should be able to style any part of the DSpace interface - including header, nav bar and footer.

Describe alternatives or workarounds you've considered

Currently if an admin user wants to be able to customise the display of a collection they must ask someone with server access/technical knowledge to:

  1. Create a new theme
  2. Upload that new theme to the DSpace Angular server
  3. Edit the config.*.yml on the angular server - associating their collection with the new theme

We would like to add the ability for admin users to be able to make some styling changes themselves.

Additional information

@alexklbuckley alexklbuckley added needs triage New issue needs triage and/or scheduling new feature labels Aug 19, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Triage in DSpace Backlog Aug 19, 2024
@alexklbuckley alexklbuckley changed the title Admin user to save CSS styles for a collection Admin user can save custom CSS styles for a collection in DSpace Admin interface Aug 19, 2024
@tdonohue tdonohue added help wanted Needs a volunteer to claim to move forward needs discussion themes and removed needs triage New issue needs triage and/or scheduling labels Aug 27, 2024
@tdonohue tdonohue moved this from 🆕 Triage to 👀 Needs Discussion / Analysis in DSpace Backlog Aug 27, 2024
@tdonohue
Copy link
Member

While I'm not against this feature, I've labeled as "needs discussion" simply because embedding custom CSS needs to be done carefully (as it is possible to perform "attacks" via CSS injection).

So, any work in this direction must be careful to ensure it doesn't break base theming, but also doesn't open DSpace up to attacks. Provided that CSS is only editable to Administrators, that seems to limit any attack concerns.

@kshepherd
Copy link
Member

I added a comment to #3250 (comment) where I mention theme extensions and another approach where a class name is stored rather than raw CSS, though I see here that the ability for admins to control the style without a theme change is the key requirement...

I do think the idea is a little dangerous and stretches the scope of what we store even in our administrative metadata fields... as well as security concerns, even some copy/paste accident or other formatting problem could simply break everything. However, it is a creative idea and I'm open to seeing if it can be done safely and reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Collection Collection display or editing help wanted Needs a volunteer to claim to move forward needs discussion new feature themes
Projects
Status: 👀 Needs Discussion / Analysis
3 participants