rails-footnotes 7.0.0 → 7.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67dd876890a76a0d5907902934ec0fd233d143c002a5dc67572f2015f6f3ef0a
4
- data.tar.gz: be6c1412e334b99111f4c0e5eb702c79f1e213aa39bc01750478b7c9823d7363
3
+ metadata.gz: '0806369e63f41ba98bc1ca73ea106d8d0d77a804e4118a1e4d35c8b504e76895'
4
+ data.tar.gz: 3081ed9edcd94647f9d977329de5e1fe71a859410d99325f3e42bdcb9b54cb8c
5
5
  SHA512:
6
- metadata.gz: c752688540b1f643dc25faf90fcdb879ac0477aa463acb423ec24011eb76d3d84160b1a583630d7002699ae181dc083cff17f7e2a6d46bdf75ba52f4416dd270
7
- data.tar.gz: a9010b8aead77c935804b045e4b227f04979a6a2b31bd367c90a06d5dcbf96cc31a2c83dd6d868c59824f650213d84bf9e4690bb7bf06d15e389b5fd6489a1c7
6
+ metadata.gz: c448ae88bc1b66831537d29108d8e37404ae888631e522a25cbff351341551ee875eaf443c42f8a146761e8e48db53244746628b2f0b3474c8415c215e763d7f
7
+ data.tar.gz: 0147a705dc6ccca11c82ca5fda8d14e88e116f4a3ea44f1f29822cf66596c0369e437d99b979036998307308d8c4f1bef555f6f9e6d7c44964174b7ae946d7eb
data/Gemfile CHANGED
@@ -5,9 +5,11 @@ gemspec
5
5
  ruby file: ".ruby-version"
6
6
 
7
7
  gem "capybara", "~> 3.35"
8
+ gem "gem-release", "~> 2.2"
9
+ gem "matrix", "~> 0.4.2"
8
10
  gem "nokogiri", "~> 1.12"
9
11
  gem "pry", "~> 0.14.1"
10
12
  gem "rake", "~> 13.0"
11
13
  gem "rspec-rails", "~> 6.0"
12
14
  gem "sprockets-rails", "~> 3.2"
13
- gem "matrix", "~> 0.4.2"
15
+ gem "sqlite3", "~> 1.6"
data/Gemfile.lock CHANGED
@@ -1,79 +1,90 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-footnotes (7.0.0)
4
+ rails-footnotes (7.0.1)
5
5
  rails (~> 7.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.8)
11
- actionpack (= 7.0.8)
12
- activesupport (= 7.0.8)
10
+ actioncable (7.1.2)
11
+ actionpack (= 7.1.2)
12
+ activesupport (= 7.1.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.8)
16
- actionpack (= 7.0.8)
17
- activejob (= 7.0.8)
18
- activerecord (= 7.0.8)
19
- activestorage (= 7.0.8)
20
- activesupport (= 7.0.8)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (7.1.2)
17
+ actionpack (= 7.1.2)
18
+ activejob (= 7.1.2)
19
+ activerecord (= 7.1.2)
20
+ activestorage (= 7.1.2)
21
+ activesupport (= 7.1.2)
21
22
  mail (>= 2.7.1)
22
23
  net-imap
23
24
  net-pop
24
25
  net-smtp
25
- actionmailer (7.0.8)
26
- actionpack (= 7.0.8)
27
- actionview (= 7.0.8)
28
- activejob (= 7.0.8)
29
- activesupport (= 7.0.8)
26
+ actionmailer (7.1.2)
27
+ actionpack (= 7.1.2)
28
+ actionview (= 7.1.2)
29
+ activejob (= 7.1.2)
30
+ activesupport (= 7.1.2)
30
31
  mail (~> 2.5, >= 2.5.4)
31
32
  net-imap
32
33
  net-pop
33
34
  net-smtp
