[Jifty-commit] r2552 - in jifty/trunk: lib/Jifty/Plugin/REST
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Jan 24 22:05:03 EST 2007
Author: trs
Date: Wed Jan 24 22:05:03 2007
New Revision: 2552
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
Log:
r19049 at zot: tom | 2007-01-24 22:04:51 -0500
Show an action HTML form when rendering /=/action/App.Action.Foo as HTML
Modified: jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm Wed Jan 24 22:05:03 2007
@@ -114,7 +114,14 @@
else {
$apache->header_out('Content-Type' => 'text/html; charset=UTF-8');
$apache->send_http_header;
- print render_as_html($prefix, $url, @_);
+
+ # Special case showing particular actions to show an HTML form
+ if ( $prefix->[0] eq 'action' and scalar @$prefix == 2 ) {
+ show_action_form($1);
+ }
+ else {
+ print render_as_html($prefix, $url, @_);
+ }
}
last_rule;
@@ -430,19 +437,19 @@
}
}
- outs( undef, \%args );
+ outs( ['action', $class], \%args );
}
-=head2 show_action_form
+=head2 show_action_form $ACTION_CLASS
-Takes a single parameter, $action, supplied by the dispatcher.
+Takes a single parameter, the class of an action.
Shows the user an HTML form of the action's parameters to run that action.
=cut
sub show_action_form {
- my ($action) = action($1) or abort(404);
+ my ($action) = action(shift) or abort(404);
Jifty::Util->require($action) or abort(404);
$action = $action->new or abort(404);
More information about the Jifty-commit
mailing list