rails-footnotes 4.0.2 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/README.rdoc +14 -0
- data/lib/rails-footnotes/filter.rb +7 -1
- data/lib/rails-footnotes/notes/assigns_note.rb +11 -3
- data/lib/rails-footnotes/notes/env_note.rb +4 -4
- data/lib/rails-footnotes/version.rb +1 -1
- data/spec/env_note_spec.rb +73 -0
- data/spec/notes/assigns_note_spec.rb +10 -2
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c61d1012a1a550bca3eedf9abf4fe4b6a23b3c01
|
4
|
+
data.tar.gz: 2235e0403ee8ea795a32fd37951ec5200c381f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6732c4cb0de50eb31926df957fb298580021f0c41d814f5e6a77fcba6e7fe1e8be3569c25af77ca4490b67656eb98799d8a391e79dbddfb75fcc2e9b7d6d7c46
|
7
|
+
data.tar.gz: fb79deb960ae52b71542003c1e33bc03357fe494fff99eda615cb3c136276c1e667d771af749fb4d44a62c5d2b226b3352262e8259ac8696ce06057fe5f9c458
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== Footnotes v4.1.0 ==
|
2
|
+
* Allow footnotes url prefix to be a lambda ( Thanks Jamie Lawrence )
|
3
|
+
* Sexier assigns note ( Thanks Joshua Paling )
|
4
|
+
* Fix issues with environment keys not being the same type causing some gems to break ( Thanks Austin Ziegler )
|
5
|
+
|
1
6
|
== Footnotes v4.0.2
|
2
7
|
* Fix bad display of footnotes table
|
3
8
|
* Fix error with the queries note under Rails 4.1.2 (thanks Panayotis Matsinopoulos)
|
data/README.rdoc
CHANGED
@@ -65,6 +65,18 @@ We assume that they appear in that order. "foo://line=%d&file=%s" (%d precedes %
|
|
65
65
|
|
66
66
|
5. Go to RCDefaultApp (OS System Preferences > DefaultApps). Go to URL section, select "tmxt" extension, and set default applicaiton to "SublHandler".
|
67
67
|
|
68
|
+
*Use* *with* *Vagrant* (*and* *other* *virtual* *machines*)
|
69
|
+
|
70
|
+
If you're running your app in Vagrant, you'll find that the edit links won't work because the paths point to the Vagrant directory not your native directory. To solve this, you can use a lambda for the prefix and modify the pathname accordingly.
|
71
|
+
|
72
|
+
For example,
|
73
|
+
|
74
|
+
f.prefix = ->(*args) do
|
75
|
+
filename = args[0].sub '/vagrant', '/Users/jamie/projects/myproject'
|
76
|
+
"subl://open?url=file://#{filename}&line=#{args[1]}&column=#{args[2]}"
|
77
|
+
end
|
78
|
+
|
79
|
+
replaces the vm directory /vagrant with OS X directory where the code is being edited.
|
68
80
|
|
69
81
|
*Footnotes* *Display* *Options*
|
70
82
|
|
@@ -91,6 +103,8 @@ Finally, you can control which notes you want to show. The default are:
|
|
91
103
|
|
92
104
|
f.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log, :general]
|
93
105
|
|
106
|
+
Setting <tt>f.notes = []</tt> will show none of the available notes, although the supporting CSS and JavaScript will still be included. To completely disable all rails-footnotes content on a page, include <tt>params[:footnotes] = 'false'</tt> in the request.
|
107
|
+
|
94
108
|
== Creating your own notes
|
95
109
|
|
96
110
|
Creating your notes to integrate with Footnotes is easy.
|
@@ -47,7 +47,11 @@ module Footnotes
|
|
47
47
|
if args.empty?
|
48
48
|
@@prefix
|
49
49
|
else
|
50
|
-
|
50
|
+
if @@prefix.respond_to? :call
|
51
|
+
@@prefix.call *args
|
52
|
+
else
|
53
|
+
format(@@prefix, *args)
|
54
|
+
end
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
@@ -161,8 +165,10 @@ module Footnotes
|
|
161
165
|
#footnotes_debug a {color: #9b1b1b; font-weight: inherit; text-decoration: none; line-height: 18px;}
|
162
166
|
#footnotes_debug table {text-align: left; width: 100%;}
|
163
167
|
#footnotes_debug table td {padding: 5px; border-bottom: 1px solid #ccc;}
|
168
|
+
#footnotes_debug table td strong {color: #9b1b1b;}
|
164
169
|
#footnotes_debug table th {padding: 5px; border-bottom: 1px solid #ccc;}
|
165
170
|
#footnotes_debug table tr:nth-child(2n) td {background: #eee;}
|
171
|
+
#footnotes_debug table tr:nth-child(2n + 1) td {background: #fff;}
|
166
172
|
#footnotes_debug tbody {text-align: left;}
|
167
173
|
#footnotes_debug .name_values td {vertical-align: top;}
|
168
174
|
#footnotes_debug legend {background-color: #fff;}
|
@@ -13,7 +13,8 @@ module Footnotes
|
|
13
13
|
:@_request,
|
14
14
|
:@db_rt_before_render,
|
15
15
|
:@db_rt_after_render,
|
16
|
-
:@view_runtime
|
16
|
+
:@view_runtime,
|
17
|
+
:@marked_for_same_origin_verification
|
17
18
|
]
|
18
19
|
cattr_accessor :ignored_assigns, :instance_writter => false
|
19
20
|
@@ignored_assigns_pattern = /^@_/
|
@@ -37,7 +38,13 @@ module Footnotes
|
|
37
38
|
|
38
39
|
protected
|
39
40
|
def to_table
|
40
|
-
|
41
|
+
table = assigns.inject([]) do |rr, var|
|
42
|
+
class_name = assigned_value(var).class.name
|
43
|
+
var_name = var.to_s
|
44
|
+
rr << ["<strong>#{var.to_s}</strong>" + "<br /><em>#{class_name}</em>", escape(assigned_value(var).inspect)]
|
45
|
+
end
|
46
|
+
|
47
|
+
table.unshift(['Name', 'Value'])
|
41
48
|
end
|
42
49
|
|
43
50
|
def assigns
|
@@ -45,8 +52,9 @@ module Footnotes
|
|
45
52
|
end
|
46
53
|
|
47
54
|
def assigned_value(key)
|
48
|
-
@controller.instance_variable_get(key)
|
55
|
+
@controller.instance_variable_get(key)
|
49
56
|
end
|
57
|
+
|
50
58
|
end
|
51
59
|
end
|
52
60
|
end
|
@@ -6,15 +6,15 @@ module Footnotes
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def content
|
9
|
-
env_data = @env.
|
9
|
+
env_data = @env.map { |k, v|
|
10
10
|
case k
|
11
11
|
when 'HTTP_COOKIE'
|
12
12
|
# Replace HTTP_COOKIE for a link
|
13
|
-
[k, '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>']
|
13
|
+
[k.to_s, '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>']
|
14
14
|
else
|
15
|
-
[k, escape(v.to_s)]
|
15
|
+
[k.to_s, escape(v.to_s)]
|
16
16
|
end
|
17
|
-
|
17
|
+
}.sort.unshift([ :key, escape('value') ])
|
18
18
|
|
19
19
|
# Create the env table
|
20
20
|
mount_table(env_data)
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'action_controller'
|
3
|
+
require 'action_controller/test_case'
|
4
|
+
|
5
|
+
class FootnotesEnvController < ActionController::Base
|
6
|
+
attr_accessor :template, :performed_render
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Footnotes::Notes::EnvNote do
|
10
|
+
let(:controller) {
|
11
|
+
FootnotesEnvController.new.tap { |c|
|
12
|
+
c.template = Object.new
|
13
|
+
c.request = ActionController::TestRequest.new
|
14
|
+
c.response = ActionController::TestResponse.new
|
15
|
+
c.response_body = %Q(<html><body></body></html>)
|
16
|
+
c.params = {}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
subject { described_class.new(controller) }
|
21
|
+
|
22
|
+
before do
|
23
|
+
@notes = Footnotes::Filter.notes
|
24
|
+
Footnotes::Filter.notes = [ :env ]
|
25
|
+
end
|
26
|
+
|
27
|
+
after do
|
28
|
+
Footnotes::Filter.notes = @notes
|
29
|
+
end
|
30
|
+
|
31
|
+
it '#to_sym is :env' do
|
32
|
+
expect(subject.to_sym).to eq(:env)
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'with non-spec env keys' do
|
36
|
+
before :each do
|
37
|
+
controller.request.env.replace(:non_spec => 'symbol_env')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'does not raise an exception' do
|
41
|
+
expect { subject.content }.not_to raise_error
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'includes the environment row' do
|
45
|
+
expect(subject).to receive(:mount_table).
|
46
|
+
with([ [ :key, 'value' ], [ 'non_spec', 'symbol_env' ] ])
|
47
|
+
subject.content
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'includes values for all of the keys except HTTP_COOKIE' do
|
52
|
+
env = controller.request.env.dup
|
53
|
+
env.delete('HTTP_COOKIE')
|
54
|
+
|
55
|
+
env_data = env.map { |k, v| [ k.to_s, subject.escape(v.to_s) ] }.
|
56
|
+
sort.
|
57
|
+
unshift([ :key, 'value' ])
|
58
|
+
|
59
|
+
expect(subject).to receive(:mount_table).with(env_data)
|
60
|
+
subject.content
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'gets a link for HTTP_COOKIE' do
|
64
|
+
controller.request.env.replace('HTTP_COOKIE' => 'foo')
|
65
|
+
expect(subject).to receive(:mount_table).
|
66
|
+
with([
|
67
|
+
[ :key, 'value' ],
|
68
|
+
[ 'HTTP_COOKIE',
|
69
|
+
'<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>' ]
|
70
|
+
])
|
71
|
+
subject.content
|
72
|
+
end
|
73
|
+
end
|
@@ -18,7 +18,11 @@ describe Footnotes::Notes::AssignsNote do
|
|
18
18
|
its(:title) {should eql 'Assigns (2)'}
|
19
19
|
|
20
20
|
specify {note.send(:assigns).should eql [:@action_has_layout, :@status]}
|
21
|
-
specify {note.send(:to_table).should eql [
|
21
|
+
specify {note.send(:to_table).should eql [
|
22
|
+
["Name", "Value"],
|
23
|
+
["<strong>@action_has_layout</strong><br /><em>TrueClass</em>", "true"],
|
24
|
+
["<strong>@status</strong><br /><em>Fixnum</em>", "200"]
|
25
|
+
]}
|
22
26
|
|
23
27
|
describe "Ignored Assigns" do
|
24
28
|
before(:each) {Footnotes::Notes::AssignsNote.ignored_assigns = [:@status]}
|
@@ -32,7 +36,11 @@ describe Footnotes::Notes::AssignsNote do
|
|
32
36
|
|
33
37
|
it "should call #mount_table method with correct params" do
|
34
38
|
note.should_receive(:mount_table).with(
|
35
|
-
[
|
39
|
+
[
|
40
|
+
["Name", "Value"],
|
41
|
+
["<strong>@action_has_layout</strong><br /><em>TrueClass</em>", "true"],
|
42
|
+
["<strong>@status</strong><br /><em>Fixnum</em>", "200"]
|
43
|
+
], {:summary=>"Debug information for Assigns (2)"})
|
36
44
|
note.content
|
37
45
|
end
|
38
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-footnotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman V. Babenko
|
@@ -12,48 +12,48 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-
|
15
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: '3.2'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '3.2'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: rspec-rails
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- - ~>
|
35
|
+
- - "~>"
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 2.14.0
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- - ~>
|
42
|
+
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: 2.14.0
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: capybara
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
52
|
type: :development
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
description: Every Rails page has footnotes that gives information about your application
|
@@ -64,9 +64,9 @@ executables: []
|
|
64
64
|
extensions: []
|
65
65
|
extra_rdoc_files: []
|
66
66
|
files:
|
67
|
-
- .gitignore
|
68
|
-
- .rspec.example
|
69
|
-
- .travis.yml
|
67
|
+
- ".gitignore"
|
68
|
+
- ".rspec.example"
|
69
|
+
- ".travis.yml"
|
70
70
|
- CHANGELOG
|
71
71
|
- Gemfile
|
72
72
|
- MIT-LICENSE
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- spec/controllers/footnotes_controller_spec.rb
|
108
108
|
- spec/controllers/log_note_controller_spec.rb
|
109
109
|
- spec/controllers/partials_note_controller_spec.rb
|
110
|
+
- spec/env_note_spec.rb
|
110
111
|
- spec/fixtures/html_download.html
|
111
112
|
- spec/footnotes_spec.rb
|
112
113
|
- spec/notes/assigns_note_spec.rb
|
@@ -126,12 +127,12 @@ require_paths:
|
|
126
127
|
- lib
|
127
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
|
-
- -
|
130
|
+
- - ">="
|
130
131
|
- !ruby/object:Gem::Version
|
131
132
|
version: '0'
|
132
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
134
|
requirements:
|
134
|
-
- -
|
135
|
+
- - ">="
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: '0'
|
137
138
|
requirements: []
|
@@ -146,6 +147,7 @@ test_files:
|
|
146
147
|
- spec/controllers/footnotes_controller_spec.rb
|
147
148
|
- spec/controllers/log_note_controller_spec.rb
|
148
149
|
- spec/controllers/partials_note_controller_spec.rb
|
150
|
+
- spec/env_note_spec.rb
|
149
151
|
- spec/fixtures/html_download.html
|
150
152
|
- spec/footnotes_spec.rb
|
151
153
|
- spec/notes/assigns_note_spec.rb
|
@@ -156,4 +158,3 @@ test_files:
|
|
156
158
|
- spec/spec_helper.rb
|
157
159
|
- spec/views/partials/_foo.html.erb
|
158
160
|
- spec/views/partials/index.html.erb
|
159
|
-
has_rdoc:
|