34
- rails-dom-testing (~> 2.0)
35
- actionpack (7.0.8)
36
- actionview (= 7.0.8)
37
- activesupport (= 7.0.8)
38
- rack (~> 2.0, >= 2.2.4)
35
+ rails-dom-testing (~> 2.2)
36
+ actionpack (7.1.2)
37
+ actionview (= 7.1.2)
38
+ activesupport (= 7.1.2)
39
+ nokogiri (>= 1.8.5)
40
+ racc
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
39
43
  rack-test (>= 0.6.3)
40
- rails-dom-testing (~> 2.0)
41
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.8)
43
- actionpack (= 7.0.8)
44
- activerecord (= 7.0.8)
45
- activestorage (= 7.0.8)
46
- activesupport (= 7.0.8)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.2)
47
+ actionpack (= 7.1.2)
48
+ activerecord (= 7.1.2)
49
+ activestorage (= 7.1.2)
50
+ activesupport (= 7.1.2)
47
51
  globalid (>= 0.6.0)
48
52
  nokogiri (>= 1.8.5)
49
- actionview (7.0.8)
50
- activesupport (= 7.0.8)
53
+ actionview (7.1.2)
54
+ activesupport (= 7.1.2)
51
55
  builder (~> 3.1)
52
- erubi (~> 1.4)
53
- rails-dom-testing (~> 2.0)
54
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.8)
56
- activesupport (= 7.0.8)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.2)
60
+ activesupport (= 7.1.2)
57
61
  globalid (>= 0.3.6)
58
- activemodel (7.0.8)
59
- activesupport (= 7.0.8)
60
- activerecord (7.0.8)
61
- activemodel (= 7.0.8)
62
- activesupport (= 7.0.8)
63
- activestorage (7.0.8)
64
- actionpack (= 7.0.8)
65
- activejob (= 7.0.8)
66
- activerecord (= 7.0.8)
67
- activesupport (= 7.0.8)
62
+ activemodel (7.1.2)
63
+ activesupport (= 7.1.2)
64
+ activerecord (7.1.2)
65
+ activemodel (= 7.1.2)
66
+ activesupport (= 7.1.2)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.2)
69
+ actionpack (= 7.1.2)
70
+ activejob (= 7.1.2)
71
+ activerecord (= 7.1.2)
72
+ activesupport (= 7.1.2)
68
73
  marcel (~> 1.0)
69
- mini_mime (>= 1.1.0)
70
- activesupport (7.0.8)
74
+ activesupport (7.1.2)
75
+ base64
76
+ bigdecimal
71
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
72
80
  i18n (>= 1.6, < 2)
73
81
  minitest (>= 5.1)
82
+ mutex_m
74
83
  tzinfo (~> 2.0)
75
84
  addressable (2.8.5)
76
85
  public_suffix (>= 2.0.2, < 6.0)
86
+ base64 (0.2.0)
87
+ bigdecimal (3.1.4)
77
88
  builder (3.2.4)
78
89
  capybara (3.39.2)
79
90
  addressable
@@ -86,14 +97,22 @@ GEM
86
97
  xpath (~> 3.2)
87
98
  coderay (1.1.3)
88
99
  concurrent-ruby (1.2.2)
100
+ connection_pool (2.4.1)
89
101
  crass (1.0.6)
90
102
  date (3.3.4)
91
103
  diff-lcs (1.5.0)
104
+ drb (2.2.0)
105
+ ruby2_keywords
92
106
  erubi (1.12.0)
107
+ gem-release (2.2.2)
93
108
  globalid (1.2.1)
94
109
  activesupport (>= 6.1)
95
110
  i18n (1.14.1)
96
111
  concurrent-ruby (~> 1.0)
112
+ io-console (0.6.0)
113
+ irb (1.10.0)
114
+ rdoc
115
+ reline (>= 0.3.8)
97
116
  loofah (2.22.0)
98
117
  crass (~> 1.0.2)
99
118
  nokogiri (>= 1.12.0)
@@ -107,7 +126,8 @@ GEM
107
126
  method_source (1.0.0)
108
127
  mini_mime (1.1.5)
109
128
  minitest (5.20.0)
110
- net-imap (0.4.6)
129
+ mutex_m (0.2.0)
130
+ net-imap (0.4.7)
111
131
  date
