Design discussion

47 views
Skip to first unread message

Gonzalo Rodríguez-Baltanás Díaz

unread,
Feb 7, 2012, 6:45:55 AM2/7/12
to cells-an...@googlegroups.com
Hi,

Please join the discussion ( it concerns to both Apotomo and Cells users):

https://github.com/apotonick/apotomo/pull/65


-------------------------------------------------------------
Gonzalo Rodríguez-Baltanás Díaz



Nick Sutterer

unread,
Feb 7, 2012, 8:43:59 AM2/7/12
to cells-an...@googlegroups.com
2012/2/7 Gonzalo Rodríguez-Baltanás Díaz <sio...@gmail.com>:

> Hi,
>
> Please join the discussion ( it concerns to both Apotomo and Cells users):
>
The discussion is about changing the Cells file layout from

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?

Mike Pence

unread,
Feb 7, 2012, 8:44:37 AM2/7/12
to cells-an...@googlegroups.com
+1

Nick Sutterer

unread,
Feb 7, 2012, 8:44:43 AM2/7/12
to cells-an...@googlegroups.com
But then I wonder do we really need the views/ directory all over the place?

Mike Pence

unread,
Feb 7, 2012, 8:47:25 AM2/7/12
to cells-an...@googlegroups.com
Why not put the views where regular views go and put a widgets folder
under controllers?

Nick Sutterer

unread,
Feb 7, 2012, 8:49:19 AM2/7/12
to cells-an...@googlegroups.com
On Tue, Feb 7, 2012 at 2:47 PM, Mike Pence <mike....@gmail.com> wrote:
> Why not put the views where regular views go and put a widgets folder
> under controllers?
>
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".

Mike Pence

unread,
Feb 7, 2012, 8:50:47 AM2/7/12
to cells-an...@googlegroups.com
Wouldn't distributing apotomo widgets in embedded engines make the most sense?

Gonzalo Rodríguez-Baltanás Díaz

unread,
Feb 7, 2012, 9:00:15 AM2/7/12
to cells-an...@googlegroups.com
> Wouldn't distributing apotomo widgets in embedded engines make the most sense?

+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.

Nick Sutterer

unread,
Feb 7, 2012, 9:16:05 AM2/7/12
to cells-an...@googlegroups.com
On Tue, Feb 7, 2012 at 2:50 PM, Mike Pence <mike....@gmail.com> wrote:
> Wouldn't distributing apotomo widgets in embedded engines make the most sense?
>
Yes, and no. I want to get rid of the rails dependency in the long run
and for that we shouldn't copy rails' directory structure. The easiest
is if we still have a widgets/ folder.

Mike Pence

unread,
Feb 7, 2012, 9:18:56 AM2/7/12
to cells-an...@googlegroups.com
However we get there, gemification is the key to adoption.

Mike Pence

unread,
Feb 7, 2012, 9:19:24 AM2/7/12
to cells-an...@googlegroups.com
And it sounds like not being dependent on Rails is a long-term goal,
and a premature optimization.

Nick Sutterer

unread,
Feb 7, 2012, 9:20:52 AM2/7/12
to cells-an...@googlegroups.com
On Tue, Feb 7, 2012 at 3:19 PM, Mike Pence <mike....@gmail.com> wrote:
> And it sounds like not being dependent on Rails is a long-term goal,
> and a premature optimization.
>
> On Tue, Feb 7, 2012 at 9:18 AM, Mike Pence <mike....@gmail.com> wrote:
>> However we get there, gemification is the key to adoption.
>>
It already works to put cells and widgets in engines in gems!

engine/
app/
widgets/
..

Charles Lowell

unread,
Feb 8, 2012, 11:09:33 AM2/8/12
to cells-an...@googlegroups.com
I like putting everything in the same directory, and would vote for moving the Cell code into its own, but no views/ directory.

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

Mike Pence

unread,
Feb 8, 2012, 11:19:45 AM2/8/12
to cells-an...@googlegroups.com
Charles! Good to see you here.

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

Nick Sutterer

unread,
Feb 11, 2012, 4:07:15 AM2/11/12
to cells-an...@googlegroups.com
Yeah an example with a nested widget would be cool!
Reply all
Reply to author
Forward
0 new messages