[Bps-public-commit] r17650 - in sd/trunk: lib/App/SD/Server
jesse at bestpractical.com
jesse at bestpractical.com
Thu Jan 8 14:49:14 EST 2009
Author: jesse
Date: Thu Jan 8 14:49:13 2009
New Revision: 17650
Modified:
sd/trunk/lib/App/SD/Server/Dispatcher.pm
sd/trunk/lib/App/SD/Server/View.pm
sd/trunk/t/server.t
Log:
* create and edit tickets via the webui works again
Modified: sd/trunk/lib/App/SD/Server/Dispatcher.pm
==============================================================================
--- sd/trunk/lib/App/SD/Server/Dispatcher.pm (original)
+++ sd/trunk/lib/App/SD/Server/Dispatcher.pm Thu Jan 8 14:49:13 2009
@@ -1,19 +1,15 @@
package App::SD::Server::Dispatcher;
use Prophet::Server::Dispatcher -base;
-on qr'(.*)' => sub {
- next_rule;
- };
-on qr '.' => sub {
+on qr'.' => sub {
my $self = shift;
- if ( my $result = $self->server->result->get('create-ticket') ) {
- if ( $result->success ) {
+ my $result = $self->server->result->get('create-ticket');
+ if ( $result && $result->success ) {
$self->server->_send_redirect( to => '/ticket/' . $result->record_uuid );
- }
+ } else {
+ next_rule;
}
- next_rule;
-
};
on qr'.' => sub {
@@ -45,9 +41,8 @@
under 'POST' => sub {
- on 'records' => sub { next_rule;};
- on qr'^POST/ticket/([\w\d-]+)/edit$' => sub { shift->server->_send_redirect( to => '/ticket/' . $1 ); };
- on qr'^POST/(.*)$' => sub { shift->server->_send_redirect( to => $1 ); }
+ on qr'^ticket/([\w\d-]+)/edit$' => sub { shift->server->_send_redirect( to => '/ticket/' . $1 ); };
+ on qr'^(?!records)$' => sub { shift->server->_send_redirect( to => $1 ); };
};
Modified: sd/trunk/lib/App/SD/Server/View.pm
==============================================================================
--- sd/trunk/lib/App/SD/Server/View.pm (original)
+++ sd/trunk/lib/App/SD/Server/View.pm Thu Jan 8 14:49:13 2009
@@ -287,7 +287,7 @@
);
$ticket->load(($id =~ /^\d+$/ ? 'luid' : 'uuid') =>$id);
- title is $ticket->luid.": ".$ticket->prop('summary');
+ title is "Update ticket: ". $ticket->luid.": ".$ticket->prop('summary');
ul { {class is 'actions'};
li { a {{ href is '/ticket/'.$ticket->uuid.''}; 'Show'}; };
@@ -300,11 +300,11 @@
order => 1,
name => 'edit-ticket'
);
- for my $prop (
- 'summary', 'status', 'milestone', 'component', 'owner', 'due', 'reporter'
- ) {
+ for my $prop ( 'summary', 'status', 'milestone', 'component',
+ 'owner', 'due', 'reporter') {
- div { { class is 'widget $prop'}; widget( function => $f, prop => $prop ) };
+ div { { class is "widget $prop"};
+ widget( function => $f, prop => $prop ) };
}
h2 { 'Comments' };
@@ -316,20 +316,20 @@
name => 'update-ticket-comment'
);
- param_from_function(
- function => $c,
- prop => 'ticket',
- from_function => $f,
- from_result => 'record_uuid'
- );
+ hidden_param( function => $c,
+ prop => 'ticket',
+ value => $ticket->uuid);
for my $prop (qw(content)) {
-
- div { widget( function => $c, prop => $prop, type => 'textarea', autocomplete => 0)};
+ div { widget( function => $c, prop => $prop,
+ type => 'textarea', autocomplete => 0)};
}
input { attr { label => 'save', type => 'submit' } };
};
};
+
+
+
template new_ticket => page {'Create a new ticket'} content {
my $self = shift;
Modified: sd/trunk/t/server.t
==============================================================================
--- sd/trunk/t/server.t (original)
+++ sd/trunk/t/server.t Thu Jan 8 14:49:13 2009
@@ -9,7 +9,7 @@
}
-use Prophet::Test tests => 17;
+use Prophet::Test tests => 19;
use App::SD::Server;
use Test::WWW::Mechanize;
use JSON;
@@ -73,6 +73,16 @@
$ua->content_contains ('Create a new ticket');
+$ua->submit_form(form_number => 2,
+ fields => {
+ 'prophet-field-function-create-ticket-prop-owner' => 'jesse at example.com',
+ 'prophet-field-function-create-ticket-prop-summary' => 'Test ticket',
+
+ });
+
+$ua->content_contains('Test ticket');
+$ua->title_like(qr/^(\d+): Test ticket/);
+
sub start_server {
my $server_cli = App::SD::CLI->new();
my $s = App::SD::Server->new();
More information about the Bps-public-commit
mailing list