The perfect way to create a Rails dashboard with flexible widgets

I have tried my best to develop a Rails model / controller for a dashboard / portal that can support easy / clean widget development. I already (as a redirect) wrote a basic jQuery / jQuery-UI / CSS view that worked out the column / order HTML and controls for reordering / minimizing / removing widgets, and now I'm back on how best to design a model and controller.

As a central place to find all information about a widget, I have a widget model. (like a non-ActiveRecord at the moment) Ideally I would like the Widget index view to just output the Widgets from the controller and the model to hold the widget attributes needed to render the view. This will include the "partial" and "control" widget attributes that a view can use to render a particular partial view of the widgets in the Dashboard view.

I don't want to overload my widget controller with a bunch of potential widget data that its partial view can use. Instead, I want to have a partial render just by specifying a partial widget item and a controller. The partial view and controller can then do whatever they want for that widget.

Widget Controller Index --> render @widgets --> widget1 widdget1_controller/partial view1
                                        \ \->   widget2 widdget2_controller/partial view2
                                         \-->   widget3 widdget3_controller/partial view3

      

Dashboard model will contain columns, order, partial view, controller.

The individual partial views and widget controllers will be located under the controllers and view / widget folders subfolder to keep things in order.

I hope this helps when trying to add AJAX support. Each widget controller can handle its own controller actions (like edit the widget or save something) and I can force the browser client to make AJAX calls partial to the updated information without having to call the original widget controller, etc.

What do you guys think? Do you have a better deal?

+3


source to share


2 answers


I think Cells is what you are looking for.



+1


source


It might be late, but there is a cell extension called Apotomo that basically extends action cells and ajax to make small widgets. This is pretty cool and they have tutorials on how to create the entire widget you are talking about. If it is late, I would guess that it would be quite easy to port the cell code to widgets as they are very similar.



+2


source







All Articles