[Jifty-commit] r816 - in jifty/trunk: . lib/Jifty
share/web/templates/__jifty/admin
share/web/templates/__jifty/admin/action t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Apr 5 19:12:56 EDT 2006
Author: alexmv
Date: Wed Apr 5 19:12:55 2006
New Revision: 816
Added:
jifty/trunk/share/web/templates/__jifty/admin/action/
jifty/trunk/share/web/templates/__jifty/admin/action/dhandler
jifty/trunk/share/web/templates/__jifty/admin/model/
jifty/trunk/share/web/templates/__jifty/admin/model/dhandler
Removed:
jifty/trunk/share/web/templates/__jifty/admin/dhandler
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/API.pm
jifty/trunk/lib/Jifty/Web.pm
jifty/trunk/share/web/templates/__jifty/admin/index.html
jifty/trunk/t/99-pod-coverage.t
Log:
r12164 at zoq-fot-pik: chmrr | 2006-04-05 19:12:38 -0400
* Access to all actions through the admin UI
* Don't use Jifty->web->return on the model pages; we don't have a continuation push to them
* Show action errors if we're in devel mode
Modified: jifty/trunk/lib/Jifty/API.pm
==============================================================================
--- jifty/trunk/lib/Jifty/API.pm (original)
+++ jifty/trunk/lib/Jifty/API.pm Wed Apr 5 19:12:55 2006
@@ -214,7 +214,9 @@
=head2 actions
Lists the class names of all of the allowed actions for this Jifty
-application.
+application; this may include actions under the C<Jifty::Action::>
+namespace, in addition to actions under your application's
+C<ActionBasePath>.
=cut
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Wed Apr 5 19:12:55 2006
@@ -242,32 +242,35 @@
unless ( $self->request->just_validating ) {
for my $request_action (@valid_actions) {
- eval {
- # Pull the action out of the request (again, since
- # mappings may have affected parameters). This
- # returns the cached version unless the request has
- # been changed by argument mapping from previous
- # actions (Jifty::Request::Mapper)
- my $action = $self->new_action_from_request($request_action);
- next unless $action;
- if ($request_action->modified) {
- # If the request's action was changed, re-validate
- $action->result(Jifty::Result->new);
- $action->result->action_class(ref $action);
- $self->response->result( $action->moniker => $action->result );
- $self->log->debug("Re-validating action ".ref($action). " ".$action->moniker);
- next unless $action->validate;
- }
-
- $self->log->debug("Running action.");
- $action->run;
- };
+ # Pull the action out of the request (again, since
+ # mappings may have affected parameters). This
+ # returns the cached version unless the request has
+ # been changed by argument mapping from previous
+ # actions (Jifty::Request::Mapper)
+ my $action = $self->new_action_from_request($request_action);
+ next unless $action;
+ if ($request_action->modified) {
+ # If the request's action was changed, re-validate
+ $action->result(Jifty::Result->new);
+ $action->result->action_class(ref $action);
+ $self->response->result( $action->moniker => $action->result );
+ $self->log->debug("Re-validating action ".ref($action). " ".$action->moniker);
+ next unless $action->validate;
+ }
+
+ $self->log->debug("Running action.");
+ eval { $action->run; };
if ( my $err = $@ ) {
# poor man's exception propagation
# We need to get "LAST RULE" exceptions back up to the dispatcher
- die $err if ($err =~ /^LAST RULE/);
+ die $err if ( $err =~ /^LAST RULE/ );
$self->log->fatal($err);
+ $action->result->error(
+ Jifty->config->framework("DevelMode")
+ ? $err
+ : "There was an error completing the request. Please try again later."
+ );
}
# Fill in the request with any results that that action
Added: jifty/trunk/share/web/templates/__jifty/admin/action/dhandler
==============================================================================
--- (empty file)
+++ jifty/trunk/share/web/templates/__jifty/admin/action/dhandler Wed Apr 5 19:12:55 2006
@@ -0,0 +1,27 @@
+<%init>
+my $action_class = Jifty->api->qualify($m->dhandler_arg);
+
+my $action = Jifty->web->new_action(
+ class => $action_class,
+ moniker => "run-$action_class",
+);
+
+$action->sticky_on_failure(1);
+
+</%init>
+<&|/_elements/wrapper &>
+
+<% Jifty->web->form->start %>
+
+% for ($action->argument_names) {
+<% $action->form_field($_) %>
+% }
+
+<% Jifty->web->form->submit( label => "Run the action" ) %>
+
+<% Jifty->web->form->end %>
+
+<h2>Done?</h2>
+<% Jifty->web->link( url => "/__jifty/admin/", label => 'Back to the admin console') %>
+
+</&>
\ No newline at end of file
Modified: jifty/trunk/share/web/templates/__jifty/admin/index.html
==============================================================================
--- jifty/trunk/share/web/templates/__jifty/admin/index.html (original)
+++ jifty/trunk/share/web/templates/__jifty/admin/index.html Wed Apr 5 19:12:55 2006
@@ -36,13 +36,23 @@
<p><%_(q{To disable this administrative console, add "framework: AdminMode: 0" to your application's configuration file.})%></p>
-
+<h2><%_('Models')%></h2>
<ul>
% foreach my $model (@models) {
% next unless ($model =~ /^(?:.*)::(.*?)$/);
% my $type = $1;
-<li><% Jifty->web->link( url => '/__jifty/admin/'.$type, label => $type)%>
+<li><% Jifty->web->link( url => '/__jifty/admin/model/'.$type, label => $type)%>
%}
</ul>
+<h2><%_('Actions')%></h2>
+<ul>
+% foreach my $action (Jifty->api->actions) {
+<li><% Jifty->web->link( url => '/__jifty/admin/action/'.$action, label => $action) %>
+% }
+</ul>
+
+<h2>Done?</h2>
+<% Jifty->web->return( to => "/", label => 'Back to the application') %>
+
</&>
Added: jifty/trunk/share/web/templates/__jifty/admin/model/dhandler
==============================================================================
--- (empty file)
+++ jifty/trunk/share/web/templates/__jifty/admin/model/dhandler Wed Apr 5 19:12:55 2006
@@ -0,0 +1,22 @@
+<%init>
+my $object_type = $m->dhandler_arg;
+
+my $collection_class = Jifty->config->framework('ApplicationClass')."::Model::".$object_type."Collection";
+my $records = $collection_class->new();
+$records->unlimit;
+</%init>
+<&|/_elements/wrapper &>
+<h1>Manage records: <%$object_type%></h1>
+<% Jifty->web->form->start %>
+
+<% Jifty->web->region(name => "admin-$object_type",
+ path => "/__jifty/admin/fragments/list/list",
+ defaults => { object_type => $object_type ,
+ render_submit => 1 }) %>
+
+<% Jifty->web->form->end %>
+
+<h2>Done?</h2>
+<% Jifty->web->link( url => "/__jifty/admin/", label => 'Back to the admin console') %>
+
+</&>
Modified: jifty/trunk/t/99-pod-coverage.t
==============================================================================
--- jifty/trunk/t/99-pod-coverage.t (original)
+++ jifty/trunk/t/99-pod-coverage.t Wed Apr 5 19:12:55 2006
@@ -1,7 +1,7 @@
use Test::More;
eval "use Test::Pod::Coverage 1.00";
plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
-all_pod_coverage_ok( {nonwhitespace => 1 } );
+all_pod_coverage_ok( );
# Workaround for dumb bug (fixed in 5.8.7) where Test::Builder thinks that
# certain "die"s that happen inside evals are not actually inside evals,
More information about the Jifty-commit
mailing list