From 44a0c2e75ef577e6e847cbeb940ea936904c9d72 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 13 Oct 2017 10:01:44 -0400 Subject: Redesigned Pokémon show page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/helpers/pokeviewer/pokemon_helper.rb | 87 +++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) (limited to 'app/helpers') 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 tag.svg(svg.to_s.html_safe, viewBox: "-80 -30 570 430", - width: 300, + width: "100%", class: "pokemon-condition") end + def image_for_type(type) + image_tag "pokeviewer/types/#{type}.gif" + end + + def move_details(revision, index) + move = revision.send "move_#{index}".intern + + if move + move_name = move.name + move_type = image_for_type move.move_type + move_pp = revision.send "move_#{index}_pp".intern + move_pp = "#{move_pp}/#{move_pp}" + else + move_name = "-" + move_type = "" + move_pp = "--/--" + end + + tag.tr( + tag.th(move_type) + + tag.td(move_name)) + + tag.tr( + tag.th("") + + tag.td( + tag.div( + tag.span( + "PP", + class: 'pp-label') + + tag.span( + move_pp, + class: 'pp-value') + + tag.div( + "", + class: 'clear'), + class: 'tb-only'))) + end + + def display_met(pokemon) + met_type = pokemon.met_type + + if met_type == :normal or met_type == :hatched + result = "".html_safe + + if met_type == :normal + if pokemon.outsider? + result << "Apparently met" + else + result << "Met" + end + else + if pokemon.outsider? + result << "Apparently hatched" + else + result << "Hatched" + end + end + + result << " in " + + pokemon.location.name.split(" ").each_with_index do |w, i| + result << " ".html_safe if i > 0 + result << w + end + + result << " at Lv. ".html_safe + + if met_type == :hatched + result << "5" + else + result << pokemon.met_level.to_s + end + + result << "." + + result + elsif met_type == :npc_trade + "Met in a trade." + elsif met_type == :fateful_encounter + "Obtained in a fateful encounter at Lv. ".html_safe + + pokemon.met_level.to_s + elsif met_type == :orre + "Met in a trade." + end + end + end end -- cgit 1.4.1