app/widgets/
cart_widget.rb
cart/
show.haml
to something like
app/widgets/
cart/
cart_widget.rb
views/
show.haml
Making the widgets assets "encapsulated". What do you guys think?
+1 That way we can distribute widgets as gems.
>>> Why not put the views where regular views go and put a widgets folder
>>> under controllers?
>>>
Think of a widget with 7 views. It will be useful to be able to close that folder when you are not working on the views, but in other subwidget, for example.
The general idea is to separate widget's code from its view code. The views folder is a logical encapsulation that is very useful with nested widgets.
>> This would make it even more complicated to package and distribute a
>> widget! The goal is having a self-contained directory with "everything
>> you need".
I agree. I think widgets views and code shouldn't be spread to the normal places for the app's code. Self-contained directory is better IMHO.
engine/
app/
widgets/
..
You can make it work as a gem without a views/ directory.
I even go so far as to put all .css and .js associated with the widget in the cell directory, and then pull them all in with sprockets. Good times!
cheers,
Charles
Gemified and sprocketed Apotomo components sound really useful. Maybe
we could start a wiki page on how to put that all together on the
github project?
Best,
Mike Pence