112
132
  net-protocol
113
133
  net-pop (0.1.2)
@@ -116,7 +136,7 @@ GEM
116
136
  timeout
117
137
  net-smtp (0.4.0)
118
138
  net-protocol
119
- nio4r (2.6.1)
139
+ nio4r (2.7.0)
120
140
  nokogiri (1.15.5-arm64-darwin)
121
141
  racc (~> 1.4)
122
142
  nokogiri (1.15.5-x86_64-linux)
@@ -124,25 +144,32 @@ GEM
124
144
  pry (0.14.2)
125
145
  coderay (~> 1.1)
126
146
  method_source (~> 1.0)
147
+ psych (5.1.1.1)
148
+ stringio
127
149
  public_suffix (5.0.4)
128
150
  racc (1.7.3)
129
- rack (2.2.8)
151
+ rack (3.0.8)
152
+ rack-session (2.0.0)
153
+ rack (>= 3.0.0)
130
154
  rack-test (2.1.0)
131
155
  rack (>= 1.3)
132
- rails (7.0.8)
133
- actioncable (= 7.0.8)
134
- actionmailbox (= 7.0.8)
135
- actionmailer (= 7.0.8)
136
- actionpack (= 7.0.8)
137
- actiontext (= 7.0.8)
138
- actionview (= 7.0.8)
139
- activejob (= 7.0.8)
140
- activemodel (= 7.0.8)
141
- activerecord (= 7.0.8)
142
- activestorage (= 7.0.8)
143
- activesupport (= 7.0.8)
156
+ rackup (2.1.0)
157
+ rack (>= 3)
158
+ webrick (~> 1.8)
159
+ rails (7.1.2)
160
+ actioncable (= 7.1.2)
161
+ actionmailbox (= 7.1.2)
162
+ actionmailer (= 7.1.2)
163
+ actionpack (= 7.1.2)
164
+ actiontext (= 7.1.2)
165
+ actionview (= 7.1.2)
166
+ activejob (= 7.1.2)
167
+ activemodel (= 7.1.2)
168
+ activerecord (= 7.1.2)
169
+ activestorage (= 7.1.2)
170
+ activesupport (= 7.1.2)
144
171
  bundler (>= 1.15.0)
145
- railties (= 7.0.8)
172
+ railties (= 7.1.2)
146
173
  rails-dom-testing (2.2.0)
147
174
  activesupport (>= 5.0.0)
148
175
  minitest
@@ -150,15 +177,20 @@ GEM
150
177
  rails-html-sanitizer (1.6.0)
151
178
  loofah (~> 2.21)
152
179
  nokogiri (~> 1.14)
153
- railties (7.0.8)
154
- actionpack (= 7.0.8)
155
- activesupport (= 7.0.8)
156
- method_source
180
+ railties (7.1.2)
181
+ actionpack (= 7.1.2)
182
+ activesupport (= 7.1.2)
183
+ irb
184
+ rackup (>= 1.0.0)
157
185
  rake (>= 12.2)
158
- thor (~> 1.0)
159
- zeitwerk (~> 2.5)
186
+ thor (~> 1.0, >= 1.2.2)
187
+ zeitwerk (~> 2.6)
160
188
  rake (13.1.0)
189
+ rdoc (6.6.0)
190
+ psych (>= 4.0.0)
161
191
  regexp_parser (2.8.2)
192
+ reline (0.4.1)
193
+ io-console (~> 0.5)
162
194
  rspec-core (3.12.2)
163
195
  rspec-support (~> 3.12.0)
164
196
  rspec-expectations (3.12.3)
@@ -176,6 +208,7 @@ GEM
176
208
  rspec-mocks (~> 3.12)
177
209
  rspec-support (~> 3.12)
178
210
  rspec-support (3.12.1)
211
+ ruby2_keywords (0.0.5)
179
212
  sprockets (4.2.1)
180
213
  concurrent-ruby (~> 1.0)
181
214
  rack (>= 2.2.4, < 4)
