-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add custom look #2803
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
base: main
Are you sure you want to change the base?
Add custom look #2803
Conversation
|
I've been playing around with this for the past few days, and it's incredibly fun! 🎉 Also, could you update the beta tag to |
|
Yay! Thanks for doing this. I think it's a big enough conceptual change it should probably go in after v1, if not just so that we can highlight the new functionality and it not get lost in other changes. But I'm still thinking this through! |
|
Thanks! That makes sense. That said, since My application really depends on both |
|
The code change is small, but it's a big (positive) step in functionality which makes a nice highlight for a next release. I'm just trying to see if I can draw a line and get v1 done, as I've dragged my feet on it much longer than I was hoping I'd do. I appreciate this makes things annoying for you and your application though 😭 |
|
Thank you! I really appreciate it. I’m looking forward to the completion of v1. 😊 |
pablobm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! 🙂 Let some minor comments and after that I think this is a good first feature for the post-v1 release.
| def self.local_partial_prefixes | ||
| ["fields/#{field_type}"] | ||
| def self.local_partial_prefixes(look: :default) | ||
| fallback = ["fields/#{field_type}/looks/default", "fields/#{field_type}"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to allow for default? I think it might get confusing and affect maintenance in the long run. There's already the normal option (no look), so not sure we need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think having both would cause significant confusion, but which approach do you prefer?
I felt that plugin developers might prefer having everything neatly organized within looks dir, so I designed it this way to allow both options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking now it's good with both. Basic fields without looks will use the normal one, while field with looks can organise their templates better.
pablobm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goosys - Do you want to rebase this, and we can see if we can give it another chance?
| def self.local_partial_prefixes | ||
| ["fields/#{field_type}"] | ||
| def self.local_partial_prefixes(look: :default) | ||
| fallback = ["fields/#{field_type}/looks/default", "fields/#{field_type}"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking now it's good with both. Basic fields without looks will use the normal one, while field with looks can organise their templates better.
Co-authored-by: Pablo Brasero <[email protected]>
|
@pablobm |

Introduces a custom look implementation based on the discussion in #2291.
Changes:
lookoption toFieldBaseFieldBaseFieldlookoption to generatorsBelongsTolook in demo appproduct: Field::BelongsTo.with_options(look: :product_card)Please review and let me know if any changes are needed! 🚀
Usage:
/admin/pages/admin/orders/:id