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

comunity theming horizon zen #1072

Merged
merged 1 commit into from
Jan 16, 2024
Merged

comunity theming horizon zen #1072

merged 1 commit into from
Jan 16, 2024

Conversation

zzacharo
Copy link
Member

@zzacharo zzacharo commented Nov 24, 2023

invenio_communities/ext.py Outdated Show resolved Hide resolved
@zzacharo zzacharo force-pushed the community-theming branch 2 times, most recently from d8bce44 to 513011b Compare November 24, 2023 16:44
@zzacharo zzacharo marked this pull request as ready for review January 10, 2024 16:02
invenio_communities/communities/schema.py Show resolved Hide resolved
invenio_communities/communities/services/components.py Outdated Show resolved Hide resolved
invenio_communities/views/communities.py Outdated Show resolved Hide resolved
invenio_communities/views/communities.py Outdated Show resolved Hide resolved
invenio_communities/views/communities.py Show resolved Hide resolved
invenio_communities/views/context.py Outdated Show resolved Hide resolved
invenio_communities/views/template_loader.py Outdated Show resolved Hide resolved
@zzacharo zzacharo force-pushed the community-theming branch 2 times, most recently from a36c402 to e9dcd1b Compare January 15, 2024 10:34
MANIFEST.in Outdated
@@ -18,6 +18,7 @@ include babel.ini
include docs/requirements.txt
include LICENSE
include pytest.ini
recursive-include *community_theme_template.css
Copy link
Contributor

@kpsherva kpsherva Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
recursive-include *community_theme_template.css
include *community_theme_template.css

minor: I think it is enough to include since it is not a folder, but a single file

return (
template,
200,
{"Cache-control": "max-age 1 year", "Content-Type": "text/css; charset=utf-8"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: maybe worth adding also Content-Disposition: inline header

theme_config = community.data.get("theme", {}).get("config")

if theme_config is None:
template = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't it generate a request to get an empty file? not sure what will happen in this case

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That happens only if you request a theme for a community that doesn't have one so it returns empty css. I don't understand the generate a request... you mean to return a 404 instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably 404 would be better, yes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried but abort(404) it is getting caught from our 404 handler and it generates a 404 page, which generates much bigger response than just the empty string.... I would leave it as is and we can evaluate it again once we focus on the horizon zen sprint if needed.

* adds new data field called `theme`
* adds specific template loader that handles themed templates per community
* enables feature only for system user at the moment programmtically
* disables indexing of community theme information

Co-authored-by: Karolina Przerwa <[email protected]>
@slint slint merged commit 714e625 into master Jan 16, 2024
4 checks passed
@zzacharo zzacharo deleted the community-theming branch January 16, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horizon-Zen prototype
4 participants