root/veekun/trunk/templates/dex/search/pokemon.tt @ 406

Revision 406, 6.8 KB (checked in by eevee, 22 months ago)

Database refactoring. Renamed columns and tables to be more consistent and more readable. (#58)

Line 
1[% PROCESS 'common.tt' %]
2[% PROCESS 'dex/common.tt' %]
3
4[%# holy hard to read nesting batman! %]
5[% IF form.submitted %]
6<h1>Pok&eacute;mon Search Results</h1>
7[% simple_params = form.simplified_params; SET simple_params.skip = skip IF skip %]
8[% pagelist(c.req.params.skip, PAGESIZE, total, '/dex/pokemon/search', simple_params) %]
9<p class="permalink">[% c.uri('Dex::Search', 'pokemon_search', simple_params) %]</p>
10[%     IF results %]
11[%         SWITCH c.req.params.view %]
12[%         CASE 'icons' %]
13[%             FOREACH p IN results %]
14<a href="[% dex_uri('pokemon', PokemonNames.${p.id}) %]" class="dex-pokelist"><img src="/dex-images/icons/[% p.id.pad(3) %].png" alt="[% PokemonNames.${p.id} %]" title="[% PokemonNames.${p.id} %]"/></a>
15[%             END %]
16[%         CASE 'sprites' %]
17[%             FOREACH p IN results %]
18<a href="[% dex_uri('pokemon', PokemonNames.${p.id}) %]" class="dex-bigpokelist"><img src="/dex-images/dp/[% p.id.pad(3) %].png" alt="[% PokemonNames.${p.id} %]" title="[% PokemonNames.${p.id} %]"/><br/>[% PokemonNames.${p.id} %]</a>
19[%             END %]
20[%         CASE 'table' %]
21<form action="[% c.uri_for('/dex/pokemon/compare') %]" method="GET"/>
22<table class="dex-table dex-pokemon" cellspacing="0">
23<tr class="heading">
24    <th class="number"> </th>
25    <th class="number"> </th>
26    <th class="name"> Pok&eacute;mon </th>
27[%             pokemon_header %]
28</tr>
29[%             color = 1 %]
30[%             FOREACH p IN results %]
31<tr class="color[% color %]">
32    <td><input type="checkbox" name="poke" value="[% p.name %]"/></td>
33    <td class="right">[% p.id %]</td>
34    <td class="left"><a href="[% dex_uri('pokemon', PokemonNames.${p.id}) %]"><img src="/dex-images/icons/[% p.id.pad(3) %].png" alt=""/> [%+ PokemonNames.${p.id} %]</a></td>
35[%                 pokemon_cells(p) %]
36[%                 color = 3 - color %]
37</tr>
38[%             END %]
39</table>
40<p> <input type="submit" value="Compare selected Pok&eacute;mon"/> <input type="reset" value="Clear selection"/> </p>
41</form>
42[%         CASE %]
43<ul>
44[%             FOREACH p IN results %]
45<li><a href="[% dex_uri('pokemon', PokemonNames.${p.id}) %]"><img src="/dex-images/icons/[% p.id.pad(3) %].png" alt=""/> [% p.id %]: [% PokemonNames.${p.id} %]</a></li>
46[%             END %]
47</ul>
48[%         END %]
49[%     END %]
50<p class="total">[% total %] Pok&eacute;mon found.</p>
51[% END %]
52
53<h1>[% IF form.submitted %]Refine[% ELSE %]Define[% END %] Search</h1>
54<form action="" method="get">
55  <fieldset>
56  <legend>Basic</legend>
57    <p> Name contains: [%+ form.get_tag('name') %] </p>
58    <p> Color: [% form.get_tag('color') %] </p>
59    <p> Ability: [% form.get_tag('ability') %] </p>
60    <p> Habitat (not in D/P): [% form.get_tag('habitat') %] </p>
61  </fieldset>
62
63  <fieldset>
64  <legend>Evolution</legend>
65    <p> <label>[% form.get_tag('evo_stage', 'base')  %] Pok&eacute;mon is baseform -- either a baby or Stage 1</label> </p>
66    <p> <label>[% form.get_tag('evo_stage', 'final') %] Pok&eacute;mon is fully evolved</label> </p>
67  </fieldset>
68
69  <fieldset>
70  <legend>Breeding</legend>
71    <p> Gender distribution is [% form.get_tag('gender_rate') %] </p>
72    <p> Breeding groups include [% form.get_tag('breed_mode') %] [%+ form.get_tag('breed', 0) %] and [% form.get_tag('breed', 1) %] </p>
73  </fieldset>
74
75  <fieldset>
76  <legend>Generation</legend>
77  <div class="dex-basic-box">
78    <h2>First introduced</h2>
79[% FOREACH gen IN [ 0 .. Generations.max ] %]
80    <p> <label>[%+ form.get_tag('generation', gen) %] [%+ Icons.${Generations.$gen.abbr} %] [%+ Generations.$gen.games %]</label> </p>
81[% END %]
82  </div>
83  <div class="dex-basic-box">
84    <h2>In regional Pok&eacute;dex</h2>
85[% FOREACH gen IN [ 1 .. Generations.max ] %]
86    <p> <label>[%+ form.get_tag('basedex', gen) %] [%+ Icons.${Generations.$gen.abbr} %] [%+ Generations.$gen.games %]</label> </p>
87[% END %]
88  </div>
89  </fieldset>
90
91  <fieldset>
92  <legend>Types</legend>
93    <p> [% form.get_tag('type_mode') %] </p>
94[% USE typetable = Table(TypeNames, rows=6) %]
95    <table class="dex-typelist" cellspacing="0">
96[% FOREACH col IN typetable.cols %]
97    <tr>
98[%     FOREACH type IN col %]
99    <td> [% IF type %]<label>[%+ form.get_tag('type', type) %] [% type_name(type, nolink=1) %]</label>[% END %] </td>
100[%     END %]
101    </tr>
102[% END %]
103    </table>
104  </fieldset>
105
106  <fieldset>
107  <legend>Moves</legend>
108  <div class="dex-basic-box">
109    <h2>Learned Move</h2>
110[% FOREACH i IN [ 0 .. 3 ] %]
111    <p> [% form.get_tag('move', i) %] </p>
112[% END %]
113  </div>
114  <div class="dex-basic-box">
115    <h2>Methods</h2>
116    <p> <label>[% form.get_tag('move_method', 'egg') %] <img src="/dex-images/items/lucky-egg.png" alt=""/> Egg</label> </p>
117    <p> <label>[% form.get_tag('move_method', 'level') %] <img src="/dex-images/items/rare-candy.png" alt=""/> Level up</label> </p>
118    <p> <label>[% form.get_tag('move_method', 'machine') %] <img src="/dex-images/items/tm-normal.png" alt=""/> TM/HM</label> </p>
119    <p> <label>[% form.get_tag('move_method', 'tutor') %] <img src="/dex-images/items/teach-tv.png" alt=""/> Tutor</label> </p>
120  </div>
121  <div class="dex-basic-box">
122    <h2>Versions</h2>
123    <p> [% form.get_tag('move_version') %] </p>
124  </div>
125  </fieldset>
126
127  <fieldset>
128  <legend>Numbers</legend>
129  <p>Values are inclusive.  You may omit either lower or higher bounds to specify only a maximum or only a minimum.</p>
130  <div class="dex-basic-box">
131    <h2>Base Stats</h2>
132    <table>
133[% FOREACH stat IN [ 0 .. StatColumns.max ] %]
134    <tr><td>[% StatShortNames.$stat %]:</td><td>[% form.get_tag("${StatColumns.$stat}_lb") %] to [% form.get_tag("${StatColumns.$stat}_ub") %]</td></tr>
135[% END %]
136    </table>
137  </div>
138  <div class="dex-basic-box">
139    <h2>Effort Given</h2>
140    <table>
141[% FOREACH stat IN [ 0 .. StatColumns.max ] %]
142    <tr><td>[% StatShortNames.$stat %]:</td><td>[% form.get_tag("${StatColumns.$stat}_effort_lb") %] to [% form.get_tag("${StatColumns.$stat}_effort_ub") %]</td></tr>
143[% END %]
144    </table>
145  </div>
146  <div class="dex-basic-box">
147    <h2>Misc</h2>
148    <table>
149[% FOREACH nonstat IN [ 'height', 'weight' ] %]
150    <tr><td>[% nonstat | ucfirst %]:</td><td>[% form.get_tag("${nonstat}_lb") %] to [% form.get_tag("${nonstat}_ub") %]</td></tr>
151[% END %]
152    </table>
153  </div>
154  </fieldset>
155
156<hr/>
157  <p> Display results as [% form.get_tag('view') %] </p>
158  <p> Sort by [% form.get_tag('sort') %]; [% form.get_tag('sort_desc') %] reverse order </p>
159  <p> <input type="submit" value="Search"/> <input type="reset" value="Reset form"/> </p>
160</form>
161
162[% IF c.debug %]
163[%     USE Dumper %]
164<h1>Debug</h1>
165<pre>[% Dumper.dump(c.req.params) %]</pre>
166<hr/>
167<pre>[% Dumper.dump(form.simplified_params) %]</pre>
168<hr/>
169<pre>[% Dumper.dump(form.controls) %]</pre>
170<hr/>
171<pre>[% FOREACH k IN form.controls.keys; k; ":\n"; Dumper.dump(before.$k, c.req.params.$k); "\n"; END %]</pre>
172<hr/>
173<pre>[% Dumper.dump(criteria) %]</pre>
174<hr/>
175<pre>[% sql %]</pre>
176[% END %]
Note: See TracBrowser for help on using the browser.