@@ -183,10 +216,14 @@ GEM
183
216
  actionpack (>= 5.2)
184
217
  activesupport (>= 5.2)
185
218
  sprockets (>= 3.0.0)
219
+ sqlite3 (1.6.9-arm64-darwin)
220
+ sqlite3 (1.6.9-x86_64-linux)
221
+ stringio (3.1.0)
186
222
  thor (1.3.0)
187
223
  timeout (0.4.1)
188
224
  tzinfo (2.0.6)
189
225
  concurrent-ruby (~> 1.0)
226
+ webrick (1.8.1)
190
227
  websocket-driver (0.7.6)
191
228
  websocket-extensions (>= 0.1.0)
192
229
  websocket-extensions (0.1.5)
@@ -202,6 +239,7 @@ PLATFORMS
202
239
 
203
240
  DEPENDENCIES
204
241
  capybara (~> 3.35)
242
+ gem-release (~> 2.2)
205
243
  matrix (~> 0.4.2)
206
244
  nokogiri (~> 1.12)
207
245
  pry (~> 0.14.1)
@@ -209,6 +247,7 @@ DEPENDENCIES
209
247
  rake (~> 13.0)
210
248
  rspec-rails (~> 6.0)
211
249
  sprockets-rails (~> 3.2)
250
+ sqlite3 (~> 1.6)
212
251
 
213
252
  RUBY VERSION
214
253
  ruby 3.2.2p53
@@ -1,4 +1,4 @@
1
- = Rails 7 Footnotes
1
+ # Rails 7 Footnotes
2
2
 
3
3
  Rails footnotes displays footnotes in your application for easy debugging, such as sessions,
4
4
  request parameters, cookies, filter chain, routes, queries, etc.
@@ -6,34 +6,37 @@ request parameters, cookies, filter chain, routes, queries, etc.
6
6
  Even more, it contains links to open files directly in your editor including
7
7
  your backtrace lines.
8
8
 
9
- == Installation
9
+ ### Installation
10
10
 
11
- Add to your `Gemfile`:
11
+ 1. Add to your `Gemfile` with `bundle add rails-footnotes`
12
+ 2. Run `bundle install`
13
+ 3. Generate the initializer with `bin/rails generate rails_footnotes:install`
12
14
 
13
- gem "rails-footnotes", "~> 5.0"
14
-
15
- Run `bundle install`, then the generator:
15
+ This will create an initializer with default config and some examples.
16
16
 
17
- rails generate rails_footnotes:install
17
+ ### Hooks
18
18
 
19
- This will create an initializer with default config and some examples.
19
+ You can run blocks before and after footnotes are evaluated.
20
20
 
21
- === Hooks
21
+ ```
22
+ Footnotes.setup do |config|
23
+ config.before do |controller, filter|
24
+ filter.notes = (controller.class.name =~ /Message/ && controller.action_name == 'index' ? [:assigns] : [])
25
+ end
22
26
 
23
- Footnotes.setup do |config|
24
- config.before {|controller, filter| filter.notes = controller.class.name =~ /Message/ && \
25
- controller.action_name == 'index' ? [:assigns] : []}
26
- config.before {|controller, filter| filter.notes |= [:params] if controller.class.name =~ /Profile/ && \
27
- controller.action_name == 'edit' }
28
- end
27
+ config.before do |controller, filter|
28
+ filter.notes |= [:params] if controller.class.name =~ /Profile/ && controller.action_name == 'edit'
29
+ end
30
+ end
31
+ ```
29
32
 
30
- === Editor links
33
+ ### Editor links
31
34
 
32
- Textmate, MacVim and Sublime Text 3 are compatible.
35
+ By default, files are linked to open in TextMate, but you can use any editor with a URL scheme. Here are some examples for other editors:
33
36
 
34
- *MacVim*
37
+ **MacVim**
35
38
 
36
- In the rails-footnotes initializer do :
39
+ In `config/initializers/rails-footnotes.rb` do:
37
40
 
38
41
  f.prefix = 'mvim://open?url=file://%s&line=%d&column=%d'
39
42
 
