Changeset 234
- Timestamp:
- 06/12/07 01:44:47 (3 years ago)
- Location:
- veekun/trunk
- Files:
-
- 7 modified
-
lib/Vee/Controller/Dex.pm (modified) (6 diffs)
-
templates/dex/page/ability.tt (modified) (1 diff)
-
templates/dex/page/item.tt (modified) (1 diff)
-
templates/dex/page/move.tt (modified) (1 diff)
-
templates/dex/page/pokemon.tt (modified) (1 diff)
-
templates/dex/page/pokemon/flavor.tt (modified) (1 diff)
-
templates/wrapper.tt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
veekun/trunk/lib/Vee/Controller/Dex.pm
r232 r234 274 274 '<a href="' . $c->uri('Dex') . '">Pokédex</a>', 275 275 '<a href="' . $c->uri('Dex', 'ability_list') . '">Abilities</a>', 276 $row->name, 276 277 ]; 278 279 add_rel_links( 280 $c, 281 ($row->id - 2) % $#AbilityNames + 1, 282 ($row->id + 0) % $#AbilityNames + 1, 283 sub { { 284 id => $_[0], 285 title => $AbilityNames[ $_[0] ], 286 url => $c->uri('Dex', 'abilities', lc $AbilityNames[ $_[0] ]), 287 } } 288 ); 277 289 278 290 $s->{template} = 'dex/page/ability.tt'; … … 405 417 ]; 406 418 419 add_rel_links( 420 $c, 421 ($row->id - 2) % $Generations[-1]{maxid} + 1, 422 ($row->id + 0) % $Generations[-1]{maxid} + 1, 423 sub { { 424 id => $_[0], 425 title => $PokemonNames[ $_[0] ], 426 url => $c->uri('Dex', 'pokemon', lc $PokemonNames[ $_[0] ]), 427 } } 428 ); 429 407 430 $s->{template} = 'dex/page/pokemon.tt'; 408 431 $c->forward('/cache', [ $row->id ]); … … 742 765 ]; 743 766 767 add_rel_links( 768 $c, 769 ($row->id - 2) % $Generations[-1]{maxid} + 1, 770 ($row->id + 0) % $Generations[-1]{maxid} + 1, 771 sub { { 772 id => $_[0], 773 title => $PokemonNames[ $_[0] ], 774 url => $c->uri('Dex', 'pokemon', lc $PokemonNames[ $_[0] ]) . '/flavor', 775 } } 776 ); 777 744 778 $s->{template} = 'dex/page/pokemon/flavor.tt'; 745 779 } … … 815 849 $row->name, 816 850 ]; 851 852 add_rel_links( 853 $c, 854 ($row->id - 2) % $#MoveData + 1, 855 ($row->id + 0) % $#MoveData + 1, 856 sub { { 857 id => $_[0], 858 title => $MoveData[ $_[0] ]->name, 859 url => $c->uri('Dex', 'abilities', lc $MoveData[ $_[0] ]->name), 860 } } 861 ); 817 862 818 863 $s->{template} = 'dex/page/move.tt'; … … 1071 1116 ]; 1072 1117 1118 add_rel_links( 1119 $c, 1120 ($row->id - 2) % $#ItemNames + 1, 1121 ($row->id + 0) % $#ItemNames + 1, 1122 sub { { 1123 id => $_[0], 1124 title => $ItemNames[ $_[0] ], 1125 url => $c->uri('Dex', 'items', lc $ItemNames[ $_[0] ]), 1126 } } 1127 ); 1128 1073 1129 $s->{template} = 'dex/page/item.tt'; 1074 1130 # $c->forward('/cache'); -- TODO: necessary? … … 1174 1230 $rs = $rs->search({ alt_form => $alt_form }) if $alt_form; 1175 1231 return $rs->single; 1232 } 1233 1234 ################################################################################ 1235 1236 =head2 add_rel_links 1237 1238 Adds <link> tag information to the stash. 1239 1240 TODO: Move this out of here into something more generic, link it up with the 1241 breadcrumbs somehow, generally clean it up, refactor it for dex pages since 1242 they end up having largely the same code everywhere. 1243 1244 =cut 1245 1246 sub add_rel_links { 1247 my ($c, $prev, $next, $generator) = @_; 1248 my $s = $c->stash; 1249 1250 $s->{nav_start} = $generator->(1); 1251 $s->{nav_prev} = $generator->($prev) if defined $prev; 1252 $s->{nav_next} = $generator->($next) if defined $next; 1176 1253 } 1177 1254 -
veekun/trunk/templates/dex/page/ability.tt
r158 r234 1 1 [% PROCESS 'dex/common.tt' %] 2 2 3 [% nextid = this.id % AbilityNames.max + 1; previd = (this.id - 2) % AbilityNames.max + 1 -%]4 5 3 <p class="dex-navigation"> 6 <a href="[% dex_uri('abilities', AbilityNames.$nextid) %]" class="next blocklink"> Next: #[% nextid %]<br/>[% AbilityNames.$nextid%] </a>7 <a href="[% dex_uri('abilities', AbilityNames.$previd) %]" class="prev blocklink"> Prev: #[% previd %]<br/>[% AbilityNames.$previd%] </a>4 <a href="[% nav_next.url %]" class="next blocklink"> Next: #[% nav_next.id %]<br/>[% nav_next.title %] </a> 5 <a href="[% nav_prev.url %]" class="prev blocklink"> Prev: #[% nav_prev.id %]<br/>[% nav_prev.title %] </a> 8 6 [% this.id %]<br/>[% this.name %] 9 7 </p> -
veekun/trunk/templates/dex/page/item.tt
r222 r234 1 1 [% PROCESS 'dex/common.tt' %] 2 2 3 [% nextid = this.id % ItemNames.max + 1; previd = (this.id - 2) % ItemNames.max + 1 -%]4 5 3 <p class="dex-navigation"> 6 <a href="[% dex_uri('items', ItemNames.$nextid) %]" class="next blocklink"> [% item_sprite(ItemNames.$nextid) %] Next:<br/>[% ItemNames.$nextid%] </a>7 <a href="[% dex_uri('items', ItemNames.$previd) %]" class="prev blocklink"> [% item_sprite(ItemNames.$previd) %] Prev:<br/>[% ItemNames.$previd%] </a>4 <a href="[% nav_next.url %]" class="next blocklink"> [% item_sprite(nav_next.title) %] Next:<br/>[% nav_next.title %] </a> 5 <a href="[% nav_prev.url %]" class="prev blocklink"> [% item_sprite(nav_prev.title) %] Prev:<br/>[% nav_prev.title %] </a> 8 6 [% item_sprite(this.name) %]<br/>[% this.display_name %] 9 7 </p> -
veekun/trunk/templates/dex/page/move.tt
r195 r234 1 1 [% PROCESS 'dex/common.tt' %] 2 2 3 [% BLOCK tm_blurb %]x[% END %]4 5 [% nextid = this.id % MoveData.max + 1; previd = (this.id - 2) % MoveData.max + 1 -%]6 7 3 <p class="dex-navigation"> 8 <a href="[% dex_uri('moves', MoveData.$nextid.name) %]" class="next blocklink"> Next: #[% nextid %]<br/>[% MoveData.$nextid.name %] </a>9 <a href="[% dex_uri('moves', MoveData.$previd.name) %]" class="prev blocklink"> Prev: #[% previd %]<br/>[% MoveData.$previd.name %] </a>4 <a href="[% nav_next.url %]" class="next blocklink"> Next: #[% nav_next.id %]<br/>[% nav_next.title %] </a> 5 <a href="[% nav_prev.url %]" class="prev blocklink"> Prev: #[% nav_prev.id %]<br/>[% nav_prev.title %] </a> 10 6 [% this.id %]<br/>[% this.name %] 11 7 </p> -
veekun/trunk/templates/dex/page/pokemon.tt
r231 r234 3 3 [% image_name = this.real_id.pad(3); SET image_name = image_name _ '-' _ this.alt_form IF this.id != this.real_id %] 4 4 5 [% nextid = this.real_id % Generations.-1.maxid + 1; previd = (this.real_id - 2) % Generations.-1.maxid + 1 -%]6 [% nav_next = dex_uri('pokemon', PokemonNames.$nextid) %]7 [% nav_prev = dex_uri('pokemon', PokemonNames.$previd) %]8 9 5 <p class="dex-navigation"> 10 <a href="[% dex_uri('pokemon', PokemonNames.$nextid) %]" class="next blocklink"> <img src="/dex-images/icons/[% nextid.pad(3) %].png" alt=""/> Next: #[% nextid %]<br/>[% PokemonNames.$nextid%] </a>11 <a href="[% dex_uri('pokemon', PokemonNames.$previd) %]" class="prev blocklink"> <img src="/dex-images/icons/[% previd.pad(3) %].png" alt=""/> Previous: #[% previd %]<br/>[% PokemonNames.$previd%] </a>6 <a href="[% nav_next.url %]" class="next blocklink"> <img src="/dex-images/icons/[% nav_next.id.pad(3) %].png" alt=""/> Next: #[% nav_next.id %]<br/>[% nav_next.title %] </a> 7 <a href="[% nav_prev.url %]" class="prev blocklink"> <img src="/dex-images/icons/[% nav_prev.id.pad(3) %].png" alt=""/> Previous: #[% nav_prev.id %]<br/>[% nav_prev.title %] </a> 12 8 <img src="/dex-images/icons/ani/[% image_name %].gif" alt=""/><br/>[% this.name %] 13 9 </p> -
veekun/trunk/templates/dex/page/pokemon/flavor.tt
r231 r234 2 2 3 3 [% nextid = this.id % Generations.-1.maxid + 1; previd = (this.id - 2) % Generations.-1.maxid + 1 -%] 4 [% nav_next = dex_uri('pokemon', PokemonNames.$nextid) _ '/flavor'%]5 [% nav_prev = dex_uri('pokemon', PokemonNames.$previd) _ '/flavor'%]4 [% nav_next = { title => PokemonNames.$nextid, url => dex_uri('pokemon', PokemonNames.$nextid) _ '/flavor' } %] 5 [% nav_prev = { title => PokemonNames.$previd, url => dex_uri('pokemon', PokemonNames.$previd) _ '/flavor' } %] 6 6 7 7 <p class="dex-navigation"> 8 <a href="[% nav_next %]" class="next blocklink"> <img src="/dex-images/icons/[% nextid.pad(3) %].png" alt=""/> Next: #[% nextid %]<br/>[% PokemonNames.$nextid%] </a>9 <a href="[% nav_prev %]" class="prev blocklink"> <img src="/dex-images/icons/[% previd.pad(3) %].png" alt=""/> Previous: #[% previd %]<br/>[% PokemonNames.$previd%] </a>8 <a href="[% nav_next.url %]" class="next blocklink"> <img src="/dex-images/icons/[% nav_next.id.pad(3) %].png" alt=""/> Next: #[% nav_next.id %]<br/>[% nav_next.title %] </a> 9 <a href="[% nav_prev.url %]" class="prev blocklink"> <img src="/dex-images/icons/[% nav_prev.id.pad(3) %].png" alt=""/> Previous: #[% nav_prev.id %]<br/>[% nav_prev.title %] </a> 10 10 <img src="/dex-images/icons/ani/[% this.id.pad(3) %].gif" alt=""/><br/>[% this.name %] 11 11 </p> -
veekun/trunk/templates/wrapper.tt
r228 r234 21 21 [% extra_headers.join("\n") %] 22 22 <link rel="search" type="application/opensearchdescription+xml" title="Veekun Pokédex" href="/files/mozsearch.pokedex.xml"/> 23 <link rel="top" href="/" title="[% c.site_opts.site_title %]"/> 24 [% IF crumbs AND crumbs.size > 1 %] 25 [% # XXX: AWFUL HACK ALERT %] 26 <link rel="up" href="[% crumbs.-2.match('href="(.+?)"').0 %]" title="[% crumbs.-2.match('>(.+)<').0 %]"/> 27 [% END %] 28 [% FOR dir IN ['next','prev','start'] %] 29 [% var = "nav_$dir" %] 30 [% IF $var %] 31 <link rel="[% dir %]" href="[% $var.url %]" title="[% $var.title %]"/> 32 [% END %] 33 [% END %] 23 34 <script type="text/javascript" src="/script/jquery.js"></script> 24 35 <script type="text/javascript" src="/script/dexsuggest.js"></script>
