-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate a view component in ingredient generator
Alchemy is mostly using a ViewComponent to render an ingredient. Only some situations the view partial is used. If you previous used the generator you ran into the situation, that the required ingredient was missing. Now the generator is creating the ingredient view component and is referring to that component in the view.
- Loading branch information
1 parent
8d4c097
commit 6bb2595
Showing
3 changed files
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<%%= <%= @ingredient_view_local %>.value %> | ||
<%%= render Alchemy::Ingredients::<%= @ingredient_view_component_class %>.new(<%= @ingredient_view_local %>) %> |
10 changes: 10 additions & 0 deletions
10
lib/generators/alchemy/ingredient/templates/view_component.rb.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Alchemy | ||
module Ingredients | ||
class <%= @class_name %>View < BaseView | ||
|
||
def call | ||
content_tag(:div, ingredient.value) | ||
end | ||
end | ||
end | ||
end |