You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have multiple gemified Padrino apps sharing a common layout. One of them has the main layout and the others point theirs to the central one.
I noticed that the layout setting will not take a full path, but I solved temporally this problem by calculating the relative path as I do in this example (lines 24-34 - highlight does not seem to be working today)
Since the path is relative from ./app/views/layouts it seems that Padrino requires the folder to exist, even if it is empty. Removing the empty layout causes the relative indirection to fail.
Ideally I would like being able to set a full path. Is there any technical reason preventing this?
Since git will ignore empty folders, other people sharing a central layout between gems will have to do some debugging because there is no warning/error explaining that the layout folder must exist even if empty.
The text was updated successfully, but these errors were encountered:
Sinatra has the ability to render external layouts using :layout_options => { :views => '/absolute/path/to/views/folder/containing/layouts/folder/with/layouts' } options on a route definition, however this setting can not be set globally for an app.
To solve this problem just in Padrino we could remove super to this Sinatra render method and call #compile_template, template#render directly. This will spare us two super calls for every request.
Or if we want to be compatible we could bring this problem to @sinatra and @rkh.
Here goes an update for people having the same problem
I've just realized of this alternative hack:
render('/path/my/layout', :layout => nil) do
render 'home/index', :layout => nil
end
The downside is that I must be careful when adding my yield block to avoid the html tags being scaped.
I've just implemented this solution with a custom helper but I am not sure of any extra side effect. Although it is just a hack, at least this no longer requires the existence of an empty folder.
I have multiple gemified Padrino apps sharing a common layout. One of them has the main layout and the others point theirs to the central one.
I noticed that the
layout
setting will not take a full path, but I solved temporally this problem by calculating the relative path as I do in this example (lines 24-34 - highlight does not seem to be working today)Since the path is relative from
./app/views/layouts
it seems that Padrino requires the folder to exist, even if it is empty. Removing the empty layout causes the relative indirection to fail.Ideally I would like being able to set a full path. Is there any technical reason preventing this?
Since git will ignore empty folders, other people sharing a central layout between gems will have to do some debugging because there is no warning/error explaining that the layout folder must exist even if empty.
The text was updated successfully, but these errors were encountered: