breadcrumb_trail 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +3 -0
- data/.travis.yml +11 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +142 -0
- data/LICENSE.txt +22 -0
- data/README.md +136 -0
- data/Rakefile +28 -0
- data/breadcrumb_trail.gemspec +30 -0
- data/lib/breadcrumb_trail/action_controller.rb +79 -0
- data/lib/breadcrumb_trail/breadcrumb.rb +95 -0
- data/lib/breadcrumb_trail/builder.rb +98 -0
- data/lib/breadcrumb_trail/railtie.rb +11 -0
- data/lib/breadcrumb_trail/version.rb +5 -0
- data/lib/breadcrumb_trail.rb +10 -0
- data/lib/tasks/breadcrumb_trail_tasks.rake +4 -0
- data/spec/block_builder_spec.rb +19 -0
- data/spec/breadcrumb_spec.rb +93 -0
- data/spec/builder_spec.rb +16 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +7 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/welcome_controller.rb +11 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +11 -0
- data/spec/dummy/app/views/welcome/hello.html.erb +4 -0
- data/spec/dummy/app/views/welcome/index.html.erb +2 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +21 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/html_builder_spec.rb +62 -0
- data/spec/integration/application_breadcrumbs_spec.rb +46 -0
- data/spec/spec_helper.rb +10 -0
- metadata +235 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
RSpec.describe BreadcrumbTrail::HTMLBuilder do
|
2
|
+
let(:breadcrumbs) {
|
3
|
+
[
|
4
|
+
{ path: "/", name: "home" },
|
5
|
+
{ path: "/foo", name: "foo" },
|
6
|
+
{ path: "/foo/bar", name: "foo/bar" }
|
7
|
+
].map { |data| BreadcrumbTrail::Breadcrumb.new(data) } }
|
8
|
+
let(:context) { double("context") }
|
9
|
+
let(:options) { Hash.new }
|
10
|
+
|
11
|
+
subject { described_class.new(context, breadcrumbs, options) }
|
12
|
+
|
13
|
+
it "renders a list" do
|
14
|
+
expect(subject.call).to eq "<ol>" \
|
15
|
+
"<li><a href=\"/\">home</a></li>" \
|
16
|
+
"<li><a href=\"/foo\">foo</a></li>" \
|
17
|
+
"<li><a href=\"/foo/bar\">foo/bar</a></li>" \
|
18
|
+
"</ol>"
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "when given options" do
|
22
|
+
let(:options) { { outer: "ul", outer_options: { class: "navigation" } } }
|
23
|
+
|
24
|
+
it "renders a list with options" do
|
25
|
+
expect(subject.call).
|
26
|
+
to eq "<ul class=\"navigation\">" \
|
27
|
+
"<li><a href=\"/\">home</a></li>" \
|
28
|
+
"<li><a href=\"/foo\">foo</a></li>" \
|
29
|
+
"<li><a href=\"/foo/bar\">foo/bar</a></li>" \
|
30
|
+
"</ul>"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "when given nil tags" do
|
35
|
+
let(:options) { { outer: nil, inner: nil } }
|
36
|
+
|
37
|
+
it "renders only links" do
|
38
|
+
expect(subject.call).to eq \
|
39
|
+
"<a href=\"/\">home</a>" \
|
40
|
+
"<a href=\"/foo\">foo</a>" \
|
41
|
+
"<a href=\"/foo/bar\">foo/bar</a>"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "when given breadcrumbs with html data" do
|
46
|
+
let(:breadcrumbs) {
|
47
|
+
[
|
48
|
+
{ path: "/", name: "<script>home</script>" },
|
49
|
+
{ path: "/foo", name: "<a>foo</a>" },
|
50
|
+
{ path: "/foo/bar", name: "<foo/bar>" }
|
51
|
+
].map { |data| BreadcrumbTrail::Breadcrumb.new(data) }
|
52
|
+
}
|
53
|
+
|
54
|
+
it "escapes the breadcrumbs" do
|
55
|
+
expect(subject.call).to eq "<ol>" \
|
56
|
+
"<li><a href=\"/\"><script>home</script></a></li>" \
|
57
|
+
"<li><a href=\"/foo\"><a>foo</a></a></li>" \
|
58
|
+
"<li><a href=\"/foo/bar\"><foo/bar></a></li>" \
|
59
|
+
"</ol>"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
describe "In application", type: :request do
|
2
|
+
example "with a basic request" do
|
3
|
+
get '/'
|
4
|
+
|
5
|
+
expect(response.body).to eq <<-HTML.strip_heredoc
|
6
|
+
<!DOCTYPE html>
|
7
|
+
<html>
|
8
|
+
<head>
|
9
|
+
<title>Dummy app</title>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<ol><li><a href="/">home</a></li><li><a href="/">here</a></li></ol>
|
13
|
+
<h1>Home</h1>
|
14
|
+
<p>Hello world!</p>
|
15
|
+
|
16
|
+
|
17
|
+
</body>
|
18
|
+
</html>
|
19
|
+
HTML
|
20
|
+
end
|
21
|
+
|
22
|
+
example "with a block request" do
|
23
|
+
get '/hello'
|
24
|
+
|
25
|
+
expect(response.body).to eq <<-HTML.strip_heredoc
|
26
|
+
<!DOCTYPE html>
|
27
|
+
<html>
|
28
|
+
<head>
|
29
|
+
<title>Dummy app</title>
|
30
|
+
</head>
|
31
|
+
<body>
|
32
|
+
<ol><li><a href="/">home</a></li><li><a href="/">here</a></li><li><a href="/world">world</a></li></ol>
|
33
|
+
Breadcrumbs:
|
34
|
+
home: /
|
35
|
+
here: /
|
36
|
+
world: /world
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
</body>
|
43
|
+
</html>
|
44
|
+
HTML
|
45
|
+
end
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require "codeclimate-test-reporter"
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
# Configure Rails Environment
|
4
|
+
ENV["RAILS_ENV"] = "test"
|
5
|
+
path = File.expand_path("../", __FILE__)
|
6
|
+
require "dummy/config/environment"
|
7
|
+
require "rspec/rails"
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
metadata
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: breadcrumb_trail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeremy Rodi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: codeclimate-test-reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '5'
|
93
|
+
type: :runtime
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '3.0'
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '5'
|
103
|
+
description: A breadcrumb trail plugin that provides shortcuts to make your life easier.
|
104
|
+
email:
|
105
|
+
- redjazz96@gmail.com
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- ".gitignore"
|
111
|
+
- ".rspec"
|
112
|
+
- ".travis.yml"
|
113
|
+
- Gemfile
|
114
|
+
- Gemfile.lock
|
115
|
+
- LICENSE.txt
|
116
|
+
- README.md
|
117
|
+
- Rakefile
|
118
|
+
- breadcrumb_trail.gemspec
|
119
|
+
- lib/breadcrumb_trail.rb
|
120
|
+
- lib/breadcrumb_trail/action_controller.rb
|
121
|
+
- lib/breadcrumb_trail/breadcrumb.rb
|
122
|
+
- lib/breadcrumb_trail/builder.rb
|
123
|
+
- lib/breadcrumb_trail/railtie.rb
|
124
|
+
- lib/breadcrumb_trail/version.rb
|
125
|
+
- lib/tasks/breadcrumb_trail_tasks.rake
|
126
|
+
- spec/block_builder_spec.rb
|
127
|
+
- spec/breadcrumb_spec.rb
|
128
|
+
- spec/builder_spec.rb
|
129
|
+
- spec/dummy/README.rdoc
|
130
|
+
- spec/dummy/Rakefile
|
131
|
+
- spec/dummy/app/assets/images/.keep
|
132
|
+
- spec/dummy/app/assets/javascripts/application.js
|
133
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
134
|
+
- spec/dummy/app/controllers/application_controller.rb
|
135
|
+
- spec/dummy/app/controllers/concerns/.keep
|
136
|
+
- spec/dummy/app/controllers/welcome_controller.rb
|
137
|
+
- spec/dummy/app/helpers/application_helper.rb
|
138
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
139
|
+
- spec/dummy/app/views/welcome/hello.html.erb
|
140
|
+
- spec/dummy/app/views/welcome/index.html.erb
|
141
|
+
- spec/dummy/bin/bundle
|
142
|
+
- spec/dummy/bin/rails
|
143
|
+
- spec/dummy/bin/rake
|
144
|
+
- spec/dummy/bin/setup
|
145
|
+
- spec/dummy/config.ru
|
146
|
+
- spec/dummy/config/application.rb
|
147
|
+
- spec/dummy/config/boot.rb
|
148
|
+
- spec/dummy/config/environment.rb
|
149
|
+
- spec/dummy/config/environments/test.rb
|
150
|
+
- spec/dummy/config/initializers/assets.rb
|
151
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
152
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
153
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
154
|
+
- spec/dummy/config/initializers/inflections.rb
|
155
|
+
- spec/dummy/config/initializers/mime_types.rb
|
156
|
+
- spec/dummy/config/initializers/session_store.rb
|
157
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
158
|
+
- spec/dummy/config/locales/en.yml
|
159
|
+
- spec/dummy/config/routes.rb
|
160
|
+
- spec/dummy/config/secrets.yml
|
161
|
+
- spec/dummy/public/404.html
|
162
|
+
- spec/dummy/public/422.html
|
163
|
+
- spec/dummy/public/500.html
|
164
|
+
- spec/dummy/public/favicon.ico
|
165
|
+
- spec/html_builder_spec.rb
|
166
|
+
- spec/integration/application_breadcrumbs_spec.rb
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
homepage: https://github.com/medcat/breadcrumb_trail
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
metadata: {}
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubyforge_project:
|
188
|
+
rubygems_version: 2.2.2
|
189
|
+
signing_key:
|
190
|
+
specification_version: 4
|
191
|
+
summary: A basic breadcrumb trail plugin.
|
192
|
+
test_files:
|
193
|
+
- spec/block_builder_spec.rb
|
194
|
+
- spec/breadcrumb_spec.rb
|
195
|
+
- spec/builder_spec.rb
|
196
|
+
- spec/dummy/README.rdoc
|
197
|
+
- spec/dummy/Rakefile
|
198
|
+
- spec/dummy/app/assets/images/.keep
|
199
|
+
- spec/dummy/app/assets/javascripts/application.js
|
200
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
201
|
+
- spec/dummy/app/controllers/application_controller.rb
|
202
|
+
- spec/dummy/app/controllers/concerns/.keep
|
203
|
+
- spec/dummy/app/controllers/welcome_controller.rb
|
204
|
+
- spec/dummy/app/helpers/application_helper.rb
|
205
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
206
|
+
- spec/dummy/app/views/welcome/hello.html.erb
|
207
|
+
- spec/dummy/app/views/welcome/index.html.erb
|
208
|
+
- spec/dummy/bin/bundle
|
209
|
+
- spec/dummy/bin/rails
|
210
|
+
- spec/dummy/bin/rake
|
211
|
+
- spec/dummy/bin/setup
|
212
|
+
- spec/dummy/config.ru
|
213
|
+
- spec/dummy/config/application.rb
|
214
|
+
- spec/dummy/config/boot.rb
|
215
|
+
- spec/dummy/config/environment.rb
|
216
|
+
- spec/dummy/config/environments/test.rb
|
217
|
+
- spec/dummy/config/initializers/assets.rb
|
218
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
219
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
220
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
221
|
+
- spec/dummy/config/initializers/inflections.rb
|
222
|
+
- spec/dummy/config/initializers/mime_types.rb
|
223
|
+
- spec/dummy/config/initializers/session_store.rb
|
224
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
225
|
+
- spec/dummy/config/locales/en.yml
|
226
|
+
- spec/dummy/config/routes.rb
|
227
|
+
- spec/dummy/config/secrets.yml
|
228
|
+
- spec/dummy/public/404.html
|
229
|
+
- spec/dummy/public/422.html
|
230
|
+
- spec/dummy/public/500.html
|
231
|
+
- spec/dummy/public/favicon.ico
|
232
|
+
- spec/html_builder_spec.rb
|
233
|
+
- spec/integration/application_breadcrumbs_spec.rb
|
234
|
+
- spec/spec_helper.rb
|
235
|
+
has_rdoc:
|