rails6-footnotes 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +25 -0
- data/.gitignore +15 -0
- data/.rspec.example +1 -0
- data/CHANGELOG +129 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +187 -0
- data/MIT-LICENSE +21 -0
- data/README.rdoc +188 -0
- data/Rakefile +18 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/gemfiles/Gemfile.rails-3.2.22 +5 -0
- data/gemfiles/Gemfile.rails-4.0.x +6 -0
- data/gemfiles/Gemfile.rails-4.1.x +5 -0
- data/gemfiles/Gemfile.rails-4.2.x +5 -0
- data/gemfiles/Gemfile.rails-edge +5 -0
- data/lib/generators/rails_footnotes/install_generator.rb +14 -0
- data/lib/generators/templates/rails_footnotes.rb +26 -0
- data/lib/rails-footnotes.rb +68 -0
- data/lib/rails-footnotes/abstract_note.rb +178 -0
- data/lib/rails-footnotes/each_with_rescue.rb +36 -0
- data/lib/rails-footnotes/extension.rb +24 -0
- data/lib/rails-footnotes/filter.rb +359 -0
- data/lib/rails-footnotes/notes/all.rb +1 -0
- data/lib/rails-footnotes/notes/assigns_note.rb +60 -0
- data/lib/rails-footnotes/notes/controller_note.rb +55 -0
- data/lib/rails-footnotes/notes/cookies_note.rb +17 -0
- data/lib/rails-footnotes/notes/env_note.rb +24 -0
- data/lib/rails-footnotes/notes/files_note.rb +49 -0
- data/lib/rails-footnotes/notes/filters_note.rb +51 -0
- data/lib/rails-footnotes/notes/javascripts_note.rb +16 -0
- data/lib/rails-footnotes/notes/layout_note.rb +26 -0
- data/lib/rails-footnotes/notes/log_note.rb +47 -0
- data/lib/rails-footnotes/notes/log_note/note_logger.rb +59 -0
- data/lib/rails-footnotes/notes/params_note.rb +21 -0
- data/lib/rails-footnotes/notes/partials_note.rb +38 -0
- data/lib/rails-footnotes/notes/queries_note.rb +121 -0
- data/lib/rails-footnotes/notes/routes_note.rb +60 -0
- data/lib/rails-footnotes/notes/session_note.rb +27 -0
- data/lib/rails-footnotes/notes/stylesheets_note.rb +16 -0
- data/lib/rails-footnotes/notes/view_note.rb +41 -0
- data/lib/rails-footnotes/version.rb +3 -0
- data/lib/rails6-footnotes.rb +1 -0
- data/rails-footnotes.gemspec +22 -0
- data/spec/abstract_note_spec.rb +89 -0
- data/spec/app/assets/config/manifest.js +2 -0
- data/spec/app/assets/javascripts/foobar.js +1 -0
- data/spec/app/assets/stylesheets/foobar.css +0 -0
- data/spec/app/views/files/index.html.erb +1 -0
- data/spec/app/views/layouts/application.html.erb +12 -0
- data/spec/app/views/partials/_foo.html.erb +1 -0
- data/spec/app/views/partials/index.html.erb +1 -0
- data/spec/controllers/files_note_controller_spec.rb +38 -0
- data/spec/controllers/footnotes_controller_spec.rb +128 -0
- data/spec/controllers/log_note_controller_spec.rb +32 -0
- data/spec/controllers/partials_note_controller_spec.rb +28 -0
- data/spec/env_note_spec.rb +73 -0
- data/spec/fixtures/html_download.html +5 -0
- data/spec/footnotes_spec.rb +234 -0
- data/spec/notes/assigns_note_spec.rb +50 -0
- data/spec/notes/controller_note_spec.rb +12 -0
- data/spec/notes/files_note_spec.rb +26 -0
- data/spec/notes/javascripts_note_spec.rb +18 -0
- data/spec/notes/stylesheets_note_spec.rb +19 -0
- data/spec/notes/view_note_spec.rb +12 -0
- data/spec/spec_helper.rb +68 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4cf3f2077c5570d6fc08f382591a4fd040dc62dd347a60929cf0064da1ce61c4
|
4
|
+
data.tar.gz: '0289cdc75a52af389ec658fc3073fb8c4a6112277297e24568ca29c1b9ccfc38'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bfbf16034f96a3ccb75212285d971b7eb0080440bd5029492bef9fb03f83ea8ac34deadb92052af7b6a6adbd5138576cb1c223f0b321551203958c8639d3d18d
|
7
|
+
data.tar.gz: 0e4e15e81e5c89169f21b65d1c2dba0ca89992b2b9d7ac01cd77db591e2939a6cefb417b4ebc3a573d4b7e8a0630e2b17f19a04017b03f62732fbab7489f0203
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: ['3.0']
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
24
|
+
- name: Run tests
|
25
|
+
run: bin/rspec
|
data/.gitignore
ADDED
data/.rspec.example
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/CHANGELOG
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
== Footnotes v4.1.8 ==
|
2
|
+
* Fix the issue of undefined method using Log4r and Rails 3.2
|
3
|
+
* Fix some rails 5 compatibility issues (#140) *
|
4
|
+
* Fix bad timing shown in SQL note (#145) *
|
5
|
+
== Footnotes v4.1.7 ==
|
6
|
+
* Fix notes not collapsing when clicking on them again (#130)*
|
7
|
+
== Footnotes v4.1.6 ==
|
8
|
+
* Fix incorrect handler link to css/js files (#127)*
|
9
|
+
== Footnotes v4.1.5 ==
|
10
|
+
* Remove use of non-existing note in initializer introduced in v4, impacting new installations *
|
11
|
+
== Footnotes v4.1.4 ==
|
12
|
+
* Allow to click on links if filenames contain special chars
|
13
|
+
== Footnotes v4.1.3 ==
|
14
|
+
* Improve fix done in 4.1.2 that broke support with rails 3 (thanks kirikiriyamama)
|
15
|
+
== Footnotes v4.1.2 ==
|
16
|
+
* Fix errors when some log formatters return nil
|
17
|
+
== Footnotes v4.1.1 ==
|
18
|
+
* Fix uninitialized constant with Log4r and probably other libraries using the Logger module ( Thanks Brian Tatnall )
|
19
|
+
== Footnotes v4.1.0 ==
|
20
|
+
* Allow footnotes url prefix to be a lambda ( Thanks Jamie Lawrence )
|
21
|
+
* Sexier assigns note ( Thanks Joshua Paling )
|
22
|
+
* Fix issues with environment keys not being the same type causing some gems to break ( Thanks Austin Ziegler )
|
23
|
+
|
24
|
+
== Footnotes v4.0.2
|
25
|
+
* Fix bad display of footnotes table
|
26
|
+
* Fix error with the queries note under Rails 4.1.2 (thanks Panayotis Matsinopoulos)
|
27
|
+
== Footnotes v4.0.1
|
28
|
+
* Fix bad count for log note
|
29
|
+
* More robust initializer (thanks kayhide)
|
30
|
+
* Ability to lock the notes on the top right instead of the footer (thanks joshuapaling)
|
31
|
+
* More readable notes (thanks joshuapaling)
|
32
|
+
== Footnotes v4.0.0
|
33
|
+
* Drop support for ruby 1.8
|
34
|
+
* Drop support for rails < 3.2
|
35
|
+
* Add support for rails 4.x
|
36
|
+
* Rewrite of the log note to make it work on all supported rails versions
|
37
|
+
* Rewrite of the partials note to make it work on all supported rails versions
|
38
|
+
* Rewrite of the loading mechanism, allowing to load conditionally footnotes on a per-request basis if wanted
|
39
|
+
* Deprecate Footnotes.run!
|
40
|
+
* Remove backtrace cleaner monkey patchs
|
41
|
+
* Remove support of .rails_footnotes file
|
42
|
+
* New initializer format with ability to configure footnotes more easily
|
43
|
+
* Remove 'general' note
|
44
|
+
|
45
|
+
== Footnotes v3.7.0
|
46
|
+
* Migrate to Bundler
|
47
|
+
* Support only Rails3
|
48
|
+
|
49
|
+
== Footnotes v3.6.7
|
50
|
+
* fixed log_note error - long overdue (thanks to many including Moritz Heidkamp)
|
51
|
+
* 1.9: ignore more assigns (thanks to justin case)
|
52
|
+
* 1.9 fixed test mocking (thanks to lsylvester)
|
53
|
+
* sort notes includes (thanks Alexey Smolianiov)
|
54
|
+
* handle controller paths in gems / others (thanks ubilabs)
|
55
|
+
* more graceful fallback when controller not found
|
56
|
+
* fixes for table entries being double encoded
|
57
|
+
* moved rpm exclude sql explain logic to config option
|
58
|
+
|
59
|
+
== Footnotes v3.6.6
|
60
|
+
* fix for ruby 1.9 compat (thanks to ivanoats)
|
61
|
+
* fix for log note (thanks to tobias)
|
62
|
+
* pre rails 2.3 support fixes (thanks to tobias)
|
63
|
+
* better disabling of query notes (thanks to tobias)
|
64
|
+
* fixed variable assignment escaping (thanks to gdelvino)
|
65
|
+
* fixed cookie value escaping (thanks to indirect)
|
66
|
+
* Turn off footnotes with a parameter footnotes=false (thanks to indirect)
|
67
|
+
|
68
|
+
== Footnotes v3.6
|
69
|
+
* Cookies, sessions and params notes now use table;
|
70
|
+
* Old components note removed;
|
71
|
+
* Added assigns notes (thanks to scorpio);
|
72
|
+
* Improve query note, count query time and display it with several configurable
|
73
|
+
options (:alert_db_time and :alert_sql_number) (thanks to scorpio);
|
74
|
+
* Fixed bugs of layout link and route note related (thanks to scorpio).
|
75
|
+
|
76
|
+
== Footnotes v3.5
|
77
|
+
* Added NewRelic RPM footnote (thanks to kbrock);
|
78
|
+
* Several bug fixes (thanks to kbrock, ivanoats and kristopher).
|
79
|
+
|
80
|
+
== Footnotes v3.4
|
81
|
+
* Rails 2.3 compatible.
|
82
|
+
|
83
|
+
== Footnotes v3.3.1
|
84
|
+
* Changed prefix to support %s and %d;
|
85
|
+
* Created gemspec;
|
86
|
+
* Some code refactoring (called eval just once instead of three times).
|
87
|
+
|
88
|
+
== Footnotes v3.3
|
89
|
+
* Rails Edge (aka 2.2) compatibility;
|
90
|
+
* Initial Ruby 1.9 compatibility.
|
91
|
+
|
92
|
+
== Footnotes v3.2.2
|
93
|
+
* Added trace to QueriesNote;
|
94
|
+
* Fixed incompatibility with Ultrasphinx (thanks to mhartl);
|
95
|
+
* Added W3C compatibility (thanks to tapajos);
|
96
|
+
* Added support to other log mechanisms in LogNote.
|
97
|
+
|
98
|
+
== Footnotes v3.2.1
|
99
|
+
* Added some tests;
|
100
|
+
* Redefined Footnotes CSS and Javascripts to use concise names.
|
101
|
+
|
102
|
+
== Footnotes v3.2
|
103
|
+
* Now you can easily add your own notes;
|
104
|
+
* Added numbers to tabs;
|
105
|
+
* Added Queries note;
|
106
|
+
* Added MySQL Query Analyzer.
|
107
|
+
|
108
|
+
== Footnotes v3.1
|
109
|
+
* Code refactoring (using modules, except backtracer);
|
110
|
+
* Ability to cherry pick notes;
|
111
|
+
* Working on Rails 2.1.
|
112
|
+
|
113
|
+
== Footnotes v3.0
|
114
|
+
* Some code refactoring;
|
115
|
+
* Stylesheets bug fixed: was showing not only css in Stylesheets div;
|
116
|
+
* Logtail fix: working with Rails 2.0 logger and in all OS, since it's Regexp based;
|
117
|
+
* Rails 1.2 (except backtrace) and 2.0 compatible;
|
118
|
+
* RoutingNavigator (based on Rick Olson plugin);
|
119
|
+
* FilterChain.
|
120
|
+
|
121
|
+
== Textmate Footnotes v2.0
|
122
|
+
Copyright (c) 2006 InquiryLabs, Inc.
|
123
|
+
http://inquirylabs.com/
|
124
|
+
|
125
|
+
Description:
|
126
|
+
Creates clickable footnotes on each rendered page, as well as clickable
|
127
|
+
links in the backtrace should an error occur in your Rails app. Links take
|
128
|
+
you to the right place inside TextMate.
|
129
|
+
Enable only the TextMate on Macs in development mode
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rails6-footnotes (5.0.0)
|
5
|
+
rails (~> 6.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (6.1.4)
|
11
|
+
actionpack (= 6.1.4)
|
12
|
+
activesupport (= 6.1.4)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (6.1.4)
|
16
|
+
actionpack (= 6.1.4)
|
17
|
+
activejob (= 6.1.4)
|
18
|
+
activerecord (= 6.1.4)
|
19
|
+
activestorage (= 6.1.4)
|
20
|
+
activesupport (= 6.1.4)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.1.4)
|
23
|
+
actionpack (= 6.1.4)
|
24
|
+
actionview (= 6.1.4)
|
25
|
+
activejob (= 6.1.4)
|
26
|
+
activesupport (= 6.1.4)
|
27
|
+
mail (~> 2.5, >= 2.5.4)
|
28
|
+
rails-dom-testing (~> 2.0)
|
29
|
+
actionpack (6.1.4)
|
30
|
+
actionview (= 6.1.4)
|
31
|
+
activesupport (= 6.1.4)
|
32
|
+
rack (~> 2.0, >= 2.0.9)
|
33
|
+
rack-test (>= 0.6.3)
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
+
actiontext (6.1.4)
|
37
|
+
actionpack (= 6.1.4)
|
38
|
+
activerecord (= 6.1.4)
|
39
|
+
activestorage (= 6.1.4)
|
40
|
+
activesupport (= 6.1.4)
|
41
|
+
nokogiri (>= 1.8.5)
|
42
|
+
actionview (6.1.4)
|
43
|
+
activesupport (= 6.1.4)
|
44
|
+
builder (~> 3.1)
|
45
|
+
erubi (~> 1.4)
|
46
|
+
rails-dom-testing (~> 2.0)
|
47
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
+
activejob (6.1.4)
|
49
|
+
activesupport (= 6.1.4)
|
50
|
+
globalid (>= 0.3.6)
|
51
|
+
activemodel (6.1.4)
|
52
|
+
activesupport (= 6.1.4)
|
53
|
+
activerecord (6.1.4)
|
54
|
+
activemodel (= 6.1.4)
|
55
|
+
activesupport (= 6.1.4)
|
56
|
+
activestorage (6.1.4)
|
57
|
+
actionpack (= 6.1.4)
|
58
|
+
activejob (= 6.1.4)
|
59
|
+
activerecord (= 6.1.4)
|
60
|
+
activesupport (= 6.1.4)
|
61
|
+
marcel (~> 1.0.0)
|
62
|
+
mini_mime (>= 1.1.0)
|
63
|
+
activesupport (6.1.4)
|
64
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
|
+
i18n (>= 1.6, < 2)
|
66
|
+
minitest (>= 5.1)
|
67
|
+
tzinfo (~> 2.0)
|
68
|
+
zeitwerk (~> 2.3)
|
69
|
+
addressable (2.8.0)
|
70
|
+
public_suffix (>= 2.0.2, < 5.0)
|
71
|
+
builder (3.2.4)
|
72
|
+
capybara (3.35.3)
|
73
|
+
addressable
|
74
|
+
mini_mime (>= 0.1.3)
|
75
|
+
nokogiri (~> 1.8)
|
76
|
+
rack (>= 1.6.0)
|
77
|
+
rack-test (>= 0.6.3)
|
78
|
+
regexp_parser (>= 1.5, < 3.0)
|
79
|
+
xpath (~> 3.2)
|
80
|
+
coderay (1.1.3)
|
81
|
+
concurrent-ruby (1.1.9)
|
82
|
+
crass (1.0.6)
|
83
|
+
diff-lcs (1.4.4)
|
84
|
+
erubi (1.10.0)
|
85
|
+
globalid (0.5.2)
|
86
|
+
activesupport (>= 5.0)
|
87
|
+
i18n (1.8.10)
|
88
|
+
concurrent-ruby (~> 1.0)
|
89
|
+
loofah (2.12.0)
|
90
|
+
crass (~> 1.0.2)
|
91
|
+
nokogiri (>= 1.5.9)
|
92
|
+
mail (2.7.1)
|
93
|
+
mini_mime (>= 0.1.1)
|
94
|
+
marcel (1.0.1)
|
95
|
+
method_source (1.0.0)
|
96
|
+
mini_mime (1.1.0)
|
97
|
+
minitest (5.14.4)
|
98
|
+
nio4r (2.5.8)
|
99
|
+
nokogiri (1.12.3-arm64-darwin)
|
100
|
+
racc (~> 1.4)
|
101
|
+
nokogiri (1.12.3-x86_64-linux)
|
102
|
+
racc (~> 1.4)
|
103
|
+
pry (0.14.1)
|
104
|
+
coderay (~> 1.1)
|
105
|
+
method_source (~> 1.0)
|
106
|
+
public_suffix (4.0.6)
|
107
|
+
racc (1.5.2)
|
108
|
+
rack (2.2.3)
|
109
|
+
rack-test (1.1.0)
|
110
|
+
rack (>= 1.0, < 3)
|
111
|
+
rails (6.1.4)
|
112
|
+
actioncable (= 6.1.4)
|
113
|
+
actionmailbox (= 6.1.4)
|
114
|
+
actionmailer (= 6.1.4)
|
115
|
+
actionpack (= 6.1.4)
|
116
|
+
actiontext (= 6.1.4)
|
117
|
+
actionview (= 6.1.4)
|
118
|
+
activejob (= 6.1.4)
|
119
|
+
activemodel (= 6.1.4)
|
120
|
+
activerecord (= 6.1.4)
|
121
|
+
activestorage (= 6.1.4)
|
122
|
+
activesupport (= 6.1.4)
|
123
|
+
bundler (>= 1.15.0)
|
124
|
+
railties (= 6.1.4)
|
125
|
+
sprockets-rails (>= 2.0.0)
|
126
|
+
rails-dom-testing (2.0.3)
|
127
|
+
activesupport (>= 4.2.0)
|
128
|
+
nokogiri (>= 1.6)
|
129
|
+
rails-html-sanitizer (1.4.1)
|
130
|
+
loofah (~> 2.3)
|
131
|
+
railties (6.1.4)
|
132
|
+
actionpack (= 6.1.4)
|
133
|
+
activesupport (= 6.1.4)
|
134
|
+
method_source
|
135
|
+
rake (>= 0.13)
|
136
|
+
thor (~> 1.0)
|
137
|
+
rake (13.0.6)
|
138
|
+
regexp_parser (2.1.1)
|
139
|
+
rspec-core (3.10.1)
|
140
|
+
rspec-support (~> 3.10.0)
|
141
|
+
rspec-expectations (3.10.1)
|
142
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
143
|
+
rspec-support (~> 3.10.0)
|
144
|
+
rspec-mocks (3.10.2)
|
145
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
146
|
+
rspec-support (~> 3.10.0)
|
147
|
+
rspec-rails (5.0.2)
|
148
|
+
actionpack (>= 5.2)
|
149
|
+
activesupport (>= 5.2)
|
150
|
+
railties (>= 5.2)
|
151
|
+
rspec-core (~> 3.10)
|
152
|
+
rspec-expectations (~> 3.10)
|
153
|
+
rspec-mocks (~> 3.10)
|
154
|
+
rspec-support (~> 3.10)
|
155
|
+
rspec-support (3.10.2)
|
156
|
+
sprockets (4.0.2)
|
157
|
+
concurrent-ruby (~> 1.0)
|
158
|
+
rack (> 1, < 3)
|
159
|
+
sprockets-rails (3.2.2)
|
160
|
+
actionpack (>= 4.0)
|
161
|
+
activesupport (>= 4.0)
|
162
|
+
sprockets (>= 3.0.0)
|
163
|
+
thor (1.1.0)
|
164
|
+
tzinfo (2.0.4)
|
165
|
+
concurrent-ruby (~> 1.0)
|
166
|
+
websocket-driver (0.7.5)
|
167
|
+
websocket-extensions (>= 0.1.0)
|
168
|
+
websocket-extensions (0.1.5)
|
169
|
+
xpath (3.2.0)
|
170
|
+
nokogiri (~> 1.8)
|
171
|
+
zeitwerk (2.4.2)
|
172
|
+
|
173
|
+
PLATFORMS
|
174
|
+
arm64-darwin-20
|
175
|
+
x86_64-linux
|
176
|
+
|
177
|
+
DEPENDENCIES
|
178
|
+
capybara (~> 3.35)
|
179
|
+
nokogiri (~> 1.12)
|
180
|
+
pry (~> 0.14.1)
|
181
|
+
rails6-footnotes!
|
182
|
+
rake (~> 13.0)
|
183
|
+
rspec-rails (~> 5.0)
|
184
|
+
sprockets-rails (~> 3.2)
|
185
|
+
|
186
|
+
BUNDLED WITH
|
187
|
+
2.2.23
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2006 Coda Hale
|
2
|
+
Copyright (c) 2008 José Valim (jose.valim at gmail dot com)
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
= Rails Footnotes
|
2
|
+
|
3
|
+
{<img src="https://travis-ci.org/Intrepidd/rails-footnotes.svg?branch=master" />}[https://travis-ci.org/Intrepidd/rails-footnotes]
|
4
|
+
|
5
|
+
Rails footnotes displays footnotes in your application for easy debugging, such as sessions,
|
6
|
+
request parameters, cookies, filter chain, routes, queries, etc.
|
7
|
+
|
8
|
+
Even more, it contains links to open files directly in your editor including
|
9
|
+
your backtrace lines.
|
10
|
+
|
11
|
+
== Installation
|
12
|
+
|
13
|
+
NOTE: Since this branch aims for Rails 3.2+ support, if you want to use footnotes with Rails 2.3 you should use this branch:
|
14
|
+
|
15
|
+
https://github.com/josevalim/rails-footnotes/tree/rails2
|
16
|
+
|
17
|
+
Installing Rails Footnotes is very easy.
|
18
|
+
|
19
|
+
=== Rails 3.2.x/4.x
|
20
|
+
|
21
|
+
gem 'rails-footnotes', '~> 4.0'
|
22
|
+
|
23
|
+
After you install RailsFootnotes and add it to your Gemfile, you need to run the generator:
|
24
|
+
|
25
|
+
rails generate rails_footnotes:install
|
26
|
+
|
27
|
+
This will create an initializer with default config and some examples.
|
28
|
+
|
29
|
+
=== Hooks
|
30
|
+
|
31
|
+
Footnotes.setup do |config|
|
32
|
+
config.before {|controller, filter| filter.notes = controller.class.name =~ /Message/ && \
|
33
|
+
controller.action_name == 'index' ? [:assigns] : []}
|
34
|
+
config.before {|controller, filter| filter.notes |= [:params] if controller.class.name =~ /Profile/ && \
|
35
|
+
controller.action_name == 'edit' }
|
36
|
+
end
|
37
|
+
|
38
|
+
=== Editor links
|
39
|
+
|
40
|
+
Textmate, MacVim and Sublime Text 3 are compatible.
|
41
|
+
|
42
|
+
*MacVim*
|
43
|
+
|
44
|
+
In the rails-footnotes initializer do :
|
45
|
+
|
46
|
+
f.prefix = 'mvim://open?url=file://%s&line=%d&column=%d'
|
47
|
+
|
48
|
+
Here you need to choose a prefix compatible with your text editor. The %s is
|
49
|
+
replaced by the name of the file, the first %d is replaced by the line number and
|
50
|
+
the second %d is replaced by the column number.
|
51
|
+
|
52
|
+
Take note that the order in which the file name (%s), line number (%d) and column number (%d) appears is important.
|
53
|
+
We assume that they appear in that order. "foo://line=%d&file=%s" (%d precedes %s) would throw out an error.
|
54
|
+
|
55
|
+
*Sublime* *Text* *3*
|
56
|
+
|
57
|
+
Install {subl}[https://github.com/dhoulb/subl], then use:
|
58
|
+
|
59
|
+
f.prefix = 'subl://open?url=file://%s&line=%d&column=%d'
|
60
|
+
|
61
|
+
*Use* *with* *Vagrant* (*and* *other* *virtual* *machines*)
|
62
|
+
|
63
|
+
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.
|
64
|
+
|
65
|
+
For example,
|
66
|
+
|
67
|
+
f.prefix = ->(*args) do
|
68
|
+
filename = args[0].sub '/vagrant', '/Users/jamie/projects/myproject'
|
69
|
+
"subl://open?url=file://#{filename}&line=#{args[1]}&column=#{args[2]}"
|
70
|
+
end
|
71
|
+
|
72
|
+
replaces the vm directory /vagrant with OS X directory where the code is being edited.
|
73
|
+
|
74
|
+
*Footnotes* *Display* *Options*
|
75
|
+
|
76
|
+
By default, footnotes are appended at the end of the page with default stylesheet. If you want
|
77
|
+
to change their position, you can define a div with id "footnotes_holder" or define your own stylesheet
|
78
|
+
by turning footnotes stylesheet off:
|
79
|
+
|
80
|
+
f.no_style = true
|
81
|
+
|
82
|
+
You can also lock the footnotes to the top of the window, hidden by default, and accessible
|
83
|
+
via a small button fixed to the top-right of your browser:
|
84
|
+
|
85
|
+
f.lock_top_right = true
|
86
|
+
|
87
|
+
To set the font-size for the footnotes:
|
88
|
+
|
89
|
+
f.font_size = '13px'
|
90
|
+
|
91
|
+
Another option is to allow multiple notes to be opened at the same time:
|
92
|
+
|
93
|
+
f.multiple_notes = true
|
94
|
+
|
95
|
+
Finally, you can control which notes you want to show. The default are:
|
96
|
+
|
97
|
+
f.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log]
|
98
|
+
|
99
|
+
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.
|
100
|
+
|
101
|
+
== Creating your own notes
|
102
|
+
|
103
|
+
Creating your notes to integrate with Footnotes is easy.
|
104
|
+
|
105
|
+
1. Create a Footnotes::Notes::YourExampleNote class
|
106
|
+
2. Implement the necessary methods (check abstract_note.rb[link:lib/rails-footnotes/abstract_note.rb] file in lib/rails-footnotes)
|
107
|
+
3. Append your example note in Footnotes::Filter.notes array (usually at the end of your environment file or in the initializer):
|
108
|
+
|
109
|
+
For example, to create a note that shows info about the user logged in your application you just have to do:
|
110
|
+
|
111
|
+
module Footnotes
|
112
|
+
module Notes
|
113
|
+
class CurrentUserNote < AbstractNote
|
114
|
+
# This method always receives a controller
|
115
|
+
#
|
116
|
+
def initialize(controller)
|
117
|
+
@current_user = controller.instance_variable_get("@current_user")
|
118
|
+
end
|
119
|
+
|
120
|
+
# Returns the title that represents this note.
|
121
|
+
#
|
122
|
+
def title
|
123
|
+
"Current user: #{@current_user.name}"
|
124
|
+
end
|
125
|
+
|
126
|
+
# This Note is only valid if we actually found an user
|
127
|
+
# If it's not valid, it won't be displayed
|
128
|
+
#
|
129
|
+
def valid?
|
130
|
+
@current_user
|
131
|
+
end
|
132
|
+
|
133
|
+
# The fieldset content
|
134
|
+
#
|
135
|
+
def content
|
136
|
+
escape(@current_user.inspect)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
Then put in your environment, add in your initializer:
|
143
|
+
|
144
|
+
f.notes += [:current_user]
|
145
|
+
|
146
|
+
== Footnote position
|
147
|
+
|
148
|
+
By default the notes will be showed at the bottom of your page (appended just before </body>).
|
149
|
+
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:
|
150
|
+
<div id="footnotes_holder"></div>
|
151
|
+
at an appropriate place, your notes will now appear inside div#footnotes_holder
|
152
|
+
|
153
|
+
== Collaborators
|
154
|
+
|
155
|
+
* Leon Li - http://github.com/scorpio
|
156
|
+
* Keenan Brock - http://github.com/kbrock
|
157
|
+
* Ivan Storck - http://github.com/ivanoats
|
158
|
+
* Kris Chamber - http://github.com/kristopher
|
159
|
+
* Roman V. Babenko - http://github.com/romanvbabenko
|
160
|
+
* Adrien Siami - http://github.com/intrepidd
|
161
|
+
|
162
|
+
== Bugs and Feedback
|
163
|
+
|
164
|
+
If you discover any bugs, please open an issue.
|
165
|
+
If you just want to give some positive feedback or drop a line, that's fine too!
|
166
|
+
|
167
|
+
=== Version 4.x
|
168
|
+
|
169
|
+
Starting from version 4.0, Adren Siami is the maintainer of this plugin.
|
170
|
+
|
171
|
+
=== Version 3.x
|
172
|
+
|
173
|
+
This plugin was maintained until version 4.0 by Roman V. Babenko
|
174
|
+
|
175
|
+
Copyright (c) 2010-2014 Roman V. Babenko (romanvbabenko@gmail.com)
|
176
|
+
http://romanvbabenko.com
|
177
|
+
|
178
|
+
This plugin was maintained until version 3.6 by José Valim
|
179
|
+
|
180
|
+
Copyright (c) 2009 José Valim (jose@plataformatec.com.br)
|
181
|
+
http://blog.plataformatec.com.br
|
182
|
+
|
183
|
+
=== Version 2.0
|
184
|
+
|
185
|
+
This plugin was created and maintained until version 2.0 by Duane Johnson:
|
186
|
+
|
187
|
+
Copyright (c) 2006 InquiryLabs, Inc.
|
188
|
+
http://blog.inquirylabs.com
|