Changeset 431 for veekun/trunk/lib
- Timestamp:
- 05/21/08 01:49:07 (22 months ago)
- Location:
- veekun/trunk/lib/Vee
- Files:
-
- 1 removed
- 1 modified
-
Controller/Dex/Utils.pm (modified) (3 diffs)
-
Form (deleted)
Legend:
- Unmodified
- Added
- Removed
-
veekun/trunk/lib/Vee/Controller/Dex/Utils.pm
r429 r431 3 3 use strict; 4 4 use warnings; 5 use base 'Catalyst::Controller ::HTML::FormFu';5 use base 'Catalyst::Controller'; 6 6 7 7 use List::MoreUtils qw/first_index last_index/; 8 8 9 use Vee::Dex; 9 10 use Vee::Form; … … 230 231 } 231 232 233 our $breeding_chains_fields = { 234 pokemon => { type => 'text', class => 'js-dexsuggest-pokemon', }, 235 move => { type => 'text', count => 4, class => 'js-dexsuggest-move', }, 236 }; 237 232 238 sub breeding_chains 233 239 : Path('calculators/breeding_chains') 234 240 : Args(0) 235 : FormConfig('dex/utils/breeding_chains.yml')236 241 { 237 242 my ($self, $c) = @_; 238 243 my $s = $c->stash; 239 my $form = $s->{form}; 240 $s->{template} = 'dex/utils/breeding_chains.tt'; 244 my $p = $c->req->params; 245 246 my $form = $s->{form} = Vee::Form->new( 247 id => 'breeding_chains', 248 fields => $breeding_chains_fields, 249 params => $p, 250 ); 251 $s->{template} = 'dex/utils/breeding_chains.tt'; 241 252 $s->{page_title} = 'Breeding Chains'; 242 253 243 if (not $form->submitted or $form->has_errors) {254 if (not $form->submitted) { 244 255 return; 245 256 } 246 257 247 # XXX do the retrievals in Inflator code 248 my $pokemon = $c->model('DBIC::Pokemon')->find($form->param_value('pokemon')); 249 my @moves = map { $c->model('DBIC::Moves')->find($_) } $form->param_list('move'); 258 my $pokemon = $c->model('DBIC::Pokemon')->search({ name => $p->{ pokemon } })->first; 259 my @moves = $c->model('DBIC::Moves' )->search({ name => $p->{ move } })->all; 250 260 251 261 # XXX … … 253 263 254 264 ### Misc error handling 265 266 if (not $pokemon) { 267 $s->{error_msg} 268 = 'No such Pokemon ' . $c->vee_cleanse($p->{pokemon}) . '.'; 269 return; 270 } 255 271 256 272 if ($pokemon->breeding_code == 255) {
