8000 Move theme setup script into a partial by mgrunberg · Pull Request #8462 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content

Move theme setup script into a partial #8462

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

Closed
wants to merge 1 commit into from
Closed

Conversation

mgrunberg
Copy link
Contributor

Keep the logic to intialize the them "private".

Users don't need to know the JS we use when they install views.

Simplify the update process for users if we ever make any change to
that.

Keep the logic to intialize the them "private".
Users don't need to know the JS we use when they install views.
Simplify the update process for users if we ever make any change to
that.
@@ -0,0 +1,8 @@
<% # On page load or when changing themes, best to add inline in `head` to avoid FOUC %>
<%= javascript_tag nonce: true do %>
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should theme be prefixed by activeAdmin or configurable?

I understand that in some circumstances it is better to use the same application theme, but changing the theme in the admin area should not affect the application and vice versa 🤔

/cc @javierjulio

@mgrunberg
Copy link
Contributor Author

@tagliala I don't have an answer for your question but it made me change my mind. I'm not sure anymore that this PR is a good move. Now it seems a premature optimization. I'm closing the PR, you or Javier are open to re-open it (or create a new one. I don't know our policy here 😅)

@mgrunberg mgrunberg closed this Aug 30, 2024
@javierjulio javierjulio deleted the theme-setup-partial branch August 31, 2024 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0