Topic: Rails components and widgets


I am a newbie trying to get my head around Ruby and especially RoR... One thing that strikes me is that while MVC-model is good I would like to have some "components"... Coming from JSF backround I would like to have third party web components (like for example calendar, editable table, etc...) and just plug those into the Framework...

So my question is that is there any production quality web components for RoR ?

Thank you

Best Regards Tuomas

Last edited by tkatva (2012-01-09 17:35:48)

Re: Rails components and widgets

There are hundreds.  they come in three basic forms

jquery plugins.

Google around and you'll find almost anything you need,  and or learn how to re-package anything you may have developed to share with others.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Rails components and widgets

What are the most sophisticated ? Is there a good framework with editable table, dual select list, maybe some graphs etc ? Some examples would be greatly appreciated... Thank you very much.

Best Regards Tuomas Katva

Re: Rails components and widgets

First, jquery support is now the default and built into Rails,  so when you want to do things that are primarily related to snazzy user interfaces,  think about jquery plugins.

Jquery-ui is very good, I use it.

Check out their demo page,  lot's of neat stuff, the data picker is very good,  they have a nice drag and drop feature,  nice icons,  etc.

Understand that jquery-ui is platform agnostic,  it works with rails, but nothing about it is specific to rails,  it's just a good user interface 'plugin' for jquery, and since you'll probably use jquery to do your JavaScript, I'd recommend it if your primary focus is on fancy GUI stuff.  It's theme-able,  you can design your own themes,  select from a nice assortment of canned themes (although most are kind of gaudy),  they even have a browser widget called theme roller,  you run it from your browser with your query-ui app running,  and you can edit your theme on the fly.

There are a lot of graphing things available, a lot of them depend on RMagick,  there is an RMagick gem for rails. 

There are at least four jquery based 'table edit' plugins, probably more,  they tend to go directly to the database from the browser, bypassing rails.  I tried to find a rails specific table edit widget once,  I don't remember ever finding one.

When it comes to rails SPECIFIC components and widgets,  they tend to be for the back end,  They are very specific to rails and very function specific.  Most of the time,  you determine you need some kind of functionality,  and you just go looking for a rails gem or plugin that provides that functionality.   The difference between a gem and plugin is technical, and not really important,  it's just the choice of the developer and the type feature they've chosen to package up for re-use.  Plugins tend to be for 'extending' core rails functionality,  whereas gems tend to be additional Ruby code that may or may not be rails aware.

XML parsing is a good example.  I needed to parse XML that comes out of an adobe PDF with forms, so I found a gem 'libxml-ruby'.  It's an example of just adding Ruby functionality,  you can use it in any Ruby program,  doesn't necessarily have to be used on a rails app,  but it works with rails because rails is written in Ruby.

Another example is make_resourceful,  that's a plugin,  it is specific to rails,  it adds functionality to the core rails framework,  adding a new railsism.  That one is used when you find yourself writing lot's of controllers/views and finding yourself repeating the same programming over and over,  it's a nifty extension.  If you want a rails app to act as a state machine (say a wizard,  with multiple steps,  and you have to keep clicking 'go-back' or 'next' and you have to maintain state to determine if it's OK to click 'next'),  there is a plugin called acts_as_state_machine.

As you can see,  the last two plugin examples are very specific to application needs.  I'm not recommending them per say,  just trying to give you an idea of what is out there, and in what formats.

Last edited by BradHodges (2012-01-10 16:28:22)

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.