@@ -44,26 +47,26 @@ the second %d is replaced by the column number.
44
47
  Take note that the order in which the file name (%s), line number (%d) and column number (%d) appears is important.
45
48
  We assume that they appear in that order. "foo://line=%d&file=%s" (%d precedes %s) would throw out an error.
46
49
 
47
- *Sublime* *Text* *3*
50
+ **Sublime Text 3**
48
51
 
49
- Install {subl}[https://github.com/dhoulb/subl], then use:
52
+ Install [subl](https://github.com/dhoulb/subl), then use:
50
53
 
51
54
  f.prefix = 'subl://open?url=file://%s&line=%d&column=%d'
52
55
 
53
- *Use* *with* *Vagrant* (*and* *other* *virtual* *machines*)
56
+ **Use with Docker, Vagrant, or other virtual machines**
54
57
 
55
- 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.
58
+ If you're running your app in a container or VM, you'll find that the edit links won't work because the paths point to the VM directory and not your native directory. To solve this, you can use a lambda for the prefix and modify the pathname accordingly.
56
59
 
57
60
  For example,
58
61
 
59
62
  f.prefix = ->(*args) do
60
- filename = args[0].sub '/vagrant', '/Users/jamie/projects/myproject'
63
+ filename = args[0].sub '/docker', '/Users/name/projects/myproject'
61
64
  "subl://open?url=file://#{filename}&line=#{args[1]}&column=#{args[2]}"
62
65
  end
63
66
 
64
- replaces the vm directory /vagrant with OS X directory where the code is being edited.
67
+ replaces the VM directory /docker with the macOS directory containing the source code.
65
68
 
66
- *Footnotes* *Display* *Options*
69
+ **Footnotes Display Options**
67
70
 
68
71
  By default, footnotes are appended at the end of the page with default stylesheet. If you want
69
72
  to change their position, you can define a div with id "footnotes_holder" or define your own stylesheet
@@ -90,7 +93,7 @@ Finally, you can control which notes you want to show. The default are:
90
93
 
91
94
  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.
92
95
 
93
- == Creating your own notes
96
+ ### Creating your own notes
94
97
 
95
98
  Creating your notes to integrate with Footnotes is easy.
96
99
 
@@ -100,49 +103,52 @@ Creating your notes to integrate with Footnotes is easy.
100
103
 
101
104
  For example, to create a note that shows info about the user logged in your application you just have to do:
102
105
 
103
- module Footnotes
104
- module Notes
105
- class CurrentUserNote < AbstractNote
106
- # This method always receives a controller
107
- #
108
- def initialize(controller)
109
- @current_user = controller.instance_variable_get("@current_user")
110
- end
111
-
112
- # Returns the title that represents this note.
113
- #
114
- def title
115
- "Current user: #{@current_user.name}"
116
- end
117
-
118
- # This Note is only valid if we actually found an user
119
- # If it's not valid, it won't be displayed
120
- #
121
- def valid?
122
- @current_user
123
- end
124
-
125
- # The fieldset content
126
- #
127
- def content
128
- escape(@current_user.inspect)
106
+ module Footnotes
107
+ module Notes
108
+ class CurrentUserNote < AbstractNote
109
+ # This method always receives a controller
110
+ #
111
+ def initialize(controller)
112
+ @current_user = controller.instance_variable_get("@current_user")
113
+ end
114
+
115
+ # Returns the title that represents this note.
116
+ #
117
+ def title
118
+ "Current user: #{@current_user.name}"
119
+ end
120
+
121
+ # This Note is only valid if we actually found an user
122
+ # If it's not valid, it won't be displayed
123
+ #
124
+ def valid?
125
+ @current_user
126
+ end
127
+
128
+ # The fieldset content
129
+ #
130
+ def content
131
+ escape(@current_user.inspect)
132
+ end
129
133
  end
130
134
  end
131
135
  end
132
- end
133
136
 
134
137
  Then put in your environment, add in your initializer:
135
138
 
136
- f.notes += [:current_user]
139
+ f.notes += [:current_user]
137
140
 
138
- == Footnote position
141
+ ### Footnote position
139
142
 
140
- By default the notes will be showed at the bottom of your page (appended just before </body>).
143
+ By default the notes will be showed at the bottom of your page (appended just before `</body>`).
141
144
  If you'd like the footnote, to be at a different place (perhaps for aesthetical reasons) you can edit one of your views and add:
142
- <div id="footnotes_holder"></div>
145
+
146
+ <div id="footnotes_holder"></div>
147
+
143
148
  at an appropriate place, your notes will now appear inside div#footnotes_holder
144
149
 
145
- == Bugs and Feedback
150
+ ### Bugs and Feedback
146
151
 
147
152
  If you discover any bugs, please open an issue.
148
153
  If you just want to give some positive feedback or drop a line, that's fine too!
154
+
@@ -21,6 +21,9 @@ Footnotes.setup do |f|
21
21
  # Change font size :
22
22
  # f.font_size = '11px'
23
23
 
24
+ # Change default limit :
25
+ # f.default_limit = 25
26
+
24
27
  # Allow to open multiple notes :
25
28
  # f.multiple_notes = true
26
29
  end if defined?(Footnotes) && Footnotes.respond_to?(:setup)
@@ -1,26 +1,37 @@
1
1
  module Footnotes
2
2
  class Filter
3
- @@no_style = false
4
- @@multiple_notes = false
5
3
  @@klasses = []
6
- @@lock_top_right = false
7
- @@font_size = '11px'
8
-
9
- # Default link prefix is textmate
10
- @@prefix = 'txmt://open?url=file://%s&amp;line=%d&amp;column=%d'
11
-
12
- # Edit notes
13
- @@notes = [ :controller, :view, :layout, :partials, :stylesheets, :javascripts ]
14
- # Show notes
15
- @@notes += [ :assigns, :session, :cookies, :params, :filters, :routes, :env, :queries, :log]
16
4
 
5
+ # :default_limit => Default limit for ActiveRecord:Relation in assigns note
6
+ # :font_size => CSS font-size property
7
+ # :lock_top_right => Lock a btn to toggle notes to the top right of the browser
8
+ # :multiple_notes => Set to true if you want to open several notes at the same time
17
9
  # :no_style => If you don't want the style to be appended to your pages
18
- # :notes => Class variable that holds the notes to be processed
19
10
  # :prefix => Prefix appended to FootnotesLinks
20
- # :multiple_notes => Set to true if you want to open several notes at the same time
21
- # :lock_top_right => Lock a btn to toggle notes to the top right of the browser
22
- # :font_size => CSS font-size property
23
- cattr_accessor :no_style, :notes, :prefix, :multiple_notes, :lock_top_right, :font_size
11
+ # :notes => Class variable that holds the notes to be processed
12
+ thread_cattr_accessor :default_limit, default: 25
13
+ thread_cattr_accessor :font_size, default: '11px'
14
+ thread_cattr_accessor :lock_top_right, default: false
15
+ thread_cattr_accessor :multiple_notes, default: false
16
+ thread_cattr_accessor :no_style, default: false
17
+ thread_cattr_accessor :prefix, default: 'txmt://open?url=file://%s&amp;line=%d&amp;column=%d'
18
+ thread_cattr_accessor :notes, default: [
19
+ :assigns,
20
+ :controller,
21
+ :cookies,
22
+ :env,
23
+ :filters,
24
+ :javascripts,
25
+ :layout,
26
+ :log,
27
+ :params,
28
+ :partials,
29
+ :queries,
30
+ :routes,
31
+ :session,
32
+ :stylesheets,
33
+ :view
34
+ ]
24
35
 
25
36
  class << self
26
37
  include Footnotes::EachWithRescue
@@ -33,7 +44,7 @@ module Footnotes
33
44
  self.each_with_rescue(Footnotes.before_hooks) {|hook| hook.call(controller, self)}
34
45
 
35
46
  @@klasses = []
36
- self.each_with_rescue(@@notes.flatten) do |note|
47
+ self.each_with_rescue(notes.flatten) do |note|
37
48
  klass = "Footnotes::Notes::#{note.to_s.camelize}Note".constantize
38
49
  klass.start!(controller) if klass.respond_to?(:start!)
39
50
  @@klasses << klass
@@ -42,17 +53,17 @@ module Footnotes
42
53
 
43
54
  # If none argument is sent, simply return the prefix.
44
55
  # Otherwise, replace the args in the prefix.
45
- #
56
+ alias_method :read_prefix, :prefix
46
57
  def prefix(*args)
47
58
  if args.empty?
48
- @@prefix
59
+ read_prefix
49
60
  else
50
61
  args.map! { |arg| arg.to_s.split("/").map{|s| ERB::Util.url_encode(s) }.join("/") }
51
62
 
52
- if @@prefix.respond_to? :call
53
- @@prefix.call *args
63
+ if read_prefix.respond_to? :call
64
+ read_prefix.call(*args)
54
65
  else
55
- format(@@prefix, *args)
66
+ format(read_prefix, *args)
56
67
  end
57
68
  end
58
69
  end
@@ -65,7 +76,9 @@ module Footnotes
65
76
  @notes = []
66
77
 
67
78
  revert_pos(controller.response_body) do
68
- @body = controller.response.body
79
+ if controller.response.stream.respond_to?(:body)
80
+ @body = controller.response.body
81
+ end
69
82
  end
70
83
  end
71
84
 
@@ -93,7 +106,7 @@ module Footnotes
93
106
 
94
107
  def add_footnotes_without_validation!
95
108
  initialize_notes!
96
- insert_styles unless @@no_style
109
+ insert_styles unless no_style
97
110
  insert_footnotes
98
111
  end
99
112
 
@@ -147,7 +160,7 @@ module Footnotes
147
160
 
148
161
  def insert_styles
149
162
  #TODO More customizable(reset.css, from file etc.)
150
- if @@lock_top_right
163
+ if lock_top_right
151
164
  extra_styles = <<-STYLES
152
165
  #footnotes_debug {position: fixed; top: 0px; right: 0px; width: 100%; z-index: 10000; margin-top: 0;}
153
166
  #footnotes_debug #toggle_footnotes {position: absolute; right: 0; top: 0; background: #fff; border: 1px solid #ccc; color: #9b1b1b; font-size: 20px; text-align: center; padding: 8px; opacity: 0.9;}
@@ -163,7 +176,7 @@ module Footnotes
163
176
  insert_text :before, /<\/head>/i, <<-HTML
164
177
  <!-- Footnotes Style -->
165
178
  <style type="text/css">
166
- #footnotes_debug {font-size: #{@@font_size}; font-family: Consolas, monaco, monospace; font-weight: normal; margin: 2em 0 1em 0; text-align: center; color: #444; line-height: 16px; background: #fff;}
179
+ #footnotes_debug {font-size: #{font_size}; font-family: Consolas, monaco, monospace; font-weight: normal; margin: 2em 0 1em 0; text-align: center; color: #444; line-height: 16px; background: #fff;}
167
180
  #footnotes_debug th, #footnotes_debug td {color: #444; line-height: 18px;}
168
181
  #footnotes_debug a {color: #9b1b1b; font-weight: inherit; text-decoration: none; line-height: 18px;}
169
182
  #footnotes_debug table {text-align: left; width: 100%;}
@@ -188,7 +201,7 @@ module Footnotes
188
201
  # Fieldsets method should be called first
189
202
  content = fieldsets
190
203
  element_style = ''
191
- if @@lock_top_right
204
+ if lock_top_right
192
205
  element_style = 'style="display: none;"'
193
206
  end
194
207
  footnotes_html = <<-HTML
@@ -204,7 +217,7 @@ module Footnotes
204
217
  var Footnotes = function() {
205
218
 
206
219
  function hideAll(){
207
- #{close unless @@multiple_notes}
220
+ #{close unless multiple_notes}
208
221
  }
209
222
 
210
223
  function hideAllAndToggle(id) {