For all my applicatino I use layout A.
In this layout I have <%= javascript_include_tag ‘application.js’ %>
and, in this javascript I have some code that I want to execute on all
pages exept one.
How can I exclude this javascript only for one page?
On 22 December 2010 15:56, Mauro [email protected] wrote:
For all my applicatino I use layout A.
In this layout I have <%= javascript_include_tag ‘application.js’ %>
and, in this javascript I have some code that I want to execute on all
pages exept one.
How can I exclude this javascript only for one page?
You could extract that code to a separate .js file and have a separate
layout for that page that does not include the new js file.
Colin
On 22 December 2010 17:22, Colin L. [email protected] wrote:
On 22 December 2010 15:56, Mauro [email protected] wrote:
For all my applicatino I use layout A.
In this layout I have <%= javascript_include_tag ‘application.js’ %>
and, in this javascript I have some code that I want to execute on all
pages exept one.
How can I exclude this javascript only for one page?You could extract that code to a separate .js file and have a separate
layout for that page that does not include the new js file.
But I have to duplicate the layout code only to not include a .js?
All the pages have the same layout.
On Dec 22, 4:24pm, Mauro [email protected] wrote:
layout for that page that does not include the new js file.
But I have to duplicate the layout code only to not include a .js?
All the pages have the same layout.
You could stick <%= yield :extra_js %> in the head section of the
layout and then use content_for :extra_js with the include for the
extra javascript file
Fred
On 22 December 2010 16:24, Mauro [email protected] wrote:
But I have to duplicate the layout code only to not include a .js?
All the pages have the same layout.
Put all the common stuff in a separate file or files and yield to
it/them from the layouts.
Colin
On 22 December 2010 17:29, Frederick C. [email protected]
wrote:
You could stick <%= yield :extra_js %> in the head section of the
layout and then use content_for :extra_js with the include for the
extra javascript file
Yes that’s a solution, thank you.
On 22 December 2010 17:31, Mauro [email protected] wrote:
On 22 December 2010 17:29, Frederick C. [email protected] wrote:
You could stick <%= yield :extra_js %> in the head section of the
layout and then use content_for :extra_js with the include for the
extra javascript file
Can I use content_for in a partial too?
On Dec 22, 11:37am, Mauro [email protected] wrote:
Can I use content_for in a partial too?
Are you asking because you tried it and it didn’t work?
I don’t see anything in the documentation that indicates it would NOT
work in a partial.
On 22 December 2010 20:58, E. Litwin [email protected] wrote:
On Dec 22, 11:37am, Mauro [email protected] wrote:
Can I use content_for in a partial too?
Are you asking because you tried it and it didn’t work?
Yes
It should work in partials, but will not work if you are rendering the
partial in an ajax call