Skip to content

Conversation

@lorenyu
Copy link
Collaborator

@lorenyu lorenyu commented May 14, 2025

Changes

  • Convert case views to only rely on local variables
  • Add LookBook previews for Case views

Context

In order to add LookBook previews for Case views, I had to convert the case views to only rely on local variables since LookBook can't easily pass in the controller context. This means that in order to use the Case views it's not quite as automagic, you need to manually define things like cases_path rather than allowing the view context from dynamically figuring it out using the model and the polymorphic_path helper.

This poses an interesting design problem. I wonder if there's a way to have the best of both worlds: Have LookBook previews, but also reduce the amount of code needed to use the views. Perhaps this could be a place where Presenters can play a role. In the meantime, I feel like even though in the short term this increases the amount of code the host application needs to use the Case views, it still seems potentially worth decoupling reusable views from controller context. I feel like there may be ways to further improve the host app experience further down the line.

Note: In this PR I organized the cases previews in a cases folder, i think that's better organization, so i'm gonna do that for application forms too in a separate PR

Testing

Tested on LookBook and on the dummy app routes:

Screenshots:

/passport_cases image
/passport_cases/1 image
Lookbook ![Kapture 2025-05-14 at 12 10 40](https://github.com/user-attachments/assets/ef9a911a-bdb9-4a85-b73c-5c0d8a6494bb)

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.

1 participant