Add link to reference pet type when labeling pet appearances
Sometimes I forget like, what the masc/fem variants of a given pet actually look like? Some are super obvious about things like eyelashes, and others use more subtle eye differences. This is a cheap lil hack to make it easier to open a reference! Ideally I think it would be neat to like, when you hover over an option, have it show you the reference variant of that pose? But this is good enough I think!
This commit is contained in:
parent
6dc5aa28a4
commit
407c4b38a5
4 changed files with 20 additions and 0 deletions
|
@ -3,3 +3,13 @@ outfit-viewer
|
|||
|
||||
.fields li[data-type=radio-grid]
|
||||
--num-columns: 3
|
||||
|
||||
.reference-link
|
||||
display: flex
|
||||
align-items: center
|
||||
gap: .5em
|
||||
padding-inline: .5em
|
||||
|
||||
img
|
||||
height: 2em
|
||||
width: auto
|
||||
|
|
|
@ -19,6 +19,7 @@ class PetStatesController < ApplicationController
|
|||
def find_pet_state
|
||||
@pet_type = PetType.find_by_param!(params[:pet_type_name])
|
||||
@pet_state = @pet_type.pet_states.find(params[:id])
|
||||
@reference_pet_type = @pet_type.reference
|
||||
end
|
||||
|
||||
def pet_state_params
|
||||
|
|
|
@ -137,6 +137,10 @@ class PetType < ApplicationRecord
|
|||
pet_states.count { |ps| ps.pose == "UNKNOWN" }
|
||||
end
|
||||
|
||||
def reference
|
||||
PetType.where(species_id: species).basic.merge(Color.alphabetical).first
|
||||
end
|
||||
|
||||
def self.find_by_param!(param)
|
||||
raise ActiveRecord::RecordNotFound unless param.include?("-")
|
||||
color_param, _, species_param = param.rpartition("-")
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
= f.radio_field do
|
||||
= f.radio_button :pose, pose
|
||||
= pose_name(pose)
|
||||
- if @reference_pet_type
|
||||
= link_to @reference_pet_type, target: "_blank", class: "reference-link" do
|
||||
= pet_type_image @reference_pet_type, :happy, :face
|
||||
%span Reference: #{@reference_pet_type.human_name}
|
||||
= external_link_icon
|
||||
|
||||
= f.field do
|
||||
= f.label :glitched, "Gliched?"
|
||||
|
|
Loading…
Reference in a new issue