smart_titles 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- Copyright 2010 Semyon Perepelitsa
1
+ Copyright 2010-2011 Semyon Perepelitsa
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -11,10 +11,10 @@ the following conditions:
11
11
  The above copyright notice and this permission notice shall be
12
12
  included in all copies or substantial portions of the Software.
13
13
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ The software is provided "as is", without warranty of any kind,
15
+ express or implied, including but not limited to the warranties of
16
+ merchantability, fitness for a particular purpose and
17
+ noninfringement. In no event shall the authors or copyright holders be
18
+ liable for any claim, damages or other liability, whether in an action
19
+ of contract, tort or otherwise, arising from, out of or in connection
20
+ with the software or the use or other dealings in the software.
@@ -12,11 +12,14 @@ If you don't want to display it inside the page simply remove an equality sign:
12
12
  <% title "Title for a browser window" %>
13
13
  <h1>Different title for the page</h1>
14
14
 
15
+ This gem is under development and [therefore](http://semver.org/) API can change between minor versions until the 1.0.0.
16
+ It works only with Rails 3.1 and higher.
17
+
15
18
  Installation
16
19
  ---
17
20
  Add this line to your Gemfile:
18
21
 
19
- gem 'smart_titles'
22
+ gem 'smart_titles', '~> 0.3.0'
20
23
 
21
24
  And run:
22
25
 
@@ -98,4 +101,4 @@ Contributing
98
101
 
99
102
  Copyright
100
103
  ---
101
- Created by Semyon Perepelitsa. See LICENSE.txt for further details.
104
+ Created by Semyon Perepelitsa. Distributed under MIT license. See License.txt for further details.
@@ -3,6 +3,7 @@ module SmartTitles
3
3
 
4
4
  initializer "smart_titles.helper" do
5
5
  ActiveSupport.on_load :action_view do
6
+ require "smart_titles/helper"
6
7
  include SmartTitles::Helper
7
8
  end
8
9
  end
@@ -1,3 +1,3 @@
1
1
  module SmartTitles
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -3,30 +3,14 @@ require "test_helper"
3
3
  class SmartTitlesHelperTest < ActionView::TestCase
4
4
  include SmartTitles::Helper
5
5
 
6
+ # This makes content_for work, maybe there is a better way
6
7
  def setup
7
8
  super
8
9
  @av = ActionView::Base.new
9
10
  @view_flow = ActionView::OutputFlow.new
10
11
  end
11
12
 
12
- def inside_view
13
- @virtual_path = 'posts/new'
14
- end
15
-
16
- def inside_layout
17
- @virtual_path = 'layouts/application'
18
- end
19
-
20
- def title(*args)
21
- inside_view
22
- super
23
- end
24
-
25
- def head_title(*args)
26
- inside_layout
27
- super
28
- end
29
-
13
+ # Clean all stored translations
30
14
  def teardown
31
15
  I18n.backend.reload!
32
16
  end
@@ -112,6 +96,29 @@ class SmartTitlesHelperTest < ActionView::TestCase
112
96
 
113
97
  private
114
98
 
99
+ # Virtual path is used by Rails-patched version of I18n.translate
100
+ # to convert ".title" to e.g. "posts.new.title"
101
+ def inside_view
102
+ @virtual_path = 'posts/new'
103
+ end
104
+
105
+ def inside_layout
106
+ @virtual_path = 'layouts/application'
107
+ end
108
+
109
+ # This helper method is always called from the view
110
+ def title(*args)
111
+ inside_view
112
+ super
113
+ end
114
+
115
+ # And this - from the layout
116
+ def head_title(*args)
117
+ inside_layout
118
+ super
119
+ end
120
+
121
+
115
122
  def store_translations(*args)
116
123
  I18n.backend.store_translations(:en, *args)
117
124
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_titles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-09 00:00:00.000000000 Z
12
+ date: 2012-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70340769140560 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70340769140560
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: actionpack
27
- requirement: &70340769124440 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70340769124440
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rake
38
- requirement: &70340769123460 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,23 +53,25 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70340769123460
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  description:
48
63
  email: sema@sema.in
49
64
  executables: []
50
65
  extensions: []
51
66
  extra_rdoc_files: []
52
67
  files:
53
- - .document
54
68
  - .gitignore
55
- - .rspec
56
69
  - Gemfile
57
70
  - Gemfile.lock
58
71
  - Guardfile
59
- - LICENSE.txt
60
- - README.md
72
+ - License.txt
61
73
  - Rakefile
62
- - TODO
74
+ - Readme.md
63
75
  - lib/smart_titles.rb
64
76
  - lib/smart_titles/helper.rb
65
77
  - lib/smart_titles/railtie.rb
@@ -88,11 +100,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
100
  version: '0'
89
101
  requirements: []
90
102
  rubyforge_project:
91
- rubygems_version: 1.8.11
103
+ rubygems_version: 1.8.23
92
104
  signing_key:
93
105
  specification_version: 3
94
106
  summary: Really convenient way to set up page titles in a Rails application.
95
107
  test_files:
96
108
  - test/smart_titles/helper_test.rb
97
109
  - test/test_helper.rb
98
- has_rdoc:
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/TODO DELETED
File without changes