drnic / rails-footnotes

Every Rails page has footnotes that link give request information and link back to your source via TextMate [extracted from Rails TextMate bundle project]

This URL has Read+Write access

rails-footnotes / README.markdown
71faa2b5 » josevalim 2008-12-29 Changed README. 1 New home
21486954 » josevalim 2008-12-29 Changed README markdown. 2 ========
71faa2b5 » josevalim 2008-12-29 Changed README. 3
4 This plugin has new home at [http://github.com/josevalim/rails-footnotes](http://github.com/josevalim/rails-footnotes) for Rails >~ 2.2
5
6 I'm waiting for your forks there. =)
7
d42fef4f » josevalim 2008-09-09 Added Rails Edge (aka 2.2) ... 8 Footnotes plugin for Rails (v3.3)
21486954 » josevalim 2008-12-29 Changed README markdown. 9 --------------------------------
0d51f519 » drnic 2008-05-11 Added README 10
11 If you are developing in Rails you should know the plugin!
12
13 It displays footnotes in your application for easy debugging, such as sessions, request parameters, cookies, log tail, filter chain and routes.
14
6446c1c5 » josevalim 2008-06-03 Added support to cherry pic... 15 Even more, it contains links to open files directly in textmate. And if Rails get an error, it appends Textmate links to backtrace file lines.
0d51f519 » drnic 2008-05-11 Added README 16
17 Installation
21486954 » josevalim 2008-12-29 Changed README markdown. 18 ------------
0d51f519 » drnic 2008-05-11 Added README 19
dd8bac5a » josevalim 2008-10-20 README fix! =) 20 The current version is only Rails Edge (aka Rails 2.2) compatible. Scroll down to check how to install early versions.
c5aafacd » josevalim 2008-05-21 Working on Rails 2.1 RC 21
0d51f519 » drnic 2008-05-11 Added README 22 If you just want a static copy of the plugin:
23
24 cd myapp
25 git clone git://github.com/drnic/rails-footnotes.git vendor/plugins/footnotes
26 rm -rf vendor/plugins/footnotes/.git
8261b476 » josevalim 2008-05-21 Fixed README 27
58e834a6 » josevalim 2008-06-05 Updated README 28 If you are using Git for your own app, then you could use Git sub-modules or the tool [Braid](http://github.com/evilchelu/braid/tree/master).
0d51f519 » drnic 2008-05-11 Added README 29
c5aafacd » josevalim 2008-05-21 Working on Rails 2.1 RC 30 Early versions
21486954 » josevalim 2008-12-29 Changed README markdown. 31 --------------
93292a67 » josevalim 2008-05-12 Footnotes v3.0 - Working in... Comment 32
dd8bac5a » josevalim 2008-10-20 README fix! =) 33 If you are running on Rails 2.1.x, you should use Footnotes v3.2.2:
d42fef4f » josevalim 2008-09-09 Added Rails Edge (aka 2.2) ... 34
35 cd myapp
36 git clone git://github.com/drnic/rails-footnotes.git vendor/plugins/footnotes
37 cd vendor/plugins/footnotes
38 git checkout v3.2.2
39 rm -rf ./.git
40
c5aafacd » josevalim 2008-05-21 Working on Rails 2.1 RC 41 If you are running on Rails 2.0.x or Rails 1.x, you should use Footnotes v3.0:
93292a67 » josevalim 2008-05-12 Footnotes v3.0 - Working in... Comment 42
c5aafacd » josevalim 2008-05-21 Working on Rails 2.1 RC 43 cd myapp
44 git clone git://github.com/drnic/rails-footnotes.git vendor/plugins/footnotes
45 cd vendor/plugins/footnotes
46 git checkout v3.0
47 rm -rf ./.git
93292a67 » josevalim 2008-05-12 Footnotes v3.0 - Working in... Comment 48
8261b476 » josevalim 2008-05-21 Fixed README 49 Remember that in Rails 1.x, after filters appear first than before filters in the Filters tab.
50
aeeb0b53 » josevalim 2008-06-08 Updated README 51 Usage
21486954 » josevalim 2008-12-29 Changed README markdown. 52 -----
6446c1c5 » josevalim 2008-06-03 Added support to cherry pic... 53
e293e8f7 » josevalim 2008-08-03 Changed 'initializer' to 'l... 54 * Footnotes are applied in all actions under development. If You want to change this behaviour, check the loader.rb file.
6446c1c5 » josevalim 2008-06-03 Added support to cherry pic... 55
aeeb0b53 » josevalim 2008-06-08 Updated README 56 * Some features only work by default if you are under MacOSX and using Textmate.
57 If your editor supports out-of-the-box opening files like Textmate, e.g. txmt://open?url=file://path/to/file, you can put in your environment file the following line:
0d51f519 » drnic 2008-05-11 Added README 58
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 59 Footnotes::Filter.prefix = "editor://open?file://"
60
aeeb0b53 » josevalim 2008-06-08 Updated README 61 If it doesn't, you can enable this behavior in few steps. I've written a post about it [here](http://josevalim.blogspot.com/2008/06/textmate-protocol-behavior-on-any.html).
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 62
63 * If you want to use your own stylesheet, you can disable the Footnotes stylesheet with:
64
65 Footnotes::Filter.no_style = true
66
f5568130 » josevalim 2008-06-06 Redefined Javascript and CS... 67 * Footnotes are appended at the end of the page, but if your page has a div with id "footnotes_holder", Footnotes will be inserted into this div.
68
aeeb0b53 » josevalim 2008-06-08 Updated README 69 * If you want to open multiple notes at the same time, just put in your enviroment:
70
71 Footnotes::Filter.multiple_notes = true
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 72
73 * Finally, you can cherry pick which notes you want to use, simply doing:
74
75 Footnotes::Filter.notes = [:session, :cookies, :params, :filters, :routes, :queries, :log, :general]
76
77 Creating your own notes
21486954 » josevalim 2008-12-29 Changed README markdown. 78 -----------------------
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 79
58e834a6 » josevalim 2008-06-05 Updated README 80 Create your notes to integrate with Footnotes is easy.
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 81
68d66e83 » josevalim 2008-06-05 Updated README again (markd... 82 1. Create a Footnotes::Notes::YoursExampleNote class
83
84 2. Implement the necessary methods (check abstract_note.rb file in lib/notes)
85
86 3. Append yours example note in Footnotes::Filter.notes (usually at the end of your environment file or an initializer):
0d51f519 » drnic 2008-05-11 Added README 87
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 88 Footnotes::Filter.notes += [:yours_example]
89
58e834a6 » josevalim 2008-06-05 Updated README 90 To create a note that shows info about the user logged in your application (@current_user) you just have to do:
91
92 <pre><code>module Footnotes
93 module Notes
94 class CurrentUserNote < AbstractNote
95 # Always receives a controller
96 #
97 def initialize(controller)
98 @current_user = controller.instance_variable_get("@current_user")
99 end
100
101 # The name that will appear as legend in fieldsets
102 #
103 def legend
104 "Current user: #{@current_user.name}"
105 end
bf221996 » josevalim 2008-08-04 Updating version 106
e09af6a9 » josevalim 2008-06-07 Inserted some valid? condit... 107 # This Note is only valid if we actually found an user
108 # If it's not valid, it won't be displayed
109 #
110 def valid?
111 @current_user
112 end
58e834a6 » josevalim 2008-06-05 Updated README 113
114 # The fieldset content
115 #
116 def content
117 escape(@current_user.inspect)
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 118 end
119 end
120 end
58e834a6 » josevalim 2008-06-05 Updated README 121 end</code></pre>
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 122
58e834a6 » josevalim 2008-06-05 Updated README 123 Then put in your environment:
124
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 125 Footnotes::Filter.notes += [:current_user]
126
58e834a6 » josevalim 2008-06-05 Updated README 127 Who?
21486954 » josevalim 2008-12-29 Changed README markdown. 128 ----
58e834a6 » josevalim 2008-06-05 Updated README 129
130 *Current Developer (v3.0 and above)*
0d51f519 » drnic 2008-05-11 Added README 131
132 José Valim (jose.valim@gmail.com)
68d66e83 » josevalim 2008-06-05 Updated README again (markd... 133 http://josevalim.blogspot.com/
58e834a6 » josevalim 2008-06-05 Updated README 134
0d51f519 » drnic 2008-05-11 Added README 135
58e834a6 » josevalim 2008-06-05 Updated README 136 *Original Author (v2.0)*
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 137
138 Duane Johnson (duane.johnson@gmail.com)
68d66e83 » josevalim 2008-06-05 Updated README again (markd... 139 http://blog.inquirylabs.com/
58e834a6 » josevalim 2008-06-05 Updated README 140
f9a9e706 » josevalim 2008-06-05 Footnotes v3.2: Now you can... 141
58e834a6 » josevalim 2008-06-05 Updated README 142 *License*
0d51f519 » drnic 2008-05-11 Added README 143
144 See MIT License.