Skip to content

Conversation

@ristrettoblack
Copy link

Specify a Folder-Location for Partials.

# as a config
set :partial_folder, ("partials")

# inline
partial(:news, :partial_folder => 'partials' )

Default is set to false. I hope, i am right.

Iain Barnett and others added 4 commits February 25, 2013 18:45
@yb66
Copy link
Owner

yb66 commented Feb 3, 2014

Hi @ristrettoblack

Thanks for the contribution. At the moment you could do:

= partial :"partials/news"

but with your suggestion it would be = partial :news because the folder had already been set, is that how you envisage it?

Regards,
Iain

@ristrettoblack
Copy link
Author

Hi @yb66

Thanks for your answer.

Exactly! It's just to keep your Files organized and the Code still clean.

@yb66
Copy link
Owner

yb66 commented Feb 4, 2014

@ristrettoblack ok, that sounds fine. What it's lacking right now are some specs, and some examples of how it would work in different situations, so let's go through it. For example, if my layout is:

app/
  views/
     layout.haml
     view1.haml
    partials/
        part1.haml
        part2.haml

How could I call partial and override the partial folder setting to get view1.haml to render as a partial? It's my aim to be able to override any of the settings in a local call, hence, all the options.fetch look at a local option before recourse to the settings.

Better to use File.join instead of prepend with the / in the code, as it handles things like double slashes far more effectively.

Iain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants