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

Add guide for switching templates with the :variant option and add some samples #2777

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

goosys
Copy link
Contributor

@goosys goosys commented Feb 13, 2025

I have added a guide on how to switch templates using the variant option.

http://localhost:3000/guides/switching_template_with_the_variant_option.md

Additionally, I have added actual usage examples to the sample application.
I created two examples: one for the template used in the Dashboard and another for non-Dashboard screens. The display changes depending on whether the user is logged in as an Admin or another user.

http://localhost:3000/admin/customers
http://localhost:3000/admin/stats

@goosys goosys mentioned this pull request Feb 13, 2025
@nickcharlton
Copy link
Member

I made a few minor rewording changes, and some style preferences, as I thought I'd be able to get this merged today.

But, testing this out just before, I realised that we don't have an obvious way to not be the admin in the demo app to use this functionality. Any ideas on how we could do that?

@nickcharlton nickcharlton added the documentation how to use administrate, examples and common usage label Feb 17, 2025
@goosys
Copy link
Contributor Author

goosys commented Feb 18, 2025

Thank you.

To test it, you can switch to a non-admin user by clicking the "Become" button in each row on the customer list page.
After switching, you should be able to test it.

@nickcharlton
Copy link
Member

Hah! I totally missed that.

I'm glad someone knows the application better than I do after maintaining it for not far off a decade 😂

@nickcharlton nickcharlton merged commit 5985f8d into thoughtbot:main Feb 18, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation how to use administrate, examples and common usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

view variants support
2 participants