flutie 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -76,6 +76,44 @@ Plugin authors can also add to the styleguide by ensuring that their view path i
76
76
  <a href="#next">Next</a>
77
77
  </div>
78
78
 
79
+ Helpers
80
+ -------
81
+
82
+ Flutie provides several helper methods for layouts as well.
83
+
84
+ The `page_title` method can be used like:
85
+
86
+ <title><%= page_title %></title>
87
+
88
+ By default, it will produce results like:
89
+
90
+ <title>Appname : page title</title>
91
+
92
+ * "App name" comes from the module name of the rails application created by your app, i.e. `Appname::Application` will produce "Appname"
93
+ * "page" comes from trying `content_for(:page_title)` and assumes you are setting :page_title on your pages.
94
+ * The separator defaults to " : "
95
+
96
+ These can be overridden by passing an options hash including `:app_name`, `:page_title_symbol` and `:separator` hash keys, ie:
97
+
98
+ content_for(:site_page_title, 'My title of my page')
99
+ page_title(:app_name => 'My app name', :page_title_symbol => :site_page_title, :separator => " | ")
100
+ => "My app name | My title of my page"
101
+
102
+ The `body_class` method can be used like:
103
+
104
+ <body class="<%= body_class %>">
105
+
106
+ This will produce a string including the controller name and controller-action name. For example, The WidgetsController#show action would produce:
107
+
108
+ <body class="widgets widgets-show">
109
+
110
+ Anything which has been added via `content_for(:extra_body_classes)` will be added to the end, for example:
111
+
112
+ content_for(:extra_body_classes, 'special-page')
113
+ <body class="<%= body_class %>">
114
+ <body class="widgets widgets-show special-page">
115
+
116
+
79
117
  Suggestions, Bugs, Refactoring?
80
118
  -------------------------------
81
119
 
@@ -1,6 +1,13 @@
1
1
  module BodyClassHelper
2
- def body_class
2
+ def body_class(options = {})
3
+ extra_body_classes_symbol = options[:extra_body_classes_symbol] || :extra_body_classes
3
4
  qualified_controller_name = controller.controller_path.gsub('/','-')
4
- "#{qualified_controller_name} #{qualified_controller_name}-#{controller.action_name}"
5
+ basic_body_class = "#{qualified_controller_name} #{qualified_controller_name}-#{controller.action_name}"
6
+
7
+ if content_for?(extra_body_classes_symbol)
8
+ [basic_body_class, content_for(extra_body_classes_symbol)].join(' ')
9
+ else
10
+ basic_body_class
11
+ end
5
12
  end
6
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flutie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -23,7 +23,7 @@ authors:
23
23
  autorequire:
24
24
  bindir: bin
25
25
  cert_chain: []
26
- date: 2011-09-16 00:00:00.000000000Z
26
+ date: 2011-10-01 00:00:00.000000000Z
27
27
  dependencies: []
28
28
  description: Flutie is a starting point for personal discovery
29
29
  email: support@thoughtbot.com