Changeset 184
- Timestamp:
- 05/28/07 01:03:11 (3 years ago)
- Location:
- veekun/trunk
- Files:
-
- 2 modified
-
lib/Vee/Controller/Dex.pm (modified) (2 diffs)
-
templates/dex/lookup/wildcard.tt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
veekun/trunk/lib/Vee/Controller/Dex.pm
r182 r184 154 154 155 155 $s->{page_title} = 'Wildcard Lookup'; 156 $s->{crumbs} = [ '<a href="' . $c->uri('Dex') . '">Pokédex</a>', 'Wildcard Lookup' ]; 156 157 157 158 (my $test = $entry) =~ s/[^-_ 0-9a-zA-Z]//g; … … 171 172 my %results; 172 173 173 # TODO: cleaner and slightly future-proofer way to do this?174 # TODO: bomb if zero175 $results{pokemon} = [ grep { $PokemonNames[$_] =~ $re } 1 .. $#PokemonNames ];176 $results{types} = [ grep { $TypeNames[$_] =~ $re } 0 .. $#TypeNames ];177 $results{moves} = [ grep { $MoveData[$_]->name =~ $re } 1 .. $#MoveData ];174 # TODO: use %FuzzyMatches somehow 175 $results{abilities} = [ grep { $AbilityNames[$_] =~ $re } 1 .. $#AbilityNames ]; 176 $results{pokemon} = [ grep { $PokemonNames[$_] =~ $re } 1 .. $#PokemonNames ]; 177 $results{types} = [ grep { $TypeNames[$_] =~ $re } 0 .. $#TypeNames ]; 178 $results{moves} = [ grep { $MoveData[$_]->name =~ $re } 1 .. $#MoveData ]; 178 179 179 180 my $total = 0; 180 181 $total += $#{$results{$_}} + 1 for keys %results; 181 $c->vee_stop('No match for ', $orig, ' was found. You may wish to try the <a href="' . $c->uri('Dex', 'pokemon_list') . '">Pokémon list</a>, <a href="' . $c->uri('Dex', 'move_list') . '">move list</a>, or <a href="' . $c->uri('Dex', 'type_list') . '">type list</a> to find what you are looking for.'); 182 183 $s->{results} = \%results; 182 $c->vee_stop('No match for ', $orig, ' was found. You may wish to try the <a href="' . $c->uri('Dex', 'pokemon_list') . '">Pokémon list</a>, <a href="' . $c->uri('Dex', 'move_list') . '">move list</a>, <a href="' . $c->uri('Dex', 'type_list') . '">type list</a>, etc. to find what you are looking for.') unless $total; 183 $c->vee_stop('', $orig, ' returned too many matches. Please try something more specific.') if $total > 50; 184 185 $s->{results} = \%results; 184 186 $s->{template} = 'dex/lookup/wildcard.tt'; 185 187 } -
veekun/trunk/templates/dex/lookup/wildcard.tt
r1 r184 1 <p>TODO: needs a message here 8)</p> 2 <p>TODO: what to do if nothing is found?</p> 3 <p>normal fuzzy search and clean this up too</p> 1 <h1>Wildcard Lookup Results</h1> 4 2 5 COMMIT SOMETHING NOOB 6 7 error handling could stand to be less ugly 8 clean up basic post-create script 9 thread creation? whoa there fella 10 11 <h1>Fuzzy Search Results</h1> 3 [%# TODO: this should not need manual separate chunks! or maybe it should? %] 4 [%# TODO: sort better? %] 12 5 13 6 [% IF results.pokemon.size %] … … 15 8 <ul> 16 9 [% FOREACH p IN results.pokemon.nsort %] 17 <li><a href="[% dex_uri('pokemon', PokemonNames.$p) %]"> #[% p %]:[% PokemonNames.$p %]</a></li>10 <li><a href="[% dex_uri('pokemon', PokemonNames.$p) %]"><img src="/dex-images/icons/[% p.pad(3) %].png" alt=""/> [% PokemonNames.$p %]</a></li> 18 11 [% END %] 19 12 </ul> … … 29 22 [% END %] 30 23 24 [% IF results.abilities.size %] 25 <h2>Abilities</h2> 26 <ul> 27 [% FOREACH a IN results.abilities.nsort %] 28 <li><a href="[% dex_uri('ability', AbilityNames.$a) %]">[% AbilityNames.$a %]</a></li> 29 [% END %] 30 </ul> 31 [% END %] 32 31 33 [% IF results.types.size %] 32 34 <h2>Types</h2>
