[Jifty-commit] r6858 - jifty/trunk/lib/Jifty/Plugin/RequestInspector

Jifty commits jifty-commit at lists.jifty.org
Wed Apr 22 20:22:50 EDT 2009


Author: sartak
Date: Wed Apr 22 20:22:50 2009
New Revision: 6858

Modified:
   jifty/trunk/lib/Jifty/Plugin/RequestInspector/View.pm

Log:
Add a "more" link to load up more requests

Modified: jifty/trunk/lib/Jifty/Plugin/RequestInspector/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/RequestInspector/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/RequestInspector/View.pm	Wed Apr 22 20:22:50 2009
@@ -37,6 +37,43 @@
         }
     };
 
+    render_region(
+        name => 'more_button',
+        path => '/__jifty/admin/requests/more_button',
+    );
+};
+
+template '/__jifty/admin/requests/more_button' => sub {
+    my $request_inspector = Jifty->find_plugin('Jifty::Plugin::RequestInspector');
+    my $last_request = ($request_inspector->requests)[-1];
+    my $starting_id = $last_request ? $last_request->{id} + 1 : 0;
+
+    hyperlink(
+        label => "more",
+        onclick => [{
+            element => '#request_inspector',
+            append  => '/__jifty/admin/requests/more_requests',
+            effect  => 'slideDown',
+            arguments => {
+                starting_id => $starting_id,
+            },
+        },
+        {
+            refresh_self => 1,
+        }],
+    );
+};
+
+template '/__jifty/admin/requests/more_requests' => sub {
+    my $request_inspector = Jifty->find_plugin('Jifty::Plugin::RequestInspector');
+    my $starting_id = get('starting_id');
+
+    my @requests = $request_inspector->requests;
+    splice @requests, 0, $starting_id;
+
+    for my $request (@requests) {
+        render_request($request);
+    }
 };
 
 template '/__jifty/admin/requests/plugins' => sub {


More information about the Jifty-commit mailing list