custom template for a single page

587 views
Skip to first unread message

mattmon

unread,
Dec 17, 2010, 4:35:05 PM12/17/10
to Refinery CMS
I am trying to include a google map with polygon overlays via their
javascript api on a single page named 'test'

rake refinery:override view=pages/* created home & show.html.erb - I
can make the modifications to show, but they appear on all pages.

I have created a page in the admin UI named 'test' then created app/
views/pages/test.html.erb - though nothing seems to happen.

What am I doing wrong?

Volkan Unsal

unread,
Dec 17, 2010, 9:03:29 PM12/17/10
to refine...@googlegroups.com
You need to create a conditional block that matches the title of your page and insert it into the show.html.erb

Example:

<% if @page[:title]=="Page Title" %>

...html goes here..

<%end%>


--
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,
Dec 17, 2010, 9:12:06 PM12/17/10
to refine...@googlegroups.com
If you want to create custom templates, you need to first route to them.
In config/routes.rb add a route

match 'test', :to => 'pages#test'

Then your controller is allowed to respond using pages controller's test action so next override pages controller

rake refinery:override controller=pages

Now, add this to it:

def test
@page = Page.find('test')
end

Cheers,
Phil

Trenton Scott

unread,
Feb 6, 2011, 12:54:30 AM2/6/11
to Refinery CMS
So, lets say I want to create the following pages: Home, About,
Services, and Contact. If I've overridden 'pages/home' and 'pages/
home', do I follow your procedure (below) for the other pages. Or, do
I create a conditional in 'pages/show' to test what the page title is
and serve content based on that? I guess I'm a little lost in the
workflow after you've customized your home and show pages.

Trent

On Dec 17 2010, 6:12 pm, Philip Arndt <p...@resolvedigital.co.nz>
wrote:

Philip Arndt

unread,
Feb 6, 2011, 3:42:49 AM2/6/11
to refine...@googlegroups.com
Home is the only custom page in the pages engine, because most clients want a differently styled homepage but for all of their other pages to look the same as eachother so we just have pages/home and pages/show does the rest.

If you want more pages to look different you'll have to add routes for them and write custom functionality

Trenton Scott

unread,
Feb 7, 2011, 2:18:01 PM2/7/11
to Refinery CMS
Okay, I think I understand -- thanks for clearning that up.

Got Josh?

unread,
Feb 7, 2011, 2:21:31 PM2/7/11
to Refinery CMS
I've been taking a look at MoreTea's custom layouts fork, is it
deprecated? or what? I'd love to contribute to it.

Philip Arndt

unread,
Feb 7, 2011, 4:53:06 PM2/7/11
to refine...@googlegroups.com
It's not deprecated, it's just out of date with the current changes. I'd love to see support for it in maybe 1.1, it's a commonly requested feature.
Perhaps you could fork it and merge it with the current master and work from there.

Got Josh?

unread,
Feb 16, 2011, 10:25:21 AM2/16/11
to Refinery CMS
I finally got some time to work on this, and I can't seem to find
MoreTea's Layout Engine? Did he removed it? I wanted to fork it :(

Philip Arndt

unread,
Feb 16, 2011, 2:57:00 PM2/16/11
to refine...@googlegroups.com

Got Josh?

unread,
Feb 16, 2011, 3:02:04 PM2/16/11
to Refinery CMS
Thank you phillip :-)

On Feb 16, 3:57 pm, Philip Arndt <p...@resolvedigital.co.nz> wrote:
> https://github.com/moretea/refinerycms/tree/rails3_page_layouts

Steven Heidel

unread,
Feb 16, 2011, 3:47:33 PM2/16/11
to refine...@googlegroups.com

Alexis Masters

unread,
Feb 16, 2011, 4:01:55 PM2/16/11
to refine...@googlegroups.com
Thanks, Steven!
~ Alexis
=================
Alexis Masters, author & web developer



On Feb 16, 2011, at 12:47 PM, Steven Heidel wrote:

See https://groups.google.com/d/topic/refinery-cms/jvsd69y7JZQ/discussion
Reply all
Reply to author
Forward
0 new messages