if create subfolder at layouts and copy there files: _nav.slang and application.slang
and change at layouts/portal/application.slang path of render:
== render(partial: "layouts/portal/_nav.slang")
appears error
Expected behavior: it will render partial
Actual behavior: Shows error
Reproduces how often: always
Amber 0.7.2
it works in this way
== render(partial: "portal/_nav.slang", path: "src/views/layouts/")
Hi @jaysneg Thank for report this issue :+1:
Can you share us the error output using a gist? :sweat_smile:
This isn't technically a bug but it might be a good place to discuss expected behavior.
Currently if there are more than 2 parts in the path it will assume the root is your project root instead of src/views.
For instance this would work: render(partial: "src/views/layouts/tmp/_nav.slang") as would render(partial: "specs/samples/views/layouts/tmp/_nav.slang")
render(partial: "layouts/_nav.slang") works because there are only 2 parts.
It might be better to only use the path: option to set other paths instead of defaulting to that for longer path names.
This would be as simple as getting rid of this conditional in render.cr and making sure the tests still pass.
private macro render_template(filename, path = "src/views")
{% if filename.id.split("/").size > 2 %}
Kilt.render("{{filename.id}}")
{% else %}
Kilt.render("#{{{path}}}/{{filename.id}}")
{% end %}
end
I could probably find time to work on that tonight if desired.
Looks like this has been fixed. Should we close it?
Most helpful comment
This isn't technically a bug but it might be a good place to discuss expected behavior.
Currently if there are more than 2 parts in the path it will assume the root is your project root instead of
src/views.For instance this would work:
render(partial: "src/views/layouts/tmp/_nav.slang")as wouldrender(partial: "specs/samples/views/layouts/tmp/_nav.slang")render(partial: "layouts/_nav.slang")works because there are only 2 parts.It might be better to only use the
path:option to set other paths instead of defaulting to that for longer path names.This would be as simple as getting rid of this conditional in render.cr and making sure the tests still pass.