load change form inline using jQuery .load
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 27 May 2010 18:02:05 +0000 (20:02 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 27 May 2010 18:02:05 +0000 (20:02 +0200)
templates/changes/index.html.ep

index 1909719..dafd11c 100644 (file)
@@ -18,7 +18,7 @@
 <tr><th>action</th><th>timestamp</th></tr>
 % foreach my $change ( @$changes ) {
 <tr><td>
-<a href="<%= url_for( controller => 'changes', action => 'view' )->query( uid => $change->{uid} ) %>"><%= $change->{action} %></a>
+<a class="view" href="<%= url_for( controller => 'changes', action => 'view' )->query( uid => $change->{uid} ) %>"><%= $change->{action} %></a>
 </td><td>
 <tt class=ts><%= $change->{t} %></tt>
 </td></tr>
@@ -35,5 +35,13 @@ $(document).ready( function(){
        $('tt.ts').each( function(){
                $(this).text( date_pretty( new Date(this.textContent * 1000) ) );
        });
+
+       $('a.view').live( 'click', function() {
+               console.debug(this
+                       , this.href
+               );
+               $(this).parent().load( this.href + ' form' ).css({ 'border': '3px dashed #f84' });
+               return false;
+       });
 });
 </script>