lexrupy-rails-footnotes 3.3.2 → 3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +28 -34
- data/Rakefile +5 -4
- data/lib/rails-footnotes/footnotes.rb +40 -17
- data/lib/rails-footnotes/notes/env_note.rb +1 -1
- data/lib/rails-footnotes/notes/layout_note.rb +6 -11
- data/lib/rails-footnotes/notes/queries_note.rb +3 -13
- data/lib/rails-footnotes/notes/view_note.rb +3 -7
- data/test/footnotes_test.rb +1 -1
- metadata +2 -2
data/README
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
Site: http://www.pagestacker.com/
|
3
|
-
Blog: http://josevalim.blogspot.com/
|
1
|
+
Rails Footnotes
|
4
2
|
License: MIT
|
5
|
-
Version: 3.
|
3
|
+
Version: 3.4
|
6
4
|
|
7
5
|
You can also read this README in pretty html at the GitHub project Wiki page
|
8
6
|
|
@@ -23,14 +21,11 @@ your backtrace lines.
|
|
23
21
|
Installation
|
24
22
|
------------
|
25
23
|
|
26
|
-
Install Rails Footnotes is very easy.
|
27
|
-
|
24
|
+
Install Rails Footnotes is very easy. If you are running on Rails 2.3 just run
|
25
|
+
the following:
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
Then install the gem:
|
32
|
-
|
33
|
-
sudo gem install josevalim-rails-footnotes
|
27
|
+
gem sources -a http://gems.github.com
|
28
|
+
sudo gem install josevalim-rails-footnotes
|
34
29
|
|
35
30
|
In RAILS_ROOT/config/environments/development.rb (yes, you want it only in development):
|
36
31
|
|
@@ -38,10 +33,18 @@ In RAILS_ROOT/config/environments/development.rb (yes, you want it only in devel
|
|
38
33
|
|
39
34
|
If you want it as plugin, just do:
|
40
35
|
|
36
|
+
script/plugin install git://github.com/josevalim/rails-footnotes.git
|
37
|
+
|
38
|
+
If you are running on Rails 2.2 or Rails 2.1 you should do:
|
39
|
+
|
41
40
|
cd myapp
|
42
41
|
git clone git://github.com/josevalim/rails-footnotes.git
|
43
|
-
|
42
|
+
cd vendor/plugins/rails-footnotes
|
43
|
+
git checkout VERSION_NUMBER
|
44
|
+
rm -rf ./.git
|
44
45
|
|
46
|
+
Where you should replace VERSION_NUMBER for "v3.3.2" for Rails 2.2 and "v3.2.2"
|
47
|
+
for Rails 2.1 (without the quotes).
|
45
48
|
|
46
49
|
Instalation for Linux
|
47
50
|
---------------------
|
@@ -55,15 +58,9 @@ If you installed as a plugin:
|
|
55
58
|
cd vendor/plugins/footnotes/
|
56
59
|
sh linux_install.sh
|
57
60
|
|
58
|
-
If you installed and configured as a gem:
|
61
|
+
If you installed and configured as a gem just run with your user (without sudo):
|
59
62
|
|
60
|
-
|
61
|
-
cd footnotes
|
62
|
-
gem unpack josevalim-rails-footnotes
|
63
|
-
cd josevalim-rails-footnotes-X.X.X/bin # where X.X.X is the current version
|
64
|
-
sh linux_install.sh
|
65
|
-
|
66
|
-
Note: your sudo password will be asked
|
63
|
+
rails-footnotes-linux-configure
|
67
64
|
|
68
65
|
After theese steps you should be able to click on links created by footnotes plugin and Gedit should open. If you use Firefox 3 or newer, first time you click on a link it will ask you a confirmation to open txmt url with the txmt_handler, click yes and it's all done.
|
69
66
|
|
@@ -104,20 +101,6 @@ Finally, you can control which notes you want to show. The default are:
|
|
104
101
|
Footnotes::Filter.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log, :general]
|
105
102
|
|
106
103
|
|
107
|
-
Early versions
|
108
|
-
--------------
|
109
|
-
|
110
|
-
If you are running on Rails 2.1.x, you should use Footnotes v3.2.2:
|
111
|
-
|
112
|
-
cd myapp
|
113
|
-
git clone git://github.com/josevalim/rails-footnotes.git
|
114
|
-
cd vendor/plugins/rails-footnotes
|
115
|
-
git checkout v3.2.2
|
116
|
-
rm -rf ./.git
|
117
|
-
|
118
|
-
If you are using earlier than 2.1, please upgrade your app. =)
|
119
|
-
|
120
|
-
|
121
104
|
Creating your own notes
|
122
105
|
-----------------------
|
123
106
|
|
@@ -167,6 +150,17 @@ Then put in your environment:
|
|
167
150
|
Footnotes::Filter.notes += [:current_user]
|
168
151
|
|
169
152
|
|
153
|
+
Bugs and Feedback
|
154
|
+
-----------------
|
155
|
+
|
156
|
+
If you discover any bugs, please send an e-mail to jose.valim@gmail.com
|
157
|
+
If you just want to give some positive feedback or drop a line, that's fine too! =)
|
158
|
+
|
159
|
+
Copyright (c) 2009 José Valim
|
160
|
+
http://www.pagestacker.com/
|
161
|
+
http://josevalim.blogspot.com/
|
162
|
+
|
163
|
+
|
170
164
|
Version 2.0
|
171
165
|
-----------
|
172
166
|
|
data/Rakefile
CHANGED
@@ -2,17 +2,18 @@ require 'rake'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/rdoctask'
|
4
4
|
|
5
|
-
desc '
|
5
|
+
desc 'Run tests for Footnotes.'
|
6
6
|
Rake::TestTask.new(:test) do |t|
|
7
7
|
t.pattern = 'test/**/*_test.rb'
|
8
8
|
t.verbose = true
|
9
9
|
end
|
10
10
|
|
11
|
-
desc 'Generate documentation for Footnotes
|
11
|
+
desc 'Generate documentation for Footnotes.'
|
12
12
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
13
13
|
rdoc.rdoc_dir = 'rdoc'
|
14
|
-
rdoc.title = '
|
14
|
+
rdoc.title = 'Footnotes'
|
15
15
|
rdoc.options << '--line-numbers' << '--inline-source'
|
16
16
|
rdoc.rdoc_files.include('README')
|
17
|
+
rdoc.rdoc_files.include('MIT-LICENSE')
|
17
18
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
18
|
-
end
|
19
|
+
end
|
@@ -113,7 +113,7 @@ module Footnotes
|
|
113
113
|
|
114
114
|
protected
|
115
115
|
def valid?
|
116
|
-
performed_render? &&
|
116
|
+
performed_render? && valid_format? && valid_content_type? && @body.is_a?(String) && !component_request? && !xhr?
|
117
117
|
end
|
118
118
|
|
119
119
|
def add_footnotes_without_validation!
|
@@ -133,10 +133,6 @@ module Footnotes
|
|
133
133
|
@controller.instance_variable_get(:@performed_render)
|
134
134
|
end
|
135
135
|
|
136
|
-
def first_render?
|
137
|
-
@template.instance_variable_get(:@_first_render)
|
138
|
-
end
|
139
|
-
|
140
136
|
def valid_format?
|
141
137
|
[:html,:rhtml,:xhtml,:rxhtml].include?(@template.template_format.to_sym)
|
142
138
|
end
|
@@ -187,16 +183,43 @@ module Footnotes
|
|
187
183
|
#{links}
|
188
184
|
#{content}
|
189
185
|
<script type="text/javascript">
|
190
|
-
function
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
186
|
+
var Footnotes = function() {
|
187
|
+
|
188
|
+
function hideAll(){
|
189
|
+
#{close unless @@multiple_notes}
|
190
|
+
}
|
191
|
+
|
192
|
+
function hideAllAndToggle(id) {
|
193
|
+
hideAll();
|
194
|
+
toggle(id)
|
195
|
+
}
|
196
|
+
|
197
|
+
function toggle(id){
|
198
|
+
var el = document.getElementById(id);
|
199
|
+
if (el.style.display == 'none') {
|
200
|
+
Footnotes.show(el);
|
201
|
+
} else {
|
202
|
+
Footnotes.hide(el);
|
203
|
+
}
|
204
|
+
|
205
|
+
location.href = '#footnotes_debug';
|
206
|
+
}
|
207
|
+
|
208
|
+
function show(element) {
|
209
|
+
element.style.display = 'block'
|
210
|
+
}
|
211
|
+
|
212
|
+
function hide(element) {
|
213
|
+
element.style.display = 'none'
|
214
|
+
}
|
215
|
+
|
216
|
+
return {
|
217
|
+
show: show,
|
218
|
+
hide: hide,
|
219
|
+
toggle: toggle,
|
220
|
+
hideAllAndToggle: hideAllAndToggle
|
221
|
+
}
|
222
|
+
}();
|
200
223
|
/* Additional Javascript */
|
201
224
|
#{@notes.map(&:javascript).compact.join("\n")}
|
202
225
|
</script>
|
@@ -266,7 +289,7 @@ module Footnotes
|
|
266
289
|
# Helper that creates the javascript code to close the note
|
267
290
|
#
|
268
291
|
def close_helper(note)
|
269
|
-
"document.getElementById('#{note.to_sym}_debug_info')
|
292
|
+
"Footnotes.hide(document.getElementById('#{note.to_sym}_debug_info'));\n"
|
270
293
|
end
|
271
294
|
|
272
295
|
# Helper that creates the link and javascript code when note is clicked
|
@@ -275,7 +298,7 @@ module Footnotes
|
|
275
298
|
onclick = note.onclick
|
276
299
|
unless href = note.link
|
277
300
|
href = '#'
|
278
|
-
onclick ||= "
|
301
|
+
onclick ||= "Footnotes.hideAllAndToggle('#{note.to_sym}_debug_info');return false;" if note.has_fieldset?
|
279
302
|
end
|
280
303
|
|
281
304
|
"<a href=\"#{href}\" onclick=\"#{onclick}\">#{note.title}</a>"
|
@@ -9,7 +9,7 @@ module Footnotes
|
|
9
9
|
|
10
10
|
def content
|
11
11
|
# Replace HTTP_COOKIE for a link
|
12
|
-
@env['HTTP_COOKIE'] = '<a href="#" style="color:#009" onclick="
|
12
|
+
@env['HTTP_COOKIE'] = '<a href="#" style="color:#009" onclick="Footnotes.hideAllAndToggle(\'cookies_debug_info\');return false;">See cookies on its tab</a>'
|
13
13
|
|
14
14
|
# Create the env table
|
15
15
|
mount_table(@env.to_a.sort.unshift([:key, :value]))
|
@@ -1,11 +1,10 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/
|
1
|
+
require "#{File.dirname(__FILE__)}/abstract_note"
|
2
2
|
|
3
3
|
module Footnotes
|
4
4
|
module Notes
|
5
5
|
class LayoutNote < AbstractNote
|
6
6
|
def initialize(controller)
|
7
7
|
@controller = controller
|
8
|
-
@template = controller.instance_variable_get('@template')
|
9
8
|
end
|
10
9
|
|
11
10
|
def row
|
@@ -13,21 +12,17 @@ module Footnotes
|
|
13
12
|
end
|
14
13
|
|
15
14
|
def link
|
16
|
-
escape(Footnotes::Filter.prefix(
|
15
|
+
escape(Footnotes::Filter.prefix(filename, 1, 1))
|
17
16
|
end
|
18
17
|
|
19
18
|
def valid?
|
20
|
-
prefix? && @controller.active_layout
|
19
|
+
prefix? && @controller.active_layout
|
21
20
|
end
|
22
21
|
|
23
22
|
protected
|
24
|
-
def
|
25
|
-
@
|
26
|
-
end
|
27
|
-
|
28
|
-
def layout_filename
|
29
|
-
layout_template.filename
|
23
|
+
def filename
|
24
|
+
@controller.active_layout.filename
|
30
25
|
end
|
31
26
|
end
|
32
27
|
end
|
33
|
-
end
|
28
|
+
end
|
@@ -27,23 +27,13 @@ module Footnotes
|
|
27
27
|
STYLESHEET
|
28
28
|
end
|
29
29
|
|
30
|
-
def javascript
|
31
|
-
<<-JAVASCRIPT
|
32
|
-
function queries_toogle(type, id){
|
33
|
-
s = document.getElementById('q'+type+'_'+id).style
|
34
|
-
s.display = (s.display != 'block') ? 'block' : 'none'
|
35
|
-
location.href = '#qtitle_'+id
|
36
|
-
}
|
37
|
-
JAVASCRIPT
|
38
|
-
end
|
39
|
-
|
40
30
|
def content
|
41
31
|
html = ''
|
42
32
|
|
43
33
|
@@sql.each_with_index do |item, i|
|
44
34
|
sql_links = []
|
45
|
-
sql_links << "<a href=\"#\" style=\"color:#A00;\" onclick=\"
|
46
|
-
sql_links << "<a href=\"#\" style=\"color:#00A;\" onclick=\"
|
35
|
+
sql_links << "<a href=\"#\" style=\"color:#A00;\" onclick=\"Footnotes.toggle('qtable_#{i}');return false\">explain</a>" if item.explain
|
36
|
+
sql_links << "<a href=\"#\" style=\"color:#00A;\" onclick=\"Footnotes.toggle('qtrace_#{i}');return false\">trace</a>" if item.trace
|
47
37
|
|
48
38
|
html << <<-HTML
|
49
39
|
<b id="qtitle_#{i}">#{escape(item.type.to_s.upcase)}</b> (#{sql_links.join(' | ')})<br />
|
@@ -153,4 +143,4 @@ if Footnotes::Notes::QueriesNote.included?
|
|
153
143
|
next if adapter =~ /SQLite.Adapter$/
|
154
144
|
eval("ActiveRecord::ConnectionAdapters::#{adapter}").send :include, Footnotes::Extensions::QueryAnalyzer
|
155
145
|
end
|
156
|
-
end
|
146
|
+
end
|
@@ -17,17 +17,13 @@ module Footnotes
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def valid?
|
20
|
-
prefix? &&
|
20
|
+
prefix? && @template && @template.template
|
21
21
|
end
|
22
22
|
|
23
23
|
protected
|
24
|
-
def first_render?
|
25
|
-
@template.instance_variable_get(:@_first_render)
|
26
|
-
end
|
27
|
-
|
28
24
|
def filename
|
29
|
-
@
|
25
|
+
@template.template.filename
|
30
26
|
end
|
31
27
|
end
|
32
28
|
end
|
33
|
-
end
|
29
|
+
end
|
data/test/footnotes_test.rb
CHANGED
@@ -124,7 +124,7 @@ class FootnotesTest < Test::Unit::TestCase
|
|
124
124
|
def test_links_helper_has_fieldset?
|
125
125
|
note = Footnotes::Notes::TestNote.new
|
126
126
|
note.expects(:has_fieldset?).times(1).returns(true)
|
127
|
-
assert_equal '<a href="#" onclick="
|
127
|
+
assert_equal '<a href="#" onclick="Footnotes.hideAllAndToggle(\'test_debug_info\');return false;">Test</a>', @footnotes.send(:link_helper, note)
|
128
128
|
end
|
129
129
|
|
130
130
|
def test_links_helper_onclick
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lexrupy-rails-footnotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: "3.4"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jos\xC3\xA9 Valim"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-02-04 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|