crumbs 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +67 -0
- data/lib/crumbs/action_controller/base.rb +6 -8
- data/lib/crumbs/definitions.rb +4 -4
- data/lib/crumbs/railtie.rb +0 -3
- data/lib/crumbs/version.rb +1 -1
- data/lib/crumbs.rb +15 -1
- data/lib/generators/crumbs/install_generator.rb +13 -0
- data/lib/generators/crumbs/templates/crumbs.rb +2 -0
- data/test/dummy/log/test.log +1485 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/generator_test.rb +18 -0
- data/test/with_last_test.rb +8 -8
- data/test/without_last_test.rb +8 -8
- metadata +9 -5
- data/README.rdoc +0 -31
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'generators/crumbs/install_generator'
|
4
|
+
|
5
|
+
class GeneratorsTest < Rails::Generators::TestCase
|
6
|
+
tests Crumbs::InstallGenerator
|
7
|
+
destination File.expand_path('../tmp', File.dirname(__FILE__))
|
8
|
+
|
9
|
+
teardown do
|
10
|
+
FileUtils.rm_rf self.destination_root
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'initializer generator' do
|
14
|
+
run_generator
|
15
|
+
assert_file 'config/initializers/crumbs.rb'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/test/with_last_test.rb
CHANGED
@@ -3,10 +3,10 @@ require 'test_helper'
|
|
3
3
|
class WithLastTest < ActionDispatch::IntegrationTest
|
4
4
|
|
5
5
|
setup do
|
6
|
-
|
6
|
+
Crumbs.config.show_last = true
|
7
7
|
end
|
8
8
|
|
9
|
-
test
|
9
|
+
test 'last request in same path' do
|
10
10
|
get '/'
|
11
11
|
assert_equal [
|
12
12
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/' }
|
@@ -42,7 +42,7 @@ class WithLastTest < ActionDispatch::IntegrationTest
|
|
42
42
|
assert_select 'a[href="/"]', 'Home'
|
43
43
|
end
|
44
44
|
|
45
|
-
test
|
45
|
+
test 'remember last request with parameters in the same path' do
|
46
46
|
get '/?p1=p1'
|
47
47
|
assert_equal [
|
48
48
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -78,7 +78,7 @@ class WithLastTest < ActionDispatch::IntegrationTest
|
|
78
78
|
assert_select 'a[href="/"]', 'Home'
|
79
79
|
end
|
80
80
|
|
81
|
-
test
|
81
|
+
test 'gaps not cause any error and generate crumbs either' do
|
82
82
|
get '/?p1=p1'
|
83
83
|
assert_equal [
|
84
84
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -104,7 +104,7 @@ class WithLastTest < ActionDispatch::IntegrationTest
|
|
104
104
|
assert_select 'a[href="/"]', 'Home'
|
105
105
|
end
|
106
106
|
|
107
|
-
test
|
107
|
+
test 'empty crumbs not cause any error and not generate crumbs' do
|
108
108
|
get '/?p1=p1'
|
109
109
|
assert_equal [
|
110
110
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -138,7 +138,7 @@ class WithLastTest < ActionDispatch::IntegrationTest
|
|
138
138
|
assert_select 'a[href="/"]', 'Home'
|
139
139
|
end
|
140
140
|
|
141
|
-
test
|
141
|
+
test 'params not cause any error and can be use alter crumb name' do
|
142
142
|
get '/?p1=p1'
|
143
143
|
assert_equal [
|
144
144
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -187,7 +187,7 @@ class WithLastTest < ActionDispatch::IntegrationTest
|
|
187
187
|
assert_select 'a[href="/"]', 'Home'
|
188
188
|
end
|
189
189
|
|
190
|
-
test
|
190
|
+
test 'going back not cause any error and retain history' do
|
191
191
|
get '/?p1=p1'
|
192
192
|
assert_equal [
|
193
193
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -238,7 +238,7 @@ class WithLastTest < ActionDispatch::IntegrationTest
|
|
238
238
|
assert_select 'a[href="/param"]', 'Param'
|
239
239
|
end
|
240
240
|
|
241
|
-
test
|
241
|
+
test 'translations not cause any error' do
|
242
242
|
get '/?p1=p1'
|
243
243
|
assert_equal [
|
244
244
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
data/test/without_last_test.rb
CHANGED
@@ -3,10 +3,10 @@ require 'test_helper'
|
|
3
3
|
class WithoutLastTest < ActionDispatch::IntegrationTest
|
4
4
|
|
5
5
|
setup do
|
6
|
-
|
6
|
+
Crumbs.config.show_last = false
|
7
7
|
end
|
8
8
|
|
9
|
-
test
|
9
|
+
test 'last request in same path' do
|
10
10
|
get '/'
|
11
11
|
assert_equal [
|
12
12
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/' }
|
@@ -38,7 +38,7 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
|
|
38
38
|
assert_select 'a', false
|
39
39
|
end
|
40
40
|
|
41
|
-
test
|
41
|
+
test 'remember last request with parameters in the same path' do
|
42
42
|
get '/?p1=p1'
|
43
43
|
assert_equal [
|
44
44
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -70,7 +70,7 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
|
|
70
70
|
assert_select 'a', false
|
71
71
|
end
|
72
72
|
|
73
|
-
test
|
73
|
+
test 'gaps not cause any error and generate crumbs either' do
|
74
74
|
get '/?p1=p1'
|
75
75
|
assert_equal [
|
76
76
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -93,7 +93,7 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
|
|
93
93
|
assert_select 'a', false
|
94
94
|
end
|
95
95
|
|
96
|
-
test
|
96
|
+
test 'empty crumbs not cause any error and not generate crumbs' do
|
97
97
|
get '/?p1=p1'
|
98
98
|
assert_equal [
|
99
99
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -124,7 +124,7 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
|
|
124
124
|
assert_select 'a', false
|
125
125
|
end
|
126
126
|
|
127
|
-
test
|
127
|
+
test 'params not cause any error and can be use alter crumb name' do
|
128
128
|
get '/?p1=p1'
|
129
129
|
assert_equal [
|
130
130
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -168,7 +168,7 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
|
|
168
168
|
assert_select 'a', false
|
169
169
|
end
|
170
170
|
|
171
|
-
test
|
171
|
+
test 'going back not cause any error and retain history' do
|
172
172
|
get '/?p1=p1'
|
173
173
|
assert_equal [
|
174
174
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
@@ -214,7 +214,7 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
|
|
214
214
|
assert_select 'a[href="/?p1=p1"]', 'Home'
|
215
215
|
end
|
216
216
|
|
217
|
-
test
|
217
|
+
test 'translations not cause any error' do
|
218
218
|
get '/?p1=p1'
|
219
219
|
assert_equal [
|
220
220
|
{ base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crumbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Museways
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.3'
|
47
|
-
description: Adds a handy crumbs variable available in your views.
|
47
|
+
description: Adds a handy crumbs variable available in your views in rails.
|
48
48
|
email:
|
49
49
|
- hello@museways.com
|
50
50
|
executables: []
|
@@ -52,13 +52,15 @@ extensions: []
|
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
54
|
- MIT-LICENSE
|
55
|
-
- README.
|
55
|
+
- README.md
|
56
56
|
- Rakefile
|
57
57
|
- lib/crumbs.rb
|
58
58
|
- lib/crumbs/action_controller/base.rb
|
59
59
|
- lib/crumbs/definitions.rb
|
60
60
|
- lib/crumbs/railtie.rb
|
61
61
|
- lib/crumbs/version.rb
|
62
|
+
- lib/generators/crumbs/install_generator.rb
|
63
|
+
- lib/generators/crumbs/templates/crumbs.rb
|
62
64
|
- test/dummy/README.rdoc
|
63
65
|
- test/dummy/Rakefile
|
64
66
|
- test/dummy/app/assets/javascripts/application.js
|
@@ -103,6 +105,7 @@ files:
|
|
103
105
|
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
104
106
|
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
105
107
|
- test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
108
|
+
- test/generator_test.rb
|
106
109
|
- test/test_helper.rb
|
107
110
|
- test/with_last_test.rb
|
108
111
|
- test/without_last_test.rb
|
@@ -129,7 +132,7 @@ rubyforge_project:
|
|
129
132
|
rubygems_version: 2.2.2
|
130
133
|
signing_key:
|
131
134
|
specification_version: 4
|
132
|
-
summary: Crumbs for
|
135
|
+
summary: Crumbs for rails.
|
133
136
|
test_files:
|
134
137
|
- test/dummy/app/assets/javascripts/application.js
|
135
138
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -175,6 +178,7 @@ test_files:
|
|
175
178
|
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
176
179
|
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
177
180
|
- test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
181
|
+
- test/generator_test.rb
|
178
182
|
- test/test_helper.rb
|
179
183
|
- test/with_last_test.rb
|
180
184
|
- test/without_last_test.rb
|
data/README.rdoc
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
{<img src="https://badge.fury.io/rb/crumbs.png" alt="Gem Version" />}[http://badge.fury.io/rb/crumbs] {<img src="https://codeclimate.com/github/museways/crumbs.png" />}[https://codeclimate.com/github/museways/crumbs] {<img src="https://travis-ci.org/museways/crumbs.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/crumbs] {<img src="https://gemnasium.com/museways/crumbs.png" alt="Dependency Status" />}[https://gemnasium.com/museways/crumbs]
|
2
|
-
|
3
|
-
= Crumbs
|
4
|
-
|
5
|
-
Adds a handy crumbs variable available in your views.
|
6
|
-
|
7
|
-
= Install
|
8
|
-
|
9
|
-
Put this line in your Gemfile:
|
10
|
-
gem 'crumbs'
|
11
|
-
|
12
|
-
Then bundle:
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
= Usage
|
16
|
-
|
17
|
-
In your controllers add crumbs to the actions you want to have a crumb:
|
18
|
-
crumb :home, 'Home'
|
19
|
-
|
20
|
-
You can use a lambda, proc or block too, will receive the corresponding url parameters:
|
21
|
-
crumb :product, proc { |params| Product.find(params[:id]).name }
|
22
|
-
|
23
|
-
Then in your views would be available a crumbs variable:
|
24
|
-
<% @crumbs.each do |crumb| %>
|
25
|
-
> <%= link_to crumb[:name], crumb[:path] %>
|
26
|
-
<% end %>
|
27
|
-
|
28
|
-
= Configuration
|
29
|
-
|
30
|
-
If you want to show the last crumb, put this in your application.rb:
|
31
|
-
config.crumbs.show_last = true
|