Skip to content

Commit

Permalink
Fixes refinery#1592.
Browse files Browse the repository at this point in the history
  • Loading branch information
robyurkowski committed Apr 16, 2012
1 parent 95f1bb4 commit 1c6f99b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions doc/guides/2 - Refinery Basics/1 - Changing Page Parts.textile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ endprologue.

h3. Changing default Page Parts

Refinery by default provides you with +Body+ and +Side Body+ page parts because most pages have a two column style layout. If your layout has three content areas or one, you're going to want to update this setting to reflect that.

Within @config/initializers/refinery/pages.rb@ you will see various default settings are commented out including the following:
By default, Refinery provides you with +Body+ and +Side Body+ page parts since most pages have a two column-style layout. If your layout has three content areas or one, you're going to want to update this setting to reflect that.

Within @config/initializers/refinery/pages.rb@ you will see various default settings are commented out, including the following:

@ # Configure global page default parts@
@ # config.default_parts = ["Body", "Side Body"]@
Expand All @@ -30,18 +29,18 @@ Often we find our home pages have three or more page parts but the rest of the s

Refinery supports the ability for the user to add new Page Parts on the fly when editing a page.

To add a new Page Part just to the home page, first we need to go into the "Settings" tab in Refinery. Find the setting named "New Page Parts" and set its value to +true+.
To add a new Page Part just to the home page, refer back to @config/initializers/refinery/pages.rb@. Inside, you should see the following:

@ # config.new_page_parts = false@

Change this to true, save, and restart your server.

Now go to your "Pages" tab in Refinery and edit your home page. You'll notice a plus and minus button at the top right of the visual editor. Click on the plus icon and add a new page part titled "Middle Body" and click save. A new visual editor will appear in a tab called "Middle Body" ready to use just for this page.
Now go to your "Pages" tab in Refinery and edit your home page. You'll notice a plus and minus button at the top right of the visual editor. Click on the plus icon and add a new page part titled "Middle Body" and click save. A new visual editor will appear in a tab called "Middle Body" ready to use just for this page. Inserting content there will show up on any page that uses the @content_page@ partial (by default, all of them).

NOTE: Your "middle body" content won't show on the front end yet. You need to output the content of that page part in the view.
WARNING. If you've modified your @app/views/refinery/pages/home.html.erb@ file, you will not see your new page part until you set that page part to display in the view.

Now in your +app/views/refinery/pages/home.html.erb+ view you'll be able to put:
If you have modified your @home.html.erb@ file, you can use the following snippet to output the new part's content in your page:

<erb>
<%= raw @page.content_for(:middle_body) %>
</erb>

to output this new content area in the view.

NOTE: If you don't have a +app/views/refinery/pages/home.html.erb+ view already, run +rake refinery:override view=refinery/pages/home+ to copy it into your app.

0 comments on commit 1c6f99b

Please sign in to comment.