Forum: Ruby on Rails Include extra partial in layouts

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard Petersen (Guest)
on 2006-01-15 20:26
(Received via mailing list)
Hi all,

Does anybody know how to include a partial (next to @content_for_layout)
in a
layout file?

I'm looking for a something like @partial_for_include => 'filename' in
my
layout files. So a linked .rhtml file gets picked up from within a
layout
file. All my layout files (4 at the moment) have a <div
class="navright">
tag, so one change in the menu, means editing 4 files.

Any clue?

THANX!

Gerard.

--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
41ffa8a6c807370ccf9865c689ccd2fe?d=identicon&s=25 Lori Olson (Guest)
on 2006-01-15 21:08
(Received via mailing list)
On Jan 15, 2006, at 12:26 PM, Gerard Petersen wrote:

> Hi all,
>
> Does anybody know how to include a partial (next to
> @content_for_layout) in a
> layout file?
>


You mean like this?

	<body>

		<%= render :partial => "shared/header" %>

		<div id="Body">
			<%= @content_for_layout %>
		</div>

		<%= render :partial => "shared/navbar" %>

         <%= render :partial => "shared/footer" %>
	</body>

Works fine for us.
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard Petersen (Guest)
on 2006-01-15 21:41
(Received via mailing list)
Lori,

Brilliant! I already have navigation menu's in several layouts, and I'm
about
to start on all those cross-browser hack's, which is going to result in
at
least 15 headers in multiple files.

Thanks for making my life easy .. :-)

Regards,

Gerard.



On Sunday 15 January 2006 21:04, Lori Olson tried to type something
like:
>
>
> Works fine for us.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails

--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard Petersen (Guest)
on 2006-01-15 21:59
(Received via mailing list)
Lori,

Any clue on what the directory is above 'shared' (the layout 'root' so
to
speak).

I created some files and moved the content, and on this line:
> <%= render :partial => "shared/header" %>

it now says:

ActionView::ActionViewError in Crm/customer#list_contacts

No rhtml, rxml, or delegate template found for shared/_navright

Thanx again.

Gerard.

--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
71f1b6b2c3fd9af2e8c52618fb91caa6?d=identicon&s=25 Jules (Guest)
on 2006-01-15 22:03
Does this file exist:

app/views/shared/_navright.rhtml

??

If you use render :partial => '..' Rails prepends a '_' because it is a
partial: all partials have a _ before their name, but render :partial =>
'..' expects the name without a _.

so:

render :partial => 'shared/abc'

Looks for:

views/shared/_abc.rhtml

Jules
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard Petersen (Guest)
on 2006-01-15 22:14
(Received via mailing list)
Jules,

marvelous. I'm so happy .. :-)

Thanx a lot!

Grtz Gerard.


On Sunday 15 January 2006 22:03, Jules tried to type something like:
> so:
>
> render :partial => 'shared/abc'
>
> Looks for:
>
> views/shared/_abc.rhtml
>
> Jules

--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
41ffa8a6c807370ccf9865c689ccd2fe?d=identicon&s=25 Lori Olson (Guest)
on 2006-01-16 03:00
(Received via mailing list)
"shared" is under "views"
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard Petersen (Guest)
on 2006-01-16 08:19
(Received via mailing list)
Thanx, it's working.

Got these lovely clean layouts all of a sudden .. ;-)

Regards,

Gerard.

On Monday 16 January 2006 02:59, Lori Olson tried to type something
like:
> >> <%= render :partial => "shared/header" %>
> >
> > --
> > "Who cares if it doesn't do anything?  It was made with our new
> > Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."
> >
> > My $Grtz =~ Gerard;
> > ~
> >
> > :wq!

--
"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
~
:wq!
This topic is locked and can not be replied to.