Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easy to use Isolated widgets on rails

I am developing a "game platform" on ruby on rails. It is not a 2D or 3D intensive game but more like quiz games, imagine typical Facebook quiz or even "how big is your brain" kind of games. The platform will be used by students here to develop easily their own ideas. The point is to create a series of widgets they can just place in the page and make them work on the data and the CSS.

For this I started creating widgets that to be integrated in the page you just do something like

<%= widget_name widget_params %>

Easy enough for them, but for that I need:

  • Methods in the helpers that just render partials
  • Partials with the html elements marked with id
  • functions in the javascript file that look for that id on the page and if found do their job (as most widgets will somehow use JS)
  • Data support in the model.

For instance, my timer is a javascript function + a partial with game.timeout being game a model with a column timeout for each game. and all that is wrapped in the helper so the user just use <%= timer @game %>

Note that the widgets need to alter the page or at least send some kind of signal to the controller of the page to tell him about global changes. For instance, the timer widget will not only terminate itself but should tell the game controller the game has been terminated also (that's why they are partials in the same page instead of iframes).

The interface for the students to use (just one liners ) is easy and I like that but the fact that each widget need touching so many places, avoid me to easily deploy new widgets to the framework and in general looks like an horrible design.

Also I have just (1 hour ago) discovered Extjs and as I will develop GPL, I am considering it.

Any way to have extjs or any other hand made or provided widget more isolated but still be able to alter a more global context?

like image 743
Jordi Avatar asked Jun 04 '09 02:06

Jordi


1 Answers

Did you already discover Apotomo? That's event-driven widgets for Rails with optional statefulness - very GUI-like.

like image 123
Nick Avatar answered Oct 05 '22 22:10

Nick