I am playing around with tabnav plugin http://blog.seesaw.it/articles/2006/07/23/the-easiest-way-to-add-tabbed-navigation-to-your-rails-app The methodology of this plugin has a separate model and controller for each level of tabs (and I am planning on nesting the tabs). This makes it impossible to use a standard instance variable - for example... clients_tabnav model sets the tabs in this fashion... class ClientsTabnav < Tabnav::Base include Reloadable; add_tab do named ''General Info'' links_to :controller => ''clients'', :action => ''edit_general_info'' ''edit_general_info'' end add_tab do named ''Personal Info'' links_to :controller => ''clients'', :action => ''edit_personal_info'' ''edit_personal_info'' end and if I were to add '':id => @client.id to the links_to line, @client.id means nothing to this controller but it obviously works in the same view that is rendered from one of those ''actions'' above. I can push the value of @client.id into the session hash but I can see that is going to get ugly real quick so I''m wondering if there is a way I can link the ClientsTabnav Class into the Clients Class so that the @client instance variable works? -- Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Craig White wrote:> I am playing around with tabnav plugin > http://blog.seesaw.it/articles/2006/07/23/the-easiest-way-to-add-tabbed-navigation-to-your-rails-app > > The methodology of this plugin has a separate model and controller for > each level of tabs (and I am planning on nesting the tabs). This makes > it impossible to use a standard instance variable - for example... > > clients_tabnav model sets the tabs in this fashion... > class ClientsTabnav < Tabnav::Base > > include Reloadable; > > add_tab do > named ''General Info'' > links_to :controller => ''clients'', :action => ''edit_general_info'' > ''edit_general_info'' > end > > add_tab do > named ''Personal Info'' > links_to :controller => ''clients'', :action => ''edit_personal_info'' > ''edit_personal_info'' > end > > and if I were to add '':id => @client.id to the links_to line, @client.id > means nothing to this controller but it obviously works in the same viewI looked at http://blog.seesaw.it/articles/2007/02/01/tabnav-for-rails-1-2 for an update to TabNav. I found them mentioning "A sample of the new code you can write is: class PostsTabnav < Tabnav::Base add_tab do named ''Posts list'' links_to proc { hash_for_posts_path } end add_tab do named ''New post'' links_to proc { hash_for_new_post_path } end add_tab do named proc{ "Show: " + @post.title } links_to proc{ hash_for_post_path(:id => @post.id) } show_if proc{ !@post.nil? && !@post.id.nil? } end : :" Would that help? Stephan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, 2007-02-01 at 23:23 +0100, Stephan Wehner wrote:> Craig White wrote: > > I am playing around with tabnav plugin > > http://blog.seesaw.it/articles/2006/07/23/the-easiest-way-to-add-tabbed-navigation-to-your-rails-app > > > > The methodology of this plugin has a separate model and controller for > > each level of tabs (and I am planning on nesting the tabs). This makes > > it impossible to use a standard instance variable - for example... > > > > clients_tabnav model sets the tabs in this fashion... > > class ClientsTabnav < Tabnav::Base > > > > include Reloadable; > > > > add_tab do > > named ''General Info'' > > links_to :controller => ''clients'', :action => ''edit_general_info'' > > ''edit_general_info'' > > end > > > > add_tab do > > named ''Personal Info'' > > links_to :controller => ''clients'', :action => ''edit_personal_info'' > > ''edit_personal_info'' > > end > > > > and if I were to add '':id => @client.id to the links_to line, @client.id > > means nothing to this controller but it obviously works in the same view > > I looked at > > http://blog.seesaw.it/articles/2007/02/01/tabnav-for-rails-1-2 > > for an update to TabNav. > > > I found them mentioning > > "A sample of the new code you can write is: > > class PostsTabnav < Tabnav::Base > add_tab do > named ''Posts list'' > links_to proc { hash_for_posts_path } > end > > add_tab do > named ''New post'' > links_to proc { hash_for_new_post_path } > end > > add_tab do > named proc{ "Show: " + @post.title } > links_to proc{ hash_for_post_path(:id => @post.id) } > show_if proc{ !@post.nil? && !@post.id.nil? } > end > : > :" > > Would that help?---- I don''t recognize ''proc'' as anything meaningful - Is it a ruby function? Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, 2007-02-01 at 23:23 +0100, Stephan Wehner wrote:> Craig White wrote: > > I am playing around with tabnav plugin > > http://blog.seesaw.it/articles/2006/07/23/the-easiest-way-to-add-tabbed-navigation-to-your-rails-app > > > > The methodology of this plugin has a separate model and controller for > > each level of tabs (and I am planning on nesting the tabs). This makes > > it impossible to use a standard instance variable - for example... > > > > clients_tabnav model sets the tabs in this fashion... > > class ClientsTabnav < Tabnav::Base > > > > include Reloadable; > > > > add_tab do > > named ''General Info'' > > links_to :controller => ''clients'', :action => ''edit_general_info'' > > ''edit_general_info'' > > end > > > > add_tab do > > named ''Personal Info'' > > links_to :controller => ''clients'', :action => ''edit_personal_info'' > > ''edit_personal_info'' > > end > > > > and if I were to add '':id => @client.id to the links_to line, @client.id > > means nothing to this controller but it obviously works in the same view > > I looked at > > http://blog.seesaw.it/articles/2007/02/01/tabnav-for-rails-1-2 > > for an update to TabNav. > > > I found them mentioning > > "A sample of the new code you can write is: > > class PostsTabnav < Tabnav::Base > add_tab do > named ''Posts list'' > links_to proc { hash_for_posts_path } > end > > add_tab do > named ''New post'' > links_to proc { hash_for_new_post_path } > end > > add_tab do > named proc{ "Show: " + @post.title } > links_to proc{ hash_for_post_path(:id => @post.id) } > show_if proc{ !@post.nil? && !@post.id.nil? } > end > : > :" > > Would that help?---- OK - I think I got it but I still don''t understand what ''proc'' actually is and that example wasn''t helpful to me but they have a sample app noted on their web site (titled lousy sample app) that used a variation of the code using double braces {{ }} and that works - not that I understand why but sometimes you have to appreciate luck and not question it too much. Thus a resulting code looks like this... links_to proc{{ :controller => ''clients'', :action => ''edit_insurance_info'', :id => @client.id }} Single braces - no workee Thanks Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Craig White wrote:> On Thu, 2007-02-01 at 23:23 +0100, Stephan Wehner wrote: >> > >> > links_to :controller => ''clients'', :action => ''edit_personal_info'' >> for an update to TabNav. >> end >> end >> : >> :" >> >> Would that help? > ---- > OK - I think I got it but I still don''t understand what ''proc'' actually > is and that example wasn''t helpful to me but they have a sample app > noted on their web site (titled lousy sample app) that used a variation > of the code using double braces {{ }} and that works - not that I > understand why but sometimes you have to appreciate luck and not > question it too much. > > Thus a resulting code looks like this... > > links_to proc{{ :controller => ''clients'', > :action => ''edit_insurance_info'', > :id => @client.id }} > > Single braces - no workee >See http://www.rubycentral.com/ref/ref_c_proc.html Think function-pointer. The outer braces define a block, the inner braces a hash. Stephan> Thanks > > Craig-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Fri, 2007-02-02 at 22:22 +0100, Stephan Wehner wrote:> Craig White wrote: > > On Thu, 2007-02-01 at 23:23 +0100, Stephan Wehner wrote: > >> > > >> > links_to :controller => ''clients'', :action => ''edit_personal_info'' > >> for an update to TabNav. > >> end > >> end > >> : > >> :" > >> > >> Would that help? > > ---- > > OK - I think I got it but I still don''t understand what ''proc'' actually > > is and that example wasn''t helpful to me but they have a sample app > > noted on their web site (titled lousy sample app) that used a variation > > of the code using double braces {{ }} and that works - not that I > > understand why but sometimes you have to appreciate luck and not > > question it too much. > > > > Thus a resulting code looks like this... > > > > links_to proc{{ :controller => ''clients'', > > :action => ''edit_insurance_info'', > > :id => @client.id }} > > > > Single braces - no workee > > > > See > > http://www.rubycentral.com/ref/ref_c_proc.html > > Think function-pointer. > > The outer braces define a block, the inner braces a hash.---- To paraphrase PeeWee Herman... I meant to know that ;-) Thanks - I actually understand that now that you splained it to me. Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---