Permalink
Browse files

fixed issues with chaining and forwarding and form layout in bootstrap 2

  • Loading branch information...
1 parent a843527 commit 201bd79e12c60173380435ef3acfa49108a70539 @hashbangperl committed Apr 23, 2012
@@ -84,16 +84,20 @@ sub by_id : PathPart('sprint') :Chained('/') :CaptureArgs(1) {
my ($self, $c, $sprint_id) = @_;
+ if ($sprint_id eq 'current') {
+ $sprint_id = $c->user->team->current_sprint;
+ }
+
my $this_sprint = $c->model( 'DBIC::Sprint' )->search(
- {'me.id' => $sprint_id},
- { prefetch => ['stories'] }
+ {'me.id' => $sprint_id},
+ { prefetch => ['stories'] }
)->first;
unless ($this_sprint) {
- $c->forward('/default');
- $c->stash->{area} = 'sprint';
+ $c->forward('/default');
+ $c->stash->{area} = 'sprint';
$c->stash->{message} = 'sprint ' . $sprint_id . 'not found';
- return 0;
+ return 0;
}
$c->stash->{this_sprint} = $this_sprint;
@@ -110,11 +114,9 @@ sub by_id : PathPart('sprint') :Chained('/') :CaptureArgs(1) {
sub add_story :Chained('by_id') :Args(0) {
my ($self, $c) = @_;
- $c->stash->{add_to_object} = {type=>'sprint', object => $c->stash->{this_sprint}};
+ $c->stash->{add_to_object} = {type=>'sprint', object => $c->stash->{this_sprint}, label => 'Sprint'};
- $c->go($c->controller('Story')->action_for('add'));
-
- return 1;
+ $c->detach($c->controller('Story')->action_for('add'));
}
@@ -48,13 +48,17 @@ sub backlog : Local :Args(0) {
sub add : Local : Args(0) {
my ( $self, $c ) = @_;
+
$c->stash->{template} = 'story/add.tt';
- my $form = HTML::FormHandler->new( field_list => [
- 'username' => { type => 'Text' },
- 'selections' => { type => 'Select' },
- ]
- );
+ warn "you are here!!";
+
+ my $form = HTML::FormHandler->new(
+ field_list => [
+ 'username' => { type => 'Text' },
+ 'selections' => { type => 'Select' },
+ ]
+ );
return 1;
}
@@ -130,7 +130,7 @@ sub current_team : Local : Args( 0 ) {
my ($self, $c) = @_;
$c->go('/team/view/'.$c->user->team->id);
-
+
return 1;
}
@@ -142,8 +142,8 @@ sub current_team : Local : Args( 0 ) {
sub current_sprint : Local : Args( 0 ) {
my ($self, $c) = @_;
- $c->go($c->controller('Sprint')->action_for('taskboard'),[$c->user->team->current_sprint],[]);
-
+ $c->go($c->controller('Sprint')->action_for('taskboard'),[$c->user->team->current_sprint],[]);
+
return 1;
}
@@ -6,15 +6,20 @@
<div class="span14">
<!-- Login form -->
- <form method="post" action="/story/add">
+ <form method="post" action="/story/add" class="form-horizontal">
<fieldset>
<legend>Add Story</legend>
[% IF add_to_object %]
- <div class="controls">
- <span class="input-xlarge uneditable-input">[% add_to_object.object.to_string %]</span>
+ [%- SET field_id = add_to_object.type _ '_' _ add_to_object.object.id %]
+ <div class="control-group">
+ <label class="control-label" for="[% field_id %]">[% add_to_object.label %]</label>
+ <div class="controls">
+ <span class="input-xlarge uneditable-input" id="[% field_id %]">[% add_to_object.object.name %]</span>
<input type="hidden" name="[% add_to_object.type %]" value="[% add_to_object.object.id %]"/>
- </div>
+ <p class="help-block">(add to Current sprint)</p>
+ </div>
+ </div>
[% END %]
<input type="hidden" name="submitted" value="1"/>

0 comments on commit 201bd79

Please sign in to comment.