Global Information
asecondwill opened this issue · 4 comments
Is there a Fae way of handling information in the layout rather than pages? So say a snippet for the footer, copy in the sidebar etc?
Maybe a way to add things to the Root Settings? Or, since that are is a bit hidden for copy, somewhere else?
you just need to get creative and model the use case you're thinking of. while it's not technically a "page" you could leverage fae pages/content blocks to do this, or you could use regular old straight up models to do the same thing.
so you scaffold a fae page called "footer" or "sidebar", and while it sounds dumb that it ends up being called FooterPage, you could load it in a global before_filter and use it like you're intending to here.
let me know if this doesn't make sense.
That makes sense. I might do that next time, I can't decide if what i've done is hacky but:
- I created a "Snippet" model. Name and value properties.
- Added it to Fae admin as per usual
- added the snippets I wanted.
- Removed the delete td in admin index
- passed new_button: false to the index_header
- Fetch @snippets in a before filter
Then in my footer for eg, I do
<%= @snippets.find(5).value.html_safe %>
Which works for me, the client sees an interface that makes sense. Seems ok.
An improvement on that would be to show the add button and delete th if superuser or something.
No, thats silly. I went with just creating a "Page" called layout, where I can add in whatever snippets i need. Thanks for advice : )