Permalink
Browse files

add section about helper method to the readme

  • Loading branch information...
1 parent ddb52a8 commit d5121e8e6d64b435003fbce1b5932a860a468914 @mjankowski mjankowski committed Oct 1, 2011
Showing with 38 additions and 0 deletions.
  1. +38 −0 README.md
View
38 README.md
@@ -76,6 +76,44 @@ Plugin authors can also add to the styleguide by ensuring that their view path i
<a href="#next">Next</a>
</div>
+Helpers
+-------
+
+Flutie provides several helper methods for layouts as well.
+
+The `page_title` method can be used like:
+
+ <title><%= page_title %></title>
+
+By default, it will produce results like:
+
+ <title>Appname : page title</title>
+
+* "App name" comes from the module name of the rails application created by your app, i.e. `Appname::Application` will produce "Appname"
+* "page" comes from trying `content_for(:page_title)` and assumes you are setting :page_title on your pages.
+* The separator defaults to " : "
+
+These can be overridden by passing an options hash including `:app_name`, `:page_title_symbol` and `:separator` hash keys, ie:
+
+ content_for(:site_page_title, 'My title of my page')
+ page_title(:app_name => 'My app name', :page_title_symbol => :site_page_title, :separator => " | ")
+ => "My app name | My title of my page"
+
+The `body_class` method can be used like:
+
+ <body class="<%= body_class %>">
+
+This will produce a string including the controller name and controller-action name. For example, The WidgetsController#show action would produce:
+
+ <body class="widgets widgets-show">
+
+Anything which has been added via `content_for(:extra_body_classes)` will be added to the end, for example:
+
+ content_for(:extra_body_classes, 'special-page')
+ <body class="<%= body_class %>">
+ <body class="widgets widgets-show special-page">
+
+
Suggestions, Bugs, Refactoring?
-------------------------------

0 comments on commit d5121e8

Please sign in to comment.