|
|
London Ruby User Group:A Modular Approach to Views
A Modular Approach to Views
Jon Gilbraith is not keen on HTML as he finds it takes the joy out of programming and it also seems unsightly. Alternatives like Haml are a nice improvement, but with Haml things still get untidy once the logic is laid out. The standard Rails solution is Helpers Partials, which are a good way to break up the view for big partials. But for small snippets of html one has to use all sorts of weird naming and path combinations to try to sort and identify them. They often have as much or more Ruby in them than html anyway.
For these situations a helper might be a better solution. Helpers are generally used for small jobs e.g. generating a few tags. Generating html within a helper is generally quite messy. One option is to define logical chunks of a view with blocks of idiomatic Ruby. The result can be clean, clear, descriptive and dry; forcing strong modularisation which leaves cleaner and better structured markup and style, a good foundation for separating the design and development tasks, straight forward refactoring and reuse and a good foundation for fragment caching.
ABOUT JON GILBRAITH
|
Jon Gilbraith has been working on taking a modular approach to views and creating builder classes to abstract structural html and view logic into Ruby blocks.
More about Jon Gilbraith
|
ABOUT THE LONDON RUBY USER GROUP
|
LRUG is the London Ruby User Group; a community of ruby developers based in and around London. We meet up at least once a month; on the 2nd Wednesday of the month we have meetings with talks, demos and such-like and then we have pub-based meetups organised on an ad-hoc basis (roughly half-way between meetings).
More about the London Ruby User Group
|
|
PODCAST A MODULAR APPROACH TO VIEWS
This session took part at the LRUG April. You can view the other 2 podcasts here.
|
JAVASCRIPT & HTML5 COURSES
|
JAVASCRIPT & HTML5 PODCASTS
|
OTHER JAVASCRIPT & HTML5 EVENTS
|
Progressive .NET Tutorials 2012
CONFERENCE (3 DAYS)
London, Tuesday, May 29th
BOOK NOW!
|
|
The London Python Group
FREE EVENT:
Python code review
London, Wednesday, June 6th
|
|
Dutch Mobile Conference
CONFERENCE (3 DAYS)
Amsterdam , Thursday, June 7th
BOOK NOW!
|
|
London Ruby User Group
FREE EVENT:
ElasticSearch
, Monday, June 11th
|
|
Gavin Bell's Social Applications
2 DAY COURSE. Featuring Gavin Bell London, Thursday, June 14th
|
|
QCon New York 2012
CONFERENCE (3 DAYS)
New York, Monday, June 18th
BOOK NOW!
|
|
Typesafe's Fast Track to Play
1 DAY COURSE. London, Friday, June 22nd
|
|
Damjan Vujnovic's Advanced JavaScript Workshop
2 DAY COURSE. Featuring Damjan Vujnovic London, Monday, June 25th
|
|
|
|