swiss_knife 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -1,43 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
swiss_knife (1.0.
|
4
|
+
swiss_knife (1.0.5)
|
5
5
|
rails (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionmailer (3.1.
|
11
|
-
actionpack (= 3.1.
|
10
|
+
actionmailer (3.1.1)
|
11
|
+
actionpack (= 3.1.1)
|
12
12
|
mail (~> 2.3.0)
|
13
|
-
actionpack (3.1.
|
14
|
-
activemodel (= 3.1.
|
15
|
-
activesupport (= 3.1.
|
13
|
+
actionpack (3.1.1)
|
14
|
+
activemodel (= 3.1.1)
|
15
|
+
activesupport (= 3.1.1)
|
16
16
|
builder (~> 3.0.0)
|
17
17
|
erubis (~> 2.7.0)
|
18
18
|
i18n (~> 0.6)
|
19
19
|
rack (~> 1.3.2)
|
20
|
-
rack-cache (~> 1.
|
20
|
+
rack-cache (~> 1.1)
|
21
21
|
rack-mount (~> 0.8.2)
|
22
22
|
rack-test (~> 0.6.1)
|
23
|
-
sprockets (~> 2.0.
|
24
|
-
activemodel (3.1.
|
25
|
-
activesupport (= 3.1.
|
26
|
-
bcrypt-ruby (~> 3.0.0)
|
23
|
+
sprockets (~> 2.0.2)
|
24
|
+
activemodel (3.1.1)
|
25
|
+
activesupport (= 3.1.1)
|
27
26
|
builder (~> 3.0.0)
|
28
27
|
i18n (~> 0.6)
|
29
|
-
activerecord (3.1.
|
30
|
-
activemodel (= 3.1.
|
31
|
-
activesupport (= 3.1.
|
28
|
+
activerecord (3.1.1)
|
29
|
+
activemodel (= 3.1.1)
|
30
|
+
activesupport (= 3.1.1)
|
32
31
|
arel (~> 2.2.1)
|
33
32
|
tzinfo (~> 0.3.29)
|
34
|
-
activeresource (3.1.
|
35
|
-
activemodel (= 3.1.
|
36
|
-
activesupport (= 3.1.
|
37
|
-
activesupport (3.1.
|
33
|
+
activeresource (3.1.1)
|
34
|
+
activemodel (= 3.1.1)
|
35
|
+
activesupport (= 3.1.1)
|
36
|
+
activesupport (3.1.1)
|
38
37
|
multi_json (~> 1.0)
|
39
38
|
arel (2.2.1)
|
40
|
-
bcrypt-ruby (3.0.0)
|
41
39
|
builder (3.0.0)
|
42
40
|
coderay (0.9.8)
|
43
41
|
diff-lcs (1.1.3)
|
@@ -45,23 +43,24 @@ GEM
|
|
45
43
|
fakeweb (1.3.0)
|
46
44
|
hike (1.2.1)
|
47
45
|
i18n (0.6.0)
|
46
|
+
json (1.6.1)
|
48
47
|
mail (2.3.0)
|
49
48
|
i18n (>= 0.4.0)
|
50
49
|
mime-types (~> 1.16)
|
51
50
|
treetop (~> 1.4.8)
|
52
|
-
method_source (0.6.
|
53
|
-
ruby_parser (
|
54
|
-
mime-types (1.
|
51
|
+
method_source (0.6.7)
|
52
|
+
ruby_parser (>= 2.3.1)
|
53
|
+
mime-types (1.17.2)
|
55
54
|
multi_json (1.0.3)
|
56
55
|
nokogiri (1.5.0)
|
57
|
-
polyglot (0.3.
|
58
|
-
pry (0.9.
|
56
|
+
polyglot (0.3.3)
|
57
|
+
pry (0.9.7.4)
|
59
58
|
coderay (~> 0.9.8)
|
60
|
-
method_source (~> 0.6.
|
61
|
-
ruby_parser (
|
59
|
+
method_source (~> 0.6.7)
|
60
|
+
ruby_parser (>= 2.3.1)
|
62
61
|
slop (~> 2.1.0)
|
63
|
-
rack (1.3.
|
64
|
-
rack-cache (1.
|
62
|
+
rack (1.3.5)
|
63
|
+
rack-cache (1.1)
|
65
64
|
rack (>= 0.4)
|
66
65
|
rack-mount (0.8.3)
|
67
66
|
rack (>= 1.0.0)
|
@@ -69,23 +68,24 @@ GEM
|
|
69
68
|
rack
|
70
69
|
rack-test (0.6.1)
|
71
70
|
rack (>= 1.0)
|
72
|
-
rails (3.1.
|
73
|
-
actionmailer (= 3.1.
|
74
|
-
actionpack (= 3.1.
|
75
|
-
activerecord (= 3.1.
|
76
|
-
activeresource (= 3.1.
|
77
|
-
activesupport (= 3.1.
|
71
|
+
rails (3.1.1)
|
72
|
+
actionmailer (= 3.1.1)
|
73
|
+
actionpack (= 3.1.1)
|
74
|
+
activerecord (= 3.1.1)
|
75
|
+
activeresource (= 3.1.1)
|
76
|
+
activesupport (= 3.1.1)
|
78
77
|
bundler (~> 1.0)
|
79
|
-
railties (= 3.1.
|
80
|
-
railties (3.1.
|
81
|
-
actionpack (= 3.1.
|
82
|
-
activesupport (= 3.1.
|
78
|
+
railties (= 3.1.1)
|
79
|
+
railties (3.1.1)
|
80
|
+
actionpack (= 3.1.1)
|
81
|
+
activesupport (= 3.1.1)
|
83
82
|
rack-ssl (~> 1.3.2)
|
84
83
|
rake (>= 0.8.7)
|
85
84
|
rdoc (~> 3.4)
|
86
85
|
thor (~> 0.14.6)
|
87
|
-
rake (0.9.2)
|
88
|
-
rdoc (3.
|
86
|
+
rake (0.9.2.2)
|
87
|
+
rdoc (3.11)
|
88
|
+
json (~> 1.4)
|
89
89
|
rspec (2.7.0)
|
90
90
|
rspec-core (~> 2.7.0)
|
91
91
|
rspec-expectations (~> 2.7.0)
|
@@ -99,11 +99,11 @@ GEM
|
|
99
99
|
activesupport (~> 3.0)
|
100
100
|
railties (~> 3.0)
|
101
101
|
rspec (~> 2.7.0)
|
102
|
-
ruby_parser (2.
|
102
|
+
ruby_parser (2.3.1)
|
103
103
|
sexp_processor (~> 3.0)
|
104
|
-
sexp_processor (3.0.
|
104
|
+
sexp_processor (3.0.8)
|
105
105
|
slop (2.1.0)
|
106
|
-
sprockets (2.0.
|
106
|
+
sprockets (2.0.3)
|
107
107
|
hike (~> 1.2)
|
108
108
|
rack (~> 1.0)
|
109
109
|
tilt (~> 1.1, != 1.3.0)
|
@@ -113,7 +113,7 @@ GEM
|
|
113
113
|
treetop (1.4.10)
|
114
114
|
polyglot
|
115
115
|
polyglot (>= 0.3.1)
|
116
|
-
tzinfo (0.3.
|
116
|
+
tzinfo (0.3.31)
|
117
117
|
|
118
118
|
PLATFORMS
|
119
119
|
ruby
|
@@ -38,7 +38,11 @@ module SwissKnife
|
|
38
38
|
|
39
39
|
def page_title_get
|
40
40
|
controller = self unless respond_to?(:controller)
|
41
|
-
|
41
|
+
|
42
|
+
controller_name = controller.class.name.underscore
|
43
|
+
controller_name.gsub!(/\//, "_")
|
44
|
+
controller_name.gsub!(/_controller$/, "")
|
45
|
+
|
42
46
|
action_name = controller.action_name
|
43
47
|
action_name = SwissKnife::Helpers::ACTION_ALIASES.fetch(action_name, action_name)
|
44
48
|
|
data/lib/swiss_knife/helpers.rb
CHANGED
@@ -68,10 +68,6 @@ module SwissKnife
|
|
68
68
|
# <%= dispatcher %>
|
69
69
|
#
|
70
70
|
def dispatcher_tag
|
71
|
-
controller_name = controller.class.name.underscore
|
72
|
-
controller_name.gsub!(/\//, "_")
|
73
|
-
controller_name.gsub!(/_controller$/, "")
|
74
|
-
|
75
71
|
%[<meta name="page" content="#{controller_name}##{controller.action_name}" />].html_safe
|
76
72
|
end
|
77
73
|
|
@@ -90,12 +86,13 @@ module SwissKnife
|
|
90
86
|
#
|
91
87
|
def body(options = {}, &block)
|
92
88
|
action_name = ACTION_ALIASES[controller.action_name] || controller.action_name
|
89
|
+
controller_name_for_css_class = controller_name.gsub(/\_/, "-")
|
93
90
|
|
94
91
|
options = {
|
95
|
-
:id => "#{
|
92
|
+
:id => "#{controller_name_for_css_class}-page",
|
96
93
|
:class => [
|
97
|
-
"#{
|
98
|
-
"#{
|
94
|
+
"#{controller_name_for_css_class}-#{action_name}",
|
95
|
+
"#{controller_name_for_css_class}-#{controller.action_name}",
|
99
96
|
I18n.locale,
|
100
97
|
Rails.env
|
101
98
|
].uniq.join(" ")
|
@@ -275,5 +272,17 @@ module SwissKnife
|
|
275
272
|
|
276
273
|
buffer.html_safe
|
277
274
|
end
|
275
|
+
|
276
|
+
private
|
277
|
+
|
278
|
+
def controller_name
|
279
|
+
unless @controller_name
|
280
|
+
@controller_name = controller.class.name.underscore
|
281
|
+
@controller_name.gsub!(/\//, "_")
|
282
|
+
@controller_name.gsub!(/_controller$/, "")
|
283
|
+
end
|
284
|
+
|
285
|
+
@controller_name
|
286
|
+
end
|
278
287
|
end
|
279
288
|
end
|
data/lib/swiss_knife/version.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe ApplicationController do
|
4
4
|
before do
|
5
|
-
controller
|
5
|
+
controller = double("ProductsController")
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should return inline title" do
|
@@ -54,4 +54,15 @@ describe ApplicationController do
|
|
54
54
|
it "should be added as a helper method" do
|
55
55
|
ApplicationController._helper_methods.should include(:page_title)
|
56
56
|
end
|
57
|
+
|
58
|
+
context "with namespace" do
|
59
|
+
before do
|
60
|
+
controller = double("Admin::ProductsController")
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should return internationalized title" do
|
64
|
+
controller.stub :action_name => "index"
|
65
|
+
controller.page_title.should == "Listing products"
|
66
|
+
end
|
67
|
+
end
|
57
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swiss_knife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
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
|
+
date: 2011-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70319037970000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70319037970000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70319037980320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.7'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70319037980320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nokogiri
|
38
|
-
requirement: &
|
38
|
+
requirement: &70319037977820 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70319037977820
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: fakeweb
|
49
|
-
requirement: &
|
49
|
+
requirement: &70319037992360 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70319037992360
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sqlite3
|
60
|
-
requirement: &
|
60
|
+
requirement: &70319037989720 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70319037989720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
|
-
requirement: &
|
71
|
+
requirement: &70319037986480 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70319037986480
|
80
80
|
description: Several helpers for Rails 3
|
81
81
|
email:
|
82
82
|
- fnando.vieira@gmail.com
|
@@ -156,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
segments:
|
158
158
|
- 0
|
159
|
-
hash: -
|
159
|
+
hash: -4097759454801460063
|
160
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
161
|
none: false
|
162
162
|
requirements:
|
@@ -165,10 +165,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
segments:
|
167
167
|
- 0
|
168
|
-
hash: -
|
168
|
+
hash: -4097759454801460063
|
169
169
|
requirements: []
|
170
170
|
rubyforge_project:
|
171
|
-
rubygems_version: 1.8.
|
171
|
+
rubygems_version: 1.8.11
|
172
172
|
signing_key:
|
173
173
|
specification_version: 3
|
174
174
|
summary: Several helpers for Rails 3
|