dynamic-page-title 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -0
- data/lib/dynamic-page-title.rb +22 -0
- metadata +81 -0
data/README
ADDED
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ApplicationHelper
|
2
|
+
def title(text)
|
3
|
+
content_for(:title) { text }
|
4
|
+
end
|
5
|
+
|
6
|
+
def page_title(options = {})
|
7
|
+
options = {
|
8
|
+
:tag => :title, # the html tag to wrap this in. e.g., :h1 for an <h1> tag; defaults to :title
|
9
|
+
:prepend_text => false, # if set, prepends the given text to the set title, e.g., "Example.com - "; defaults to false
|
10
|
+
:append_text => false, # if set, appends the given text to the set title, e.g., " - Example.com"; defaults to false
|
11
|
+
:html_options => {} # any html options to be passed to content_tag, e.g., {:class => "title"}; defaults to {}
|
12
|
+
}.merge(options)
|
13
|
+
|
14
|
+
# capturing the content using the rails 3 way
|
15
|
+
text = content_for(:title)
|
16
|
+
# conditionally adding the appending and prepending text
|
17
|
+
text = options[:prepend_text] + text if options[:prepend_text]
|
18
|
+
text = text + options[:append_text] if options[:append_text]
|
19
|
+
|
20
|
+
content_tag(options[:tag], text, options[:html_options])
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dynamic-page-title
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Patrick Byrne
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-10 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activesupport
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description:
|
36
|
+
email: code@patrickbyrne.net
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
files:
|
44
|
+
- lib/dynamic-page-title.rb
|
45
|
+
- README
|
46
|
+
has_rdoc: true
|
47
|
+
homepage: http://bitbucket.org/pbyrne/dynamic-page-title/
|
48
|
+
licenses: []
|
49
|
+
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.3.7
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Use this gem to set a dynamic page title in your views with `<%= title "Something or other" %>` and display it with `<title><%= page_title %></title>` in your layout.
|
80
|
+
test_files: []
|
81
|
+
|