Components and layouts


#1

Is there anyway for a component to use the layouts availble to rest of
the app, but still use the templates under its own directory? Setting
the layout with a “layouts/admin” say, just produces “can not find
admin.rhtml…”. Is there anyway around this?

If not I guess I could just put the views under app/views, but really
wanted to keep things seperate.

Thanks!
-Nick


#2

I try to call up images in my browser from my
public/images directory and get a routing error.

Here is my path

http://localhost:3000/images/logo.jpg

And the error

Routing Error

Recognition failed for “/images/logo.jpg”

Any ideas why this would be happening?


#3

On Thursday 17 November 2005 23:56, Nick S. wrote:

Is there anyway for a component to use the layouts availble to rest
of the app, but still use the templates under its own directory?
Setting the layout with a “layouts/admin” say, just produces “can
not find admin.rhtml…”. Is there anyway around this?

If not I guess I could just put the views under app/views, but
really wanted to keep things seperate.
Can symlink be an easy way out?
Btw, I’ve tried to supply full path to layout method, like
“#{RAILS_ROOT}app/views/layouts/blah.rhtml” but with no success. I
wonder why so…


#4

Symlinking wont work in this case, its gotta be deployable on a windows
box,


#5

On Friday 18 November 2005 00:04, jonathan Mcintire wrote:

Recognition failed for “/images/logo.jpg”

Any ideas why this would be happening?
Are you sure logo.jpg is in public/images? And make sure the
permissions are correct.


#6

I had a similar problem and turned out my path to the image was missing
a slash.

Example:

I had:

images/logo.gif

and Rails needed

/images/logo.gif

Not sure if it is the same for you or not, but you can give it a shot.


#7

Not quite. All the stuff under /public is working fine and as it
should. My problem is that if I have views under
/components/my_component/comp/index.rhtml
It can’t access a layout under /app/views/layouts/admin.rhtml

For now I’ve moved the views of the components under app/views but
this kind of defeats the purpose in my mind.

Any other ideas on this?

-Nick


#8

Hi Nick,

On 11/18/05, Nick S. removed_email_address@domain.invalid wrote:

Not quite. All the stuff under /public is working fine and as it
should. My problem is that if I have views under
/components/my_component/comp/index.rhtml
It can’t access a layout under /app/views/layouts/admin.rhtml

For now I’ve moved the views of the components under app/views but
this kind of defeats the purpose in my mind.

Any other ideas on this?

I am using Subversion and I have solved this problem by using
“svn:external”
property to link components/layouts to /app/views/layouts. Not very
beautiful solution but works on Windows.

Best regards,

Luben


#9

Interesting idea Luben. This might be the route I go, but it looks
like there is no ‘offical’ way to handle this. Guess I’ll have open up
an enhancement request then…

Thanks again!
-Nick