Rendering subtemplates

hi,

i’ve got main site navigation in the application.rhtml file.
the links in this template correspond to the ‘index’
page of various controllers. The controllers themselves
each have navigation of their own, which i would like to
appear in every view for a particular controller in addition
to the main site navigation.

The problem I am encountering is that when the app runs,
the individual controller layouts take precedence over
the layouts in application.rhtml which effectively
removes the site navigation.

what is the preferred rails way of allowing both a
site-wide layout regardless of controller simultaneously
with a per-controller layout?

thanks!

Please bear in mind that I am a newbie and this may not be the preferred
way to do this:-

In the main application_helper I have this method:-

Returns the name of the partial used for the application menu

def application_menu
@application_menu || ‘shared/application_menu’
end

If I want to override this for individual controllers, all I need to do
is create the appropriate method in the correct helper, like so:-

def application_menu
@application_menu || ‘shared/agecare_menu’
end

Now in my layout which is the main application.rhmtl I have

<%= render :partial =>“shared/html_head” %>

<%= render :partial => application_menu %>
<%= show_flash_messages :textilize => true %> <%= @content_for_layout %>
 
<%= render :partial =>"shared/footer" %>

Here is example code for one of my partial menus, in this case
shared/agecare_menu:-

<%= render :partial => 'shared/top_menu' %>

iNNOVATE

  • <%= link_to "Nursing and Residential Homes", :controller => 'home', :action => "index" %>
  • <%= link_to "Home Support Agencies", :controller => 'home_support', :action => "index" %>
  • <%= link_to "Sheltered Developments", :controller => 'sheltered_development', :action => "index" %>

The _top_menu partial is shared between the whole application. Hope
this helps
Regards
Harvey

On 4/2/06 20:07, “lester bangs” [email protected] wrote:

hi,

i’ve got main site navigation in the application.rhtml file.
the links in this template correspond to the ‘index’
page of various controllers. The controllers themselves
each have navigation of their own, which i would like to
appear in every view for a particular controller in addition
to the main site navigation.

The problem I am encountering is that when the app runs,
the individual controller layouts take precedence over
the layouts in application.rhtml which effectively
removes the site navigation.

what is the preferred rails way of allowing both a
site-wide layout regardless of controller simultaneously
with a per-controller layout?

thanks!


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

This e-mail has been scanned for all viruses by MessageLabs.

lester bangs wrote:

hi,

i’ve got main site navigation in the application.rhtml file.
the links in this template correspond to the ‘index’
page of various controllers. The controllers themselves
each have navigation of their own, which i would like to
appear in every view for a particular controller in addition
to the main site navigation.

The problem I am encountering is that when the app runs,
the individual controller layouts take precedence over
the layouts in application.rhtml which effectively
removes the site navigation.

what is the preferred rails way of allowing both a
site-wide layout regardless of controller simultaneously
with a per-controller layout?

thanks!

Please bear in mind that I am a newbie and this may not be the preferred
way
to do this:-

In the main application_helper I have this method:-

Returns the name of the partial used for the application menu

def application_menu
@application_menu || ‘shared/application_menu’
end

If I want to override this for individual controllers, all I need to do
is
create the appropriate method in the correct helper, like so:-

def application_menu
@application_menu || ‘shared/agecare_menu’
end

Now in my layout which is the main application.rhmtl I have

<%= render :partial =>“shared/html_head” %>

<%= render :partial => application_menu %>
<%= show_flash_messages :textilize => true %> <%= @content_for_layout %>
 
<%= render :partial =>"shared/footer" %>

Here is example code for one of my partial menus, in this case
shared/agecare_menu:-

<%= render :partial => 'shared/top_menu' %>

iNNOVATE

  • <%= link_to "Nursing and Residential Homes", :controller => 'home', :action => "index" %>
  • <%= link_to "Home Support Agencies", :controller => 'home_support', :action => "index" %>
  • <%= link_to "Sheltered Developments", :controller => 'sheltered_development', :action => "index" %>

The _top_menu partial is shared between the whole application. Hope
this
helps
Regards
Harvey

On 4/2/06 20:07, “lester bangs” [email protected] wrote:

the individual controller layouts take precedence over
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

This e-mail has been scanned for all viruses by MessageLabs.

This e-mail has been scanned for all viruses by MessageLabs.