Add pages for the Rainbow Pool pet states
This commit is contained in:
parent
6f45cd0485
commit
75040ffbf3
8 changed files with 73 additions and 7 deletions
5
app/assets/stylesheets/pet_states/show.sass
Normal file
5
app/assets/stylesheets/pet_states/show.sass
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
outfit-viewer
|
||||||
|
margin: 0 auto
|
||||||
|
|
||||||
|
dt
|
||||||
|
cursor: help
|
|
@ -11,10 +11,14 @@
|
||||||
width: 200px
|
width: 200px
|
||||||
max-width: calc(50% - .25em)
|
max-width: calc(50% - .25em)
|
||||||
min-width: 150px
|
min-width: 150px
|
||||||
padding: .5em
|
|
||||||
box-sizing: border-box
|
box-sizing: border-box
|
||||||
text-align: center
|
text-align: center
|
||||||
|
|
||||||
|
a
|
||||||
|
display: block
|
||||||
|
border-radius: 1em
|
||||||
|
padding: .5em
|
||||||
|
|
||||||
outfit-viewer
|
outfit-viewer
|
||||||
width: 100%
|
width: 100%
|
||||||
height: auto
|
height: auto
|
||||||
|
|
6
app/controllers/pet_states_controller.rb
Normal file
6
app/controllers/pet_states_controller.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class PetStatesController < ApplicationController
|
||||||
|
def show
|
||||||
|
@pet_type = PetType.matching_name_param(params[:pet_type_name]).first!
|
||||||
|
@pet_state = @pet_type.pet_states.find(params[:id])
|
||||||
|
end
|
||||||
|
end
|
|
@ -110,7 +110,7 @@ class PetState < ApplicationRecord
|
||||||
def swf_asset_ids=(ids)
|
def swf_asset_ids=(ids)
|
||||||
self['swf_asset_ids'] = ids
|
self['swf_asset_ids'] = ids
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_assets!
|
def handle_assets!
|
||||||
@parent_swf_asset_relationships_to_update.each do |rel|
|
@parent_swf_asset_relationships_to_update.each do |rel|
|
||||||
rel.swf_asset.save!
|
rel.swf_asset.save!
|
||||||
|
@ -118,6 +118,10 @@ class PetState < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_param
|
||||||
|
"#{id}-#{pose.split('_').map(&:capitalize).join('-')}"
|
||||||
|
end
|
||||||
|
|
||||||
def self.from_pet_type_and_biology_info(pet_type, info)
|
def self.from_pet_type_and_biology_info(pet_type, info)
|
||||||
swf_asset_ids = []
|
swf_asset_ids = []
|
||||||
info.each do |zone_id, asset_info|
|
info.each do |zone_id, asset_info|
|
||||||
|
|
|
@ -15,6 +15,10 @@ class PetType < ApplicationRecord
|
||||||
species = Species.find_by_name!(species_name)
|
species = Species.find_by_name!(species_name)
|
||||||
where(color_id: color.id, species_id: species.id)
|
where(color_id: color.id, species_id: species.id)
|
||||||
}
|
}
|
||||||
|
scope :matching_name_param, ->(name_param) {
|
||||||
|
color_name, _, species_name = name_param.rpartition("-")
|
||||||
|
matching_name(color_name, species_name)
|
||||||
|
}
|
||||||
scope :preferring_species, ->(species_id) {
|
scope :preferring_species, ->(species_id) {
|
||||||
joins(:species).order([Arel.sql("species_id = ? DESC"), species_id])
|
joins(:species).order([Arel.sql("species_id = ? DESC"), species_id])
|
||||||
}
|
}
|
||||||
|
@ -108,6 +112,10 @@ class PetType < ApplicationRecord
|
||||||
Item.appearances_for(item, self, ...)
|
Item.appearances_for(item, self, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_param
|
||||||
|
"#{color.human_name}-#{species.human_name}"
|
||||||
|
end
|
||||||
|
|
||||||
def self.all_by_ids_or_children(ids, pet_states)
|
def self.all_by_ids_or_children(ids, pet_states)
|
||||||
pet_states_by_pet_type_id = {}
|
pet_states_by_pet_type_id = {}
|
||||||
pet_states.each do |pet_state|
|
pet_states.each do |pet_state|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
%li
|
%li
|
||||||
= outfit_viewer pet_state:
|
= link_to [pet_state.pet_type, pet_state] do
|
||||||
%span.name= pose_name pet_state.pose
|
= outfit_viewer pet_state:
|
||||||
- if pet_state.glitched?
|
%span.name= pose_name pet_state.pose
|
||||||
%span.glitched{title: "Glitched"} 👾
|
- if pet_state.glitched?
|
||||||
|
%span.glitched{title: "Glitched"} 👾
|
||||||
|
|
36
app/views/pet_states/show.html.haml
Normal file
36
app/views/pet_states/show.html.haml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
- title "#{@pet_type.human_name}: #{pose_name @pet_state.pose} [\##{@pet_state.id}]"
|
||||||
|
- use_responsive_design
|
||||||
|
|
||||||
|
= outfit_viewer pet_state: @pet_state
|
||||||
|
|
||||||
|
%dl
|
||||||
|
%dt{title: "Pose usually affects just the eyes and mouth. Neopets " +
|
||||||
|
"genders these as Male/Female, but I don't like those " +
|
||||||
|
"terms for like… it's just eyelashes! Sheesh!"}
|
||||||
|
Pose
|
||||||
|
%dd
|
||||||
|
= pose_name @pet_state.pose
|
||||||
|
- if @pet_state.pose == "UNCONVERTED"
|
||||||
|
(Retired, replaced by #{link_to "Alt Styles", alt_styles_path})
|
||||||
|
|
||||||
|
%dt{title: "This is our own internal ID number, nothing to do with " +
|
||||||
|
"Neopets's official data."}
|
||||||
|
DTI ID
|
||||||
|
%dd= @pet_state.id
|
||||||
|
|
||||||
|
%dt{title: "When we notice a form looks wrong, we mark it Glitched, to " +
|
||||||
|
"tell our systems to prefer other forms for this pose instead."}
|
||||||
|
Glitched?
|
||||||
|
%dd
|
||||||
|
- if @pet_state.glitched?
|
||||||
|
👾 Yes, it's bad news bonko'd
|
||||||
|
- else
|
||||||
|
✅ Not marked as Glitched
|
||||||
|
|
||||||
|
- content_for :stylesheets do
|
||||||
|
= stylesheet_link_tag "application/hanger-spinner"
|
||||||
|
= stylesheet_link_tag "application/outfit-viewer"
|
||||||
|
= stylesheet_link_tag "pet_states/show"
|
||||||
|
|
||||||
|
- content_for :javascripts do
|
||||||
|
= javascript_include_tag "outfit-viewer", async: true
|
|
@ -37,7 +37,9 @@ OpenneoImpressItems::Application.routes.draw do
|
||||||
end
|
end
|
||||||
resources :alt_styles, path: 'alt-styles', only: [:index]
|
resources :alt_styles, path: 'alt-styles', only: [:index]
|
||||||
resources :swf_assets, path: 'swf-assets', only: [:show]
|
resources :swf_assets, path: 'swf-assets', only: [:show]
|
||||||
resources :pet_types, path: 'rainbow-pool', only: [:show], param: "name"
|
resources :pet_types, path: 'rainbow-pool', only: [:show], param: "name" do
|
||||||
|
resources :pet_states, only: [:show], path: "forms"
|
||||||
|
end
|
||||||
|
|
||||||
# Loading and modeling pets!
|
# Loading and modeling pets!
|
||||||
post '/pets/load' => 'pets#load', :as => :load_pet
|
post '/pets/load' => 'pets#load', :as => :load_pet
|
||||||
|
|
Loading…
Reference in a new issue