drnic / rails-footnotes
- Source
- Commits
- Network (12)
- Issues (0)
- Downloads (3)
- Wiki (1)
- Graphs
-
Tree:
2148695
rails-footnotes / README.markdown
| 71faa2b5 » | josevalim | 2008-12-29 | 1 | New home | |
| 21486954 » | josevalim | 2008-12-29 | 2 | ======== | |
| 71faa2b5 » | josevalim | 2008-12-29 | 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 | 8 | Footnotes plugin for Rails (v3.3) | |
| 21486954 » | josevalim | 2008-12-29 | 9 | -------------------------------- | |
| 0d51f519 » | drnic | 2008-05-11 | 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 | 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 | 16 | ||
| 17 | Installation | ||||
| 21486954 » | josevalim | 2008-12-29 | 18 | ------------ | |
| 0d51f519 » | drnic | 2008-05-11 | 19 | ||
| dd8bac5a » | josevalim | 2008-10-20 | 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 | 21 | ||
| 0d51f519 » | drnic | 2008-05-11 | 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 | 27 | ||
| 58e834a6 » | josevalim | 2008-06-05 | 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 | 29 | ||
| c5aafacd » | josevalim | 2008-05-21 | 30 | Early versions | |
| 21486954 » | josevalim | 2008-12-29 | 31 | -------------- | |
| 93292a67 » | josevalim | 2008-05-12 | 32 | ||
| dd8bac5a » | josevalim | 2008-10-20 | 33 | If you are running on Rails 2.1.x, you should use Footnotes v3.2.2: | |
| d42fef4f » | josevalim | 2008-09-09 | 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 | 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 | 42 | ||
| c5aafacd » | josevalim | 2008-05-21 | 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 | 48 | ||
| 8261b476 » | josevalim | 2008-05-21 | 49 | Remember that in Rails 1.x, after filters appear first than before filters in the Filters tab. | |
| 50 | |||||
| aeeb0b53 » | josevalim | 2008-06-08 | 51 | Usage | |
| 21486954 » | josevalim | 2008-12-29 | 52 | ----- | |
| 6446c1c5 » | josevalim | 2008-06-03 | 53 | ||
| e293e8f7 » | josevalim | 2008-08-03 | 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 | 55 | ||
| aeeb0b53 » | josevalim | 2008-06-08 | 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 | 58 | ||
| f9a9e706 » | josevalim | 2008-06-05 | 59 | Footnotes::Filter.prefix = "editor://open?file://" | |
| 60 | |||||
| aeeb0b53 » | josevalim | 2008-06-08 | 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 | 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 | 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 | 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 | 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 | 78 | ----------------------- | |
| f9a9e706 » | josevalim | 2008-06-05 | 79 | ||
| 58e834a6 » | josevalim | 2008-06-05 | 80 | Create your notes to integrate with Footnotes is easy. | |
| f9a9e706 » | josevalim | 2008-06-05 | 81 | ||
| 68d66e83 » | josevalim | 2008-06-05 | 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 | 87 | ||
| f9a9e706 » | josevalim | 2008-06-05 | 88 | Footnotes::Filter.notes += [:yours_example] | |
| 89 | |||||
| 58e834a6 » | josevalim | 2008-06-05 | 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 | 106 | ||
| e09af6a9 » | josevalim | 2008-06-07 | 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 | 113 | ||
| 114 | # The fieldset content | ||||
| 115 | # | ||||
| 116 | def content | ||||
| 117 | escape(@current_user.inspect) | ||||
| f9a9e706 » | josevalim | 2008-06-05 | 118 | end | |
| 119 | end | ||||
| 120 | end | ||||
| 58e834a6 » | josevalim | 2008-06-05 | 121 | end</code></pre> | |
| f9a9e706 » | josevalim | 2008-06-05 | 122 | ||
| 58e834a6 » | josevalim | 2008-06-05 | 123 | Then put in your environment: | |
| 124 | |||||
| f9a9e706 » | josevalim | 2008-06-05 | 125 | Footnotes::Filter.notes += [:current_user] | |
| 126 | |||||
| 58e834a6 » | josevalim | 2008-06-05 | 127 | Who? | |
| 21486954 » | josevalim | 2008-12-29 | 128 | ---- | |
| 58e834a6 » | josevalim | 2008-06-05 | 129 | ||
| 130 | *Current Developer (v3.0 and above)* | ||||
| 0d51f519 » | drnic | 2008-05-11 | 131 | ||
| 132 | José Valim (jose.valim@gmail.com) | ||||
| 68d66e83 » | josevalim | 2008-06-05 | 133 | http://josevalim.blogspot.com/ | |
| 58e834a6 » | josevalim | 2008-06-05 | 134 | ||
| 0d51f519 » | drnic | 2008-05-11 | 135 | ||
| 58e834a6 » | josevalim | 2008-06-05 | 136 | *Original Author (v2.0)* | |
| f9a9e706 » | josevalim | 2008-06-05 | 137 | ||
| 138 | Duane Johnson (duane.johnson@gmail.com) | ||||
| 68d66e83 » | josevalim | 2008-06-05 | 139 | http://blog.inquirylabs.com/ | |
| 58e834a6 » | josevalim | 2008-06-05 | 140 | ||
| f9a9e706 » | josevalim | 2008-06-05 | 141 | ||
| 58e834a6 » | josevalim | 2008-06-05 | 142 | *License* | |
| 0d51f519 » | drnic | 2008-05-11 | 143 | ||
| 144 | See MIT License. | ||||

