Permalink
Browse files

Merge remote branch 'dhoss/master'

  • Loading branch information...
2 parents 429b802 + ef36bb4 commit 67ce793777b392206fa86bcd2c76c7bd5a576f3b Kieren Diment committed Mar 17, 2010
View
Binary file not shown.
@@ -5,7 +5,7 @@ use warnings;
use base 'DBIx::Class::Schema';
-__PACKAGE__->load_classes;
+__PACKAGE__->load_namespaces;
# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-09-11 17:06:47
@@ -2,7 +2,7 @@ package Survey::Perl::Controller::Survey;
use Moose;
use Config::Any;
BEGIN { extends 'Catalyst::Controller' }
-
+use Data::Dumper;
sub survey_base :Chained("/") :PathPart("survey") :CaptureArgs(0) {
my ($self, $c) = @_;
# if (! $c->user) {
@@ -31,7 +31,13 @@ sub finish_survey :Chained("survey_base") :PathPart("finish") :Args(0) {
sub finish_survey : Chained("survey_base") PathPart("finish") Args(0) {
my ($self, $c) = @_;
-
+ my $answers = $c->req->params;
+ $c->log->debug("Params: " . Dumper $answers);
+ delete $answers->{'submit'};
+ my $rs = $c->model('Answers')->txn_do(sub{
+ $c->model('Answers::Survey')->create($answers)
+ or die "Could not submit survey answers: $!";
+ });
}
@@ -18,4 +18,8 @@ pre {
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
-}
+}
+
+h2 {
+ color: #eeeeee;
+}
@@ -0,0 +1,3 @@
+[% IF c.req.params %]
+<h2>Thank you for completing the survey.</h2>
+[% END %]
@@ -89,7 +89,7 @@ $(document).ready(function(){
<div class="formContainer">
-<form name="" action = "[% c.uri_for_action('/survey/finish') %]" method="POST">
+<form name="" action = "[% c.uri_for_action('/survey/finish_survey') %]" method="POST">
<ul class="form">
[% FOREACH s IN sections %]

0 comments on commit 67ce793

Please sign in to comment.