Deb Lewis
2006-Sep-24 23:04 UTC
[Masterview-devel] Code review request: support layouts in MV Admin pages
Jeff - it was really bugging me that our admin pages weren''t able to use layouts, so I poked around in ActionController''s implementation and figured out what I think is a safe/stable way to slide in alongside the standard services. So the main index/list page and the three config info pages now use layouts. (We should clean up the other pages in there at some point, but I''m punting for now, need to go back and finish some loose ends in directive metadata mechanisms) Background: problem was that the base Rails layout mechanism has an assumption about working (only) in the context of app/views/layouts dir bolted down in its roots. But we want to be able to render with a layout file that we pull up from the mv installation dir (plugin or gem). **Please code review this and test on your system!! I''m running Rails 1.1.2; I think/hope this area of Rails is pretty stable w.r.t the way I wrote this code, but testing on newer versions would be good. Our hook is installed as ActionController::Base.masterview_render_file_with_layout; impl is in masterview_controller (at least for now - someday I''d like to maybe reorganize our rails extensions into an explicit rails_ext dir, along the lines of how rails organizes its core ruby extensions, which I think is a good clear way to manage these). I didn''t check into rails issues db to see if there''s any outstanding tickets on this, supposed it would be good to add and maybe propose a patch, but need to go over protocol issues before making such a proposal for general use. ~ Deb
Jeff Barczewski
2006-Sep-25 10:44 UTC
[Masterview-devel] Code review request: support layouts in MV Admin pages
On 9/24/06, Deb Lewis <djlewis at acm.org> wrote:> Jeff - it was really bugging me that our admin pages weren''t able to use > layouts, so I poked around in ActionController''s implementation and figured > out what I think is a safe/stable way to slide in alongside the standard > services. > > So the main index/list page and the three config info pages now use layouts. > (We should clean up the other pages in there at some point, but I''m punting > for now, need to go back and finish some loose ends in directive metadata > mechanisms) > > Background: problem was that the base Rails layout mechanism has an > assumption about working (only) in the context of app/views/layouts dir > bolted down in its roots. But we want to be able to render with a layout > file that we pull up from the mv installation dir (plugin or gem). > > **Please code review this and test on your system!! I''m running Rails > 1.1.2; I think/hope this area of Rails is pretty stable w.r.t the way I > wrote this code, but testing on newer versions would be good. > > Our hook is installed as > ActionController::Base.masterview_render_file_with_layout; impl is in > masterview_controller (at least for now - someday I''d like to maybe > reorganize our rails extensions into an explicit rails_ext dir, along the > lines of how rails organizes its core ruby extensions, which I think is a > good clear way to manage these). > > I didn''t check into rails issues db to see if there''s any outstanding > tickets on this, supposed it would be good to add and maybe propose a patch, > but need to go over protocol issues before making such a proposal for > general use. >Good idea Deb! I am still working on my presentation for tomorrow but will check out what you have after that. I''ll make sure the code is working in 1.1.6 and Rails edge.