diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-10-13 10:01:44 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-10-13 10:01:44 -0400 |
commit | 44a0c2e75ef577e6e847cbeb940ea936904c9d72 (patch) | |
tree | 2682fe4e131f567c2ff7e2c6f229a3fe9e6d0e6c /app/helpers | |
parent | 5eab020d3db17c08050e751c155f266dd0a87c4d (diff) | |
download | pokeviewer-44a0c2e75ef577e6e847cbeb940ea936904c9d72.tar.gz pokeviewer-44a0c2e75ef577e6e847cbeb940ea936904c9d72.tar.bz2 pokeviewer-44a0c2e75ef577e6e847cbeb940ea936904c9d72.zip |
Redesigned Pokémon show page
The new design is heavily inspired by the status screen from Diamond & Pearl. It's not entirely done yet, with notable missing features including sheen and gender. However, it would also be nice to show a star for shiny Pokémon, Pokérus status, possibly a mention as to what game the Pokémon is currently in, and descriptive hover bubbles for moves. It is also notable that currently, as ribbons are located all the way to the right, their hover bubbles usually go off screen. The list of Pokémon page has not been redesigned, and the main layout is still bare.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/pokeviewer/pokemon_helper.rb | 87 |
1 files changed, 86 insertions, 1 deletions
diff --git a/app/helpers/pokeviewer/pokemon_helper.rb b/app/helpers/pokeviewer/pokemon_helper.rb index f29fc35..9524914 100644 --- a/app/helpers/pokeviewer/pokemon_helper.rb +++ b/app/helpers/pokeviewer/pokemon_helper.rb | |||
@@ -83,9 +83,94 @@ module Pokeviewer | |||
83 | 83 | ||
84 | tag.svg(svg.to_s.html_safe, | 84 | tag.svg(svg.to_s.html_safe, |
85 | viewBox: "-80 -30 570 430", | 85 | viewBox: "-80 -30 570 430", |
86 | width: 300, | 86 | width: "100%", |
87 | class: "pokemon-condition") | 87 | class: "pokemon-condition") |
88 | end | 88 | end |
89 | 89 | ||
90 | def image_for_type(type) | ||
91 | image_tag "pokeviewer/types/#{type}.gif" | ||
92 | end | ||
93 | |||
94 | def move_details(revision, index) | ||
95 | move = revision.send "move_#{index}".intern | ||
96 | |||
97 | if move | ||
98 | move_name = move.name | ||
99 | move_type = image_for_type move.move_type | ||
100 | move_pp = revision.send "move_#{index}_pp".intern | ||
101 | move_pp = "#{move_pp}/#{move_pp}" | ||
102 | else | ||
103 | move_name = "-" | ||
104 | move_type = "" | ||
105 | move_pp = "--/--" | ||
106 | end | ||
107 | |||
108 | tag.tr( | ||
109 | tag.th(move_type) + | ||
110 | tag.td(move_name)) + | ||
111 | tag.tr( | ||
112 | tag.th("") + | ||
113 | tag.td( | ||
114 | tag.div( | ||
115 | tag.span( | ||
116 | "PP", | ||
117 | class: 'pp-label') + | ||
118 | tag.span( | ||
119 | move_pp, | ||
120 | class: 'pp-value') + | ||
121 | tag.div( | ||
122 | "", | ||
123 | class: 'clear'), | ||
124 | class: 'tb-only'))) | ||
125 | end | ||
126 | |||
127 | def display_met(pokemon) | ||
128 | met_type = pokemon.met_type | ||
129 | |||
130 | if met_type == :normal or met_type == :hatched | ||
131 | result = "".html_safe | ||
132 | |||
133 | if met_type == :normal | ||
134 | if pokemon.outsider? | ||
135 | result << "Apparently met" | ||
136 | else | ||
137 | result << "Met" | ||
138 | end | ||
139 | else | ||
140 | if pokemon.outsider? | ||
141 | result << "Apparently hatched" | ||
142 | else | ||
143 | result << "Hatched" | ||
144 | end | ||
145 | end | ||
146 | |||
147 | result << " in " | ||
148 | |||
149 | pokemon.location.name.split(" ").each_with_index do |w, i| | ||
150 | result << " ".html_safe if i > 0 | ||
151 | result << w | ||
152 | end | ||
153 | |||
154 | result << " at Lv. ".html_safe | ||
155 | |||
156 | if met_type == :hatched | ||
157 | result << "5" | ||
158 | else | ||
159 | result << pokemon.met_level.to_s | ||
160 | end | ||
161 | |||
162 | result << "." | ||
163 | |||
164 | result | ||
165 | elsif met_type == :npc_trade | ||
166 | "Met in a trade." | ||
167 | elsif met_type == :fateful_encounter | ||
168 | "Obtained in a fateful encounter at Lv. ".html_safe + | ||
169 | pokemon.met_level.to_s | ||
170 | elsif met_type == :orre | ||
171 | "Met in a trade." | ||
172 | end | ||
173 | end | ||
174 | |||
90 | end | 175 | end |
91 | end | 176 | end |