Changeset 19
- Timestamp:
- 02/23/07 21:09:57 (3 years ago)
- Location:
- veekun
- Files:
-
- 8 modified
-
lib/Vee/Controller/Dex.pm (modified) (9 diffs)
-
lib/Vee/Controller/Shoutbox.pm (modified) (1 diff)
-
lib/Vee/Controller/Users/Messages.pm (modified) (1 diff)
-
templates/dex/list/abilities.tt (modified) (1 diff)
-
templates/dex/page/pokemon.tt (modified) (1 diff)
-
templates/dex/page/type.tt (modified) (1 diff)
-
templates/shoutbox.tt (modified) (1 diff)
-
templates/users/messages/list.tt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
veekun/lib/Vee/Controller/Dex.pm
r13 r19 208 208 my $s = $c->stash; 209 209 210 $s->{list} = [ $c->model('DBIC::Abilities')->search({ id => { '<' => 200 } }, { order_by => 'id ASC' }) ];210 $s->{list} = $c->model('DBIC::Abilities')->search({ id => { '<' => 200 } }, { order_by => 'id ASC' }); 211 211 212 212 my %pokemon; 213 my @pokemon_list = $c->model('DBIC::Pokemon')->search({213 my $pokemon_list = $c->model('DBIC::Pokemon')->search({ 214 214 id => { '<=' => $Generations[-1]{maxid} } 215 215 }, { 216 216 columns => [qw/id ability1id ability2id/] 217 217 }); 218 for my $poke (@pokemon_list) {218 while (my $poke = $pokemon_list->next) { 219 219 push @{ $pokemon{$poke->ability1id} }, $poke->id; 220 220 push @{ $pokemon{$poke->ability2id} }, $poke->id; … … 367 367 # breeding 368 368 my ($breed1, $breed2) = ($row->breed1, $row->breed2 || $row->breed1); 369 $s->{breedables} = [$c->model('DBIC::Pokemon')->search(369 $s->{breedables} = $c->model('DBIC::Pokemon')->search( 370 370 \ "breed1 IN ($breed1, $breed2) OR breed2 IN ($breed1, $breed2)", 371 371 { columns => [qw/id name gender/], group_by => 'evid', order_by => 'id ASC' } 372 ) ];372 ); 373 373 374 374 # moves … … 631 631 632 632 my $row = get_row($c, 'Pokemon', $poke); 633 # TODO: log these blah blah blah634 633 $c->vee_abort('There is no such Pokémon ', $poke, '. If you are messing with my URLs, please stop. If you came here via a link, please inform its owner that it is invalid.') unless $row; 635 634 … … 638 637 calculate_stats($c, $row); 639 638 640 my @moves = $c->model('DBIC::PokeMoves')->search({ pokeid => $row->id, -and => \ "FIND_IN_SET('$gen', version)" });639 my $moves = $c->model('DBIC::PokeMoves')->search({ pokeid => $row->id, -and => \ "FIND_IN_SET('$gen', version)" }); 641 640 my %moves; 642 641 643 for my $move_row (@moves) {642 while (my $move_row = $moves->next) { 644 643 push @{ $moves{ $move_row->moveid } }, $move_row; 645 644 } … … 648 647 $s->{this} = $row; 649 648 650 $s->{page_title } = $row->name . ' - Strategic Overview';651 $s->{crumbs }= [649 $s->{page_title} = $row->name . ' - Strategic Overview'; 650 $s->{crumbs} = [ 652 651 '<a href="' . $c->uri('Dex') . '">Pokédex</a>', 653 652 '<a href="' . $c->uri('Dex', 'pokemon_list') . '">Pokémon</a>', … … 685 684 686 685 my $row = get_row($c, 'Types'); 687 $c->vee_abort('There is no such type ', $c->req->args->[0], '. If you are messing with my URLs, please stop. If you came here via a link, please inform its owner that it is invalid.') unless $row; 688 689 $s->{hid} = $row->internalid + 1; 690 $s->{generation} = ($row->name eq 'dark' || $row->name eq 'steel') ? 1 : 0; 691 692 $s->{page_title } = ucfirst($row->name) . ' - Type #' . $s->{hid}; 686 $c->vee_abort('There is no such type ', $c->req->args->[0], '. If you are messing with my URLs, please stop. If you came here via a link, please inform its owner that it is invalid.') 687 unless $row; 688 689 $s->{hid} = $row->internalid + 1; 690 $s->{generation} = ($row->name eq 'dark' || $row->name eq 'steel') ? 1 : 0; 691 692 $s->{page_title} = ucfirst($row->name) . ' - Type #' . $s->{hid}; 693 693 $s->{page_header} = ucfirst $row->name; 694 $s->{link_name }= 'dex';695 $s->{crumbs }= [694 $s->{link_name} = 'dex'; 695 $s->{crumbs} = [ 696 696 '<a href="' . $c->uri('Dex') . '">Pokédex</a>', 697 697 '<a href="' . $c->uri('Dex', 'type_list') . '">Types</a>', … … 699 699 ]; 700 700 701 $s->{this }= $row;702 $s->{pokemon} = [$c->model('DBIC::Pokemon')->search(701 $s->{this} = $row; 702 $s->{pokemon} = $c->model('DBIC::Pokemon')->search( 703 703 [ type1 => $row->name, type2 => $row->name ], 704 704 { order_by => 'name ASC', columns => [qw/id name type1 type2/] } 705 ) ];706 $s->{moves } = [ $c->model('DBIC::Moves')->search({ type => $row->name }, { order_by => 'name ASC', columns => ['id'] }) ];705 ); 706 $s->{moves} = $c->model('DBIC::Moves')->search({ type => $row->name }, { order_by => 'name ASC', columns => ['id'] }); 707 707 708 708 $s->{template} = 'dex/page/type.tt'; … … 723 723 724 724 if ($search) { 725 # XXX: could use a better sorting mechanism here 726 # XXX: substr etc would probably be faster and less regex-injection-prone 727 push @suggestions, grep { /^$search/i } @PokemonNames[ 1 .. $#PokemonNames ]; 728 push @suggestions, grep { /^$search/i } map { $_->name } @MoveData[ 1 .. $#MoveData ]; 729 push @suggestions, grep { /^$search/i } @TypeNames[ 1 .. $#TypeNames ]; 725 my $len = length $search; 726 $search = lc $search; 727 # TODO: could use a better sorting mechanism here 728 push @suggestions, grep { $search eq lc substr $_, 0, $len } @PokemonNames[ 1 .. $#PokemonNames ]; 729 push @suggestions, grep { $search eq lc substr $_, 0, $len } map { $_->name } @MoveData[ 1 .. $#MoveData ]; 730 push @suggestions, grep { $search eq lc substr $_, 0, $len } @TypeNames[ 1 .. $#TypeNames ]; 730 731 } 731 732 … … 751 752 752 753 $string =~ tr/a-z!? //cd; 753 $s->{string} = $string;754 $s->{dir} = $dir;754 $s->{string} = $string; 755 $s->{dir} = $dir; 755 756 $s->{template} = 'dex/eggs/annon.tt'; 756 757 } -
veekun/lib/Vee/Controller/Shoutbox.pm
r5 r19 37 37 $s->{extra_css} = 'index'; 38 38 39 $s->{shouts} = [ $c->model('DBIC::Shoutbox')->search( 40 undef, 41 { 42 order_by => 'time DESC', 43 prefetch => ['user'], 44 rows => $c->site_opts->{page_sizes}{shoutbox}, 45 offset => $skip, 46 } 47 ) ]; 39 $s->{shouts} = $c->model('DBIC::Shoutbox')->search(undef, { 40 order_by => 'time DESC', 41 prefetch => ['user'], 42 rows => $c->site_opts->{page_sizes}{shoutbox}, 43 offset => $skip, 44 }); 48 45 49 46 $s->{shout_total} = $c->model('DBIC::Shoutbox')->count; -
veekun/lib/Vee/Controller/Users/Messages.pm
r9 r19 43 43 my $skip = $c->req->params->{skip} || 0; 44 44 45 $s->{messages} = [ $c->model('DBIC::Messages')->search({ to_user_id => $c->user->obj->id }, { rows => 50, offset => $skip }) ];45 $s->{messages} = $c->model('DBIC::Messages')->search({ to_user_id => $c->user->obj->id }, { rows => 50, offset => $skip }); 46 46 47 47 $s->{page_title} = 'Messages'; -
veekun/templates/dex/list/abilities.tt
r1 r19 5 5 <tr><th> [% Icons.rsefl %] </th><th> Name </th><th> Effect </th><th colspan="2"> Pokémon </th></tr> 6 6 [% color = 1 %] 7 [% FOREACH abil IN list%]7 [% WHILE (abil = list.next) %] 8 8 <tr class="color[% color %]"> 9 9 <td> [% abil.id %] </td> -
veekun/templates/dex/page/pokemon.tt
r1 r19 265 265 <p>Also remember that any gendered Pokémon can breed with <a href="[% dex_uri('pokemon', 'ditto') %]">Ditto</a>.</p> 266 266 <p>[ <a href="[% tmp = this.breed2 ? [ this.breed1, this.breed2 ] : this.breed1; c.uri('Dex::Search', 'pokemon_search', { breed_mode => 'or', breed => tmp, baseform => 'on' }) %]">baseform Pokémon that can breed with [% this.name %]</a> (equivalent to this list); <a href="[% c.uri('Dex::Search', 'pokemon_search', { breed_mode => 'or', breed => tmp }) %]">all Pokémon that can breed with [% this.name %]</a> ]</p> 267 [% FOR pokemon IN breedables%]267 [% WHILE (pokemon = breedables.next) %] 268 268 <a href="[% dex_uri('pokemon', PokemonNames.${pokemon.id}) %]" class="dex-pokelist[% pokemon.gender == 255 ? ' genderless' : '' %]"><img src="/dex-images/icons/[% pokemon.id.pad(3) %].png" alt="[% PokemonNames.${pokemon.id} %]" title="[% PokemonNames.${pokemon.id} %]"/></a> 269 269 [% END %] -
veekun/templates/dex/page/type.tt
r1 r19 58 58 <h1>Pokémon</h1> 59 59 <p><a href="[% c.uri('Dex::Search', 'pokemon_search', { view => 'icons', type_mode => 'any', type => this.name }) %]">This type in the Pokémon search</a></p> 60 [% FOREACH poke IN pokemon%]60 [% WHILE (poke = pokemon.next) %] 61 61 <a href="[% dex_uri('pokemon', poke.name) %]" class="[% IF poke.type2; 'type-'; IF poke.type1 == this.name; poke.type2; ELSE; poke.type1; END; ' '; END %]dex-pokelist"><img src="/dex-images/icons/[% poke.id.pad(3) %].png" alt="[% poke.name %]" title="[% poke.name %]: [% poke.type1 %][% '/' _ poke.type2 IF poke.type2 %]"/></a> 62 62 [% END %] -
veekun/templates/shoutbox.tt
r17 r19 12 12 [% can_ip = c.can_i('ip') %] 13 13 <table class="big shoutlist" cellspacing="0"> 14 [% FOREACH s IN shouts%]14 [% WHILE (s = shouts.next) %] 15 15 <tr> 16 16 <td class="center shout-time" title="[% time - s.time | timespan %] ago">[% s.time | date %]</td> -
veekun/templates/users/messages/list.tt
r9 r19 3 3 [% color = 1 %] 4 4 <table cellspacing="0"> 5 [% FOREACH message IN messages%]5 [% WHILE (message = messages.next) %] 6 6 <tr> 7 7 <td> [% message.sender %] </td> <td> [% message.subject %] </td> <td> [% message.time %] </td>
