From 7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Jan 2018 16:01:51 -0500 Subject: Moved species from Pokémon to revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The migration will set all of the revisions of each Pokémon to have the species that that Pokémon was set to. If reversed, the migration sets the Pokémon's species to the first revision's species, which mimics the behavior of the engine from before this change, but do note that running the migration backwards like this can lose data. This change slightly affects the loading time of the front page. See #2. refs #3 --- app/views/pokeviewer/pokemon/index.html.haml | 12 +++---- app/views/pokeviewer/pokemon/show.html.haml | 54 ++++++++++++++-------------- 2 files changed, 33 insertions(+), 33 deletions(-) (limited to 'app/views') diff --git a/app/views/pokeviewer/pokemon/index.html.haml b/app/views/pokeviewer/pokemon/index.html.haml index e1793dc..67ea2cf 100644 --- a/app/views/pokeviewer/pokemon/index.html.haml +++ b/app/views/pokeviewer/pokemon/index.html.haml @@ -8,8 +8,8 @@ %h3 Party - party.each do |p| %li - %span.party-icon= image_tag p.icon_path - %span.party-name= link_to p.nickname, p + %span.party-icon= image_tag p.current.icon_path + %span.party-name= link_to p.current.nickname, p - boxes.each do |box| .pc-box %h3= box[:name] @@ -21,9 +21,9 @@ - if p.nil? .spacer - else - = link_to image_tag(p.icon_path), p + = link_to image_tag(p.current.icon_path), p .pc-data.pkv-hover - .pc-data-name= p.nickname + .pc-data-name= p.current.nickname .pc-data-ot OT/ %span{ class: p.ot_gender }>= p.ot_name @@ -34,9 +34,9 @@ %ul.pokemon-list - @unaccounted.each do |p| %li.pc-pokemon.pkv-has-hover - = link_to image_tag(p.icon_path), p + = link_to image_tag(p.current.icon_path), p .pc-data.pkv-hover - .pc-data-name= p.nickname + .pc-data-name= p.current.nickname .pc-data-ot OT/ %span{ class: p.ot_gender }>= p.ot_name diff --git a/app/views/pokeviewer/pokemon/show.html.haml b/app/views/pokeviewer/pokemon/show.html.haml index 0daabb0..3f2750c 100644 --- a/app/views/pokeviewer/pokemon/show.html.haml +++ b/app/views/pokeviewer/pokemon/show.html.haml @@ -2,44 +2,44 @@ .pokemon-basics .pokemon-nameline = image_tag(@pokemon.pokeball_icon_path, class: "pokemon-ball") - %span.pokemon-name= @pokemon.revisions.last.nickname + %span.pokemon-name= @pokemon.current.nickname %span.pokemon-gender{ class: @pokemon.gender }= @pokemon.gender_symbol - .pokemon-level= "Lv. #{@pokemon.revisions.last.level}" + .pokemon-level= "Lv. #{@pokemon.current.level}" .pokemon-image .pokemon-image-wrap - = image_tag @pokemon.sprite_path, class: "pokemon-sprite" + = image_tag @pokemon.current.sprite_path, class: "pokemon-sprite" - if @pokemon.shiny? = image_tag "pokeviewer/ShinyIVStar.png", class: "pkv-shiny-star" - - if @pokemon.revisions.last.item.nil? + - if @pokemon.current.item.nil? .pokemon-item-label Item .pokemon-item None - else .pokemon-item-label.with-item Item .pokemon-item.pkv-has-hover - = image_tag(@pokemon.revisions.last.item.icon_path) - = @pokemon.revisions.last.item.name + = image_tag(@pokemon.current.item.icon_path) + = @pokemon.current.item.name .pkv-hover - .pc-data-name= @pokemon.revisions.last.item.name - - if @pokemon.revisions.last.item.tm? - .pc-move-name= @pokemon.revisions.last.item.move.name - = @pokemon.revisions.last.item.description(@pokemon.trainer.game) + .pc-data-name= @pokemon.current.item.name + - if @pokemon.current.item.tm? + .pc-move-name= @pokemon.current.item.move.name + = @pokemon.current.item.description(@pokemon.trainer.game) .pokemon-tab.pokemon-details %table %tr %th Pokédex No. %td - .table-bubble.tb-top= @pokemon.species_id + .table-bubble.tb-top= @pokemon.current.species_id %tr %th Name %td - .table-bubble= @pokemon.species.name + .table-bubble= @pokemon.current.species.name %tr %th Type %td .table-bubble - = image_for_type @pokemon.species.type_1 - - if @pokemon.species.type_2 - = image_for_type @pokemon.species.type_2 + = image_for_type @pokemon.current.species.type_1 + - if @pokemon.current.species.type_2 + = image_for_type @pokemon.current.species.type_2 %tr %th OT %td.ot-gender{ class: @pokemon.ot_gender } @@ -58,7 +58,7 @@ %tr %th HP %td - .table-bubble.tb-top= @pokemon.revisions.last.hp + .table-bubble.tb-top= @pokemon.current.hp %tr %th Attack @@ -67,7 +67,7 @@ - if @pokemon.nature_hinders?(:attack) %span.nature-hinder - %td - .table-bubble= @pokemon.revisions.last.attack + .table-bubble= @pokemon.current.attack %tr %th Defense @@ -76,7 +76,7 @@ - if @pokemon.nature_hinders?(:defense) %span.nature-hinder - %td - .table-bubble= @pokemon.revisions.last.defense + .table-bubble= @pokemon.current.defense %tr %th Sp. Atk @@ -85,7 +85,7 @@ - if @pokemon.nature_hinders?(:special_attack) %span.nature-hinder - %td - .table-bubble= @pokemon.revisions.last.special_attack + .table-bubble= @pokemon.current.special_attack %tr %th Sp. Def @@ -94,7 +94,7 @@ - if @pokemon.nature_hinders?(:special_defense) %span.nature-hinder - %td - .table-bubble= @pokemon.revisions.last.special_defense + .table-bubble= @pokemon.current.special_defense %tr %th Speed @@ -103,7 +103,7 @@ - if @pokemon.nature_hinders?(:speed) %span.nature-hinder - %td - .table-bubble.tb-bottom= @pokemon.revisions.last.speed + .table-bubble.tb-bottom= @pokemon.current.speed %tr.pokemon-nature-label %th{ colspan: 2 } Nature %tr @@ -116,18 +116,18 @@ %th %td .tb-only.pkv-has-hover - = @pokemon.ability.name + = @pokemon.current.ability.name .pkv-hover - .pc-data-name= @pokemon.ability.name - = @pokemon.ability.description + .pc-data-name= @pokemon.current.ability.name + = @pokemon.current.ability.description .pokemon-tab.pokemon-moves %table - (1..4).each do |i| - = move_details @pokemon.revisions.last, i - .pokemon-tab.pokemon-contest= condition_diagram @pokemon.revisions.last + = move_details @pokemon.current, i + .pokemon-tab.pokemon-contest= condition_diagram @pokemon.current .pokemon-tab.pokemon-ribbons %ul - - @pokemon.revisions.last.ribbons.each do |ribbon| + - @pokemon.current.ribbons.each do |ribbon| %li.pkv-has-hover = image_tag("pokeviewer/ribbons/#{ribbon[:filename]}") .pkv-hover -- cgit 1.4.1