rails_utils 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +12 -2
- data/lib/rails_utils.rb +3 -2
- data/lib/rails_utils/version.rb +1 -1
- data/test/rails_utils_test.rb +11 -1
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eb6e346f134dad9cadcfd495c7d487b55c1d313
|
4
|
+
data.tar.gz: ae22be9cde9ae97cf0b19cb6d3f9dd96b87f76f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99b8f9431614ae786e11c74e955d3447aca32cb3eed01241841c13442a5be0efae2bdb932c67b469c7cdc8035585e9364fe9c4daef79fafbd7127b0d12733e21
|
7
|
+
data.tar.gz: 45ff6ca55f5db9dbc8c0fc04f9cdd62e841ae5b5ed6ac15ab63692ab36f56055f80cbcedd03a703e16291192a33432e9fa0948fecfe0b33dd2e7af8af106b486
|
data/README.markdown
CHANGED
@@ -53,12 +53,18 @@ becomes
|
|
53
53
|
|
54
54
|
<div class='page-title'>Anime Show</div>
|
55
55
|
|
56
|
-
Besides, it supports I18n
|
56
|
+
Besides, it supports I18n and interpolation:
|
57
57
|
|
58
58
|
en:
|
59
59
|
anime:
|
60
60
|
show:
|
61
|
-
title:
|
61
|
+
title: Showing anime of: %{anime_name}
|
62
|
+
|
63
|
+
.page-title= page_title(anime_name: 'Frozen')
|
64
|
+
|
65
|
+
becomes
|
66
|
+
|
67
|
+
<div class='page-title'>Showing anime of: Frozen</div>
|
62
68
|
|
63
69
|
## #`javascript_initialization`
|
64
70
|
|
@@ -115,6 +121,10 @@ Minitest-ed. To run all tests, just run `rake` or `rake test`.
|
|
115
121
|
|
116
122
|
## Changelog
|
117
123
|
|
124
|
+
_Version 3.2.1_
|
125
|
+
|
126
|
+
- Update `page_title` to support I18n interpolation - by @JuanitoFatas.
|
127
|
+
|
118
128
|
_Version 3.2.0_
|
119
129
|
|
120
130
|
- Add `page_title` that supports I18n - by @huynhquancam.
|
data/lib/rails_utils.rb
CHANGED
@@ -15,9 +15,10 @@ module RailsUtils
|
|
15
15
|
"#{page_controller_class} #{page_action_class}"
|
16
16
|
end
|
17
17
|
|
18
|
-
def page_title
|
18
|
+
def page_title(options={})
|
19
19
|
default_page_title = "#{page_controller_class.capitalize} #{page_action_class.capitalize}"
|
20
|
-
|
20
|
+
i18n_options = { default: default_page_title }.reverse_merge!(options)
|
21
|
+
I18n.t("#{page_controller_class}.#{page_action_class}.title", i18n_options)
|
21
22
|
end
|
22
23
|
|
23
24
|
def javascript_initialization
|
data/lib/rails_utils/version.rb
CHANGED
data/test/rails_utils_test.rb
CHANGED
@@ -92,10 +92,20 @@ describe "RailsUtils::ActionViewExtensions" do
|
|
92
92
|
|
93
93
|
before { I18n.backend.store_translations("en", {controller_name.to_sym => {action_name.to_sym => {title: "An awesome title"}}}) }
|
94
94
|
|
95
|
-
it 'translates page title' do
|
95
|
+
it 'translates page title' do
|
96
96
|
view.page_title.must_equal 'An awesome title'
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
describe 'when translation is avaiable + interpolations' do
|
101
|
+
let(:action_name) { 'show' }
|
102
|
+
|
103
|
+
before { I18n.backend.store_translations("en", {controller_name.to_sym => {action_name.to_sym => {title: "An awesome title, %{name}"}}}) }
|
104
|
+
|
105
|
+
it 'translates page title' do
|
106
|
+
view.page_title(name: 'bro').must_equal 'An awesome title, bro'
|
107
|
+
end
|
108
|
+
end
|
99
109
|
end
|
100
110
|
|
101
111
|
describe "#javascript_initialization" do
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winston Teo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 4.7.5
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 4.7.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: turn
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.9.6
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.9.6
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.14.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.14.0
|
69
69
|
description: Rails helpers based on opinionated project practices. Currently useful
|
@@ -74,16 +74,19 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- lib/rails_utils/version.rb
|
78
|
-
- lib/rails_utils.rb
|
79
77
|
- MIT-LICENSE
|
80
|
-
- Rakefile
|
81
78
|
- README.markdown
|
79
|
+
- Rakefile
|
80
|
+
- lib/rails_utils.rb
|
81
|
+
- lib/rails_utils/version.rb
|
82
|
+
- test/dummy/README.rdoc
|
83
|
+
- test/dummy/Rakefile
|
82
84
|
- test/dummy/app/assets/javascripts/application.js
|
83
85
|
- test/dummy/app/assets/stylesheets/application.css
|
84
86
|
- test/dummy/app/controllers/application_controller.rb
|
85
87
|
- test/dummy/app/helpers/application_helper.rb
|
86
88
|
- test/dummy/app/views/layouts/application.html.erb
|
89
|
+
- test/dummy/config.ru
|
87
90
|
- test/dummy/config/application.rb
|
88
91
|
- test/dummy/config/boot.rb
|
89
92
|
- test/dummy/config/environment.rb
|
@@ -98,14 +101,11 @@ files:
|
|
98
101
|
- test/dummy/config/initializers/wrap_parameters.rb
|
99
102
|
- test/dummy/config/locales/en.yml
|
100
103
|
- test/dummy/config/routes.rb
|
101
|
-
- test/dummy/config.ru
|
102
104
|
- test/dummy/log/test.log
|
103
105
|
- test/dummy/public/404.html
|
104
106
|
- test/dummy/public/422.html
|
105
107
|
- test/dummy/public/500.html
|
106
108
|
- test/dummy/public/favicon.ico
|
107
|
-
- test/dummy/Rakefile
|
108
|
-
- test/dummy/README.rdoc
|
109
109
|
- test/dummy/script/rails
|
110
110
|
- test/rails_utils_test.rb
|
111
111
|
- test/test_helper.rb
|
@@ -119,17 +119,17 @@ require_paths:
|
|
119
119
|
- lib
|
120
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- -
|
127
|
+
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.1
|
132
|
+
rubygems_version: 2.4.1
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Rails helpers based on opinionated project practices.
|