Multiple Layouts in Refinery

901 views
Skip to first unread message

Fregas

unread,
Oct 27, 2010, 10:58:30 AM10/27/10
to Refinery CMS
I'm sorry if this has been asked but i couldn't find a definitive
answer in this group. Is there a way to allow multiple layouts for
the same site, like if want 3 pages to look different then another
three pages? It doesn't have to be configurable through the user
admin, I just want a way to tell refinery that 3 CMS pages should use
a different layout than the rest of the site.

Thanks,
Craig

Philip Arndt

unread,
Oct 27, 2010, 4:54:28 PM10/27/10
to refine...@googlegroups.com
Maarten (MoreTea) is working on a branch that does just this.
http://github.com/moretea/refinerycms/tree/rails3_page_layouts

I guess you could message him on GitHub for more information. This functionality will likely go core once it has all of the issues worked out + a clean, nice interface.

Fregas

unread,
Oct 28, 2010, 11:18:01 AM10/28/10
to Refinery CMS
How do I replace that branch with the refinery i'm using now? Sorry
new to Rails as well as Refinery...

Craig



On Oct 27, 3:54 pm, Philip Arndt <p...@resolvedigital.co.nz> wrote:
> Maarten (MoreTea) is working on a branch that does just this.http://github.com/moretea/refinerycms/tree/rails3_page_layouts

phillipoertel

unread,
Sep 15, 2011, 12:26:04 PM9/15/11
to refine...@googlegroups.com
Any news here? I could have used that feature, too. Right now, I'm simply overwriting PagesController#show.

Raphael Crawford-Marks

unread,
Oct 3, 2011, 7:35:20 PM10/3/11
to Refinery CMS
I'm also looking for a way to manage multiple layouts...anyone heard
anything? Trying to merge in a separate branch of refinery isn't
really practical...

Rob Yurkowski

unread,
Jun 30, 2012, 9:25:56 PM6/30/12
to refine...@googlegroups.com
Or, conversely, you can just enable config.use_layout_templates = true, config.layout_template_whitelist = ["application", "my_layout"] inside config/initializers/refinery/pages.rb, create app/views/layouts/my_layout.html.erb, and then use the select box in the page's Advanced Options. ;)

For whatever reason, the guide doesn't appear in the site list, but you can learn more about those settings here: https://github.com/resolve/refinerycms/blob/master/doc/guides/3%20-%20Advanced%20Techniques%20and%20Tips/3%20-%20Using%20Custom%20View%20or%20Layout%20Templates.textile


On 2012-06-30, at 8:48 PM, Val Seleznev wrote:

Figured out a way to do it and though it might be useful for someone.

I extended pages controller just like in this guide: http://refinerycms.com/guides/extending-controllers-and-models-with-decorators
Since I only needed to change layout for my home page my decorator looks like this:

Refinery::PagesController.class_eval do
  layout 'home', only: [:home]
end


f I needed to define a layout for a few pages I could change it something like this:
;
Refinery::PagesController.class_eval do
  layout :resolve_layout

  private

  def resolve_layout
    case params[:path]
    when "home"
      "home"
    when "about"
      "about"
    else
      "application"
    end
  end
end

Looking at the dates in the thread... Is there a better solution for multiple layouts these days?

--
You received this message because you are subscribed to the Google
Groups "Refinery CMS" group.
To post to this group, send email to refine...@googlegroups.com
To unsubscribe from this group, send email to
refinery-cms...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/refinery-cms?hl=en
 
http://www.refinerycms.com

Philip Arndt

unread,
Jun 30, 2012, 9:26:45 PM6/30/12
to refine...@googlegroups.com
The guide would need to be on 2-0-stable to appear.

Val Seleznev

unread,
Jun 30, 2012, 11:27:34 PM6/30/12
to refine...@googlegroups.com
Makes it much easier indeed! Thanks heaps! :)
Reply all
Reply to author
Forward
0 new messages