hierarchical_page_titles 0.1.0.pre → 0.1.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
require 'hierarchical_page_titles/
|
1
|
+
require 'hierarchical_page_titles/shared_instance_methods'
|
2
2
|
|
3
3
|
module HierarchicalPageTitles
|
4
4
|
module ControllerHelpers
|
5
|
-
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
6
8
|
|
7
|
-
include
|
9
|
+
include SharedInstanceMethods
|
8
10
|
|
9
11
|
module ClassMethods
|
10
12
|
# Call this in the body of your controller with a string to add the string to
|
@@ -16,6 +18,7 @@ module HierarchicalPageTitles
|
|
16
18
|
options = Hash === args.last ? args.last : {}
|
17
19
|
before_filter(options) {|c| c.window_title(*args, &block) }
|
18
20
|
end
|
21
|
+
alias :add_window_title :window_title
|
19
22
|
|
20
23
|
# Call this in the body of your controller with a string to set the page title
|
21
24
|
# globally for each action in your controller. Unlike window_title, this will not
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module HierarchicalPageTitles
|
2
|
-
module
|
2
|
+
module SharedInstanceMethods
|
3
3
|
# Call this in your view with a string to add the string to the array of window titles.
|
4
4
|
# Call this in your layout to output the window title. You can specify a separator
|
5
5
|
# that should be put between the titles by passing <tt>:separator => " - "</tt>.
|
@@ -8,7 +8,7 @@ module HierarchicalPageTitles
|
|
8
8
|
titles = args.flatten
|
9
9
|
@_window_titles ||= []
|
10
10
|
if block_given?
|
11
|
-
@_window_titles << block
|
11
|
+
@_window_titles << instance_eval(&block)
|
12
12
|
else
|
13
13
|
@_window_titles += titles
|
14
14
|
end
|
@@ -20,7 +20,7 @@ module HierarchicalPageTitles
|
|
20
20
|
def page_title(*args, &block)
|
21
21
|
options = args.extract_options!
|
22
22
|
title = args.first
|
23
|
-
@_page_title = (block_given? ? block
|
23
|
+
@_page_title = (block_given? ? instance_eval(&block) : title)
|
24
24
|
@_page_title_set = true
|
25
25
|
end
|
26
26
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'hierarchical_page_titles/
|
1
|
+
require 'hierarchical_page_titles/shared_instance_methods'
|
2
2
|
|
3
3
|
module HierarchicalPageTitles
|
4
4
|
module ViewHelpers
|
5
|
-
include
|
5
|
+
include SharedInstanceMethods
|
6
6
|
|
7
7
|
# Call this in your view with a string to add the string to the array of window titles.
|
8
8
|
# Call this in your layout to output the window title. You can specify a separator
|
@@ -12,8 +12,7 @@ module HierarchicalPageTitles
|
|
12
12
|
if args.empty?
|
13
13
|
options[:separator] ||= " - "
|
14
14
|
@_window_titles ||= []
|
15
|
-
|
16
|
-
(prefix + @_window_titles).join(options[:separator])
|
15
|
+
@_window_titles.join(options[:separator])
|
17
16
|
else
|
18
17
|
super
|
19
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hierarchical_page_titles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -223651651
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
9
|
- 0
|
10
10
|
- pre
|
11
|
-
|
11
|
+
- 2
|
12
|
+
version: 0.1.0.pre.2
|
12
13
|
platform: ruby
|
13
14
|
authors:
|
14
15
|
- Elliot Winkler
|
@@ -16,7 +17,7 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2010-12-
|
20
|
+
date: 2010-12-13 00:00:00 -07:00
|
20
21
|
default_executable:
|
21
22
|
dependencies: []
|
22
23
|
|
@@ -40,7 +41,7 @@ files:
|
|
40
41
|
- lib/hierarchical_page_titles.rb
|
41
42
|
- lib/hierarchical_page_titles/controller_helpers.rb
|
42
43
|
- lib/hierarchical_page_titles/railtie.rb
|
43
|
-
- lib/hierarchical_page_titles/
|
44
|
+
- lib/hierarchical_page_titles/shared_instance_methods.rb
|
44
45
|
- lib/hierarchical_page_titles/version.rb
|
45
46
|
- lib/hierarchical_page_titles/view_helpers.rb
|
46
47
|
has_rdoc: true
|