Change 173
Change 173 by nullbyte@nullbyte-gentoo on 2005/07/10 16:58:09
AJAX! recent changes loads in place with link_to_remote. no page reload. very web 2.0.
(it's an XMLHttpRequest. we've had those since IE5. but now it has a name.)
Affected files ...| //depot/projects/wiki/app/controllers/wiki_controller.rb#2 | text | |
| //depot/projects/wiki/app/views/wiki/show.rhtml#2 | text |
==== //depot/projects/wiki/app/controllers/wiki_controller.rb#2 (text) ====
| @@ -23,6 +23,11 @@ | ||
| 23 | 23 | end |
| 24 | 24 | end |
| 25 | 25 | |
| 26 | def recent | |
| 27 | @pages = Page.find_all(nil, 'updated_at DESC', 10) | |
| 28 | render_partial 'recent' | |
| 29 | end | |
| 30 | ||
| 26 | 31 | private |
| 27 | 32 | |
| 28 | 33 | def find_or_new(name) |
==== //depot/projects/wiki/app/views/wiki/show.rhtml#2 (text) ====
| @@ -10,3 +10,7 @@ | ||
| 10 | 10 | <%= link_to 'Edit', :action => 'edit', :name => @page.name %> |
| 11 | 11 | </p> |
| 12 | 12 | <% end %> |
| 13 | ||
| 14 | <div id="recent"></div> | |
| 15 | <p><%= link_to_remote 'Recent changes', :update => 'recent', | |
| 16 | :url => { :action => 'recent' } %></p> | |