Making best use of Phlex::Kit
#752
mhenrixon
started this conversation in
Component architecture
Replies: 2 comments 8 replies
-
I guess you could have a Customers kit, but I'd just use Components::CustomerForm. |
Beta Was this translation helpful? Give feedback.
5 replies
-
If you do this, as you suggested, anything inheriting from module Components
extend Phlex::Kit
class Base < Phlex::HTML
include PhlexyUI
end
end Example class Components::MyComponent < Components::Base
def view_template
Card do
#...
end
end
end If you don’t include the PhlexyUI kit, you can still render its components but you’d need to use the full namespace. class Components::MyComponent < Components::Base
def view_template
PhlexyUI::Card do
#...
end
end
end |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For my
app/views/components
I have the following code:Which allows me to take the following page component:
and render it with:
Is there an easy way to achieve the same within my customer's namespace? So that I can just do
Form(customer: @customer)
from theEdit
page?I am not entirely sure how to best structure the code, but I would very much prefer not to have to type out all those
render
and.new
Beta Was this translation helpful? Give feedback.
All reactions