Compare commits
No commits in common. "a184c7557584e103e80876bad67e9d6f95f9aa2b" and "36f8efadbff571f99371f372b96f023dd221913c" have entirely different histories.
a184c75575
...
36f8efadbf
4 changed files with 0 additions and 67 deletions
|
@ -1,21 +0,0 @@
|
||||||
// When the species *face* picker changes, update and submit the main picker form.
|
|
||||||
document.addEventListener("click", (e) => {
|
|
||||||
if (!e.target.matches(".species-face-picker input[type=radio]")) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const mainPicker = document.querySelector("#item-preview .species-color-picker");
|
|
||||||
const mainSpeciesField =
|
|
||||||
mainPicker.querySelector("[name='preview[species_id]']");
|
|
||||||
mainSpeciesField.value = e.target.value;
|
|
||||||
mainPicker.requestSubmit(); // `submit` doesn't get captured by Turbo!
|
|
||||||
} catch (error) {
|
|
||||||
e.preventDefault();
|
|
||||||
console.error("Couldn't update species picker: ", error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Now that the face picker is ready to go, mark it as usable.
|
|
||||||
for (const options of document.querySelectorAll(".species-face-picker-options")) {
|
|
||||||
options.removeAttribute("inert");
|
|
||||||
options.removeAttribute("aria-hidden");
|
|
||||||
}
|
|
|
@ -161,34 +161,6 @@ body.items-show
|
||||||
border-color: $error-border-color
|
border-color: $error-border-color
|
||||||
color: $error-color
|
color: $error-color
|
||||||
|
|
||||||
.species-face-picker
|
|
||||||
position: relative
|
|
||||||
|
|
||||||
input[type=radio]
|
|
||||||
position: absolute
|
|
||||||
left: -10000px
|
|
||||||
top: auto
|
|
||||||
width: 1px
|
|
||||||
height: 1px
|
|
||||||
overflow: hidden
|
|
||||||
|
|
||||||
&:not(:checked) + img
|
|
||||||
opacity: .5
|
|
||||||
|
|
||||||
noscript
|
|
||||||
position: absolute
|
|
||||||
inset: 0
|
|
||||||
background: rgba(white, .75)
|
|
||||||
z-index: 1
|
|
||||||
|
|
||||||
display: flex
|
|
||||||
align-items: center
|
|
||||||
justify-content: center
|
|
||||||
text-align: center
|
|
||||||
|
|
||||||
&:has(.species-face-picker-options[inert])
|
|
||||||
cursor: wait
|
|
||||||
|
|
||||||
.item-zones-info
|
.item-zones-info
|
||||||
margin-top: .5em
|
margin-top: .5em
|
||||||
|
|
||||||
|
|
|
@ -93,9 +93,6 @@ class ItemsController < ApplicationController
|
||||||
@all_appearances = @item.appearances
|
@all_appearances = @item.appearances
|
||||||
@appearances_by_occupied_zone = @item.appearances_by_occupied_zone.
|
@appearances_by_occupied_zone = @item.appearances_by_occupied_zone.
|
||||||
sort_by { |z, a| z.label }
|
sort_by { |z, a| z.label }
|
||||||
|
|
||||||
@preview_pet_type_options = PetType.where(color: @preview_outfit.color).
|
|
||||||
joins(:species).merge(Species.alphabetical)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
format.gif do
|
format.gif do
|
||||||
|
|
|
@ -33,20 +33,6 @@
|
||||||
"id", "human_name", @selected_preview_pet_type.species_id)
|
"id", "human_name", @selected_preview_pet_type.species_id)
|
||||||
= submit_tag "Go", name: nil
|
= submit_tag "Go", name: nil
|
||||||
|
|
||||||
%form.species-face-picker
|
|
||||||
%noscript
|
|
||||||
This fancy species picker requires Javascript, but you can still use the
|
|
||||||
dropdowns instead!
|
|
||||||
.species-face-picker-options{
|
|
||||||
"inert": true, # waits for JS to remove
|
|
||||||
"aria-hidden": true, # waits for JS to remove
|
|
||||||
}
|
|
||||||
- @preview_pet_type_options.each do |pet_type|
|
|
||||||
%label
|
|
||||||
= radio_button_tag "species_face_id", pet_type.species_id,
|
|
||||||
checked: pet_type == @preview_outfit.pet_type
|
|
||||||
= pet_type_image pet_type, :happy, :face
|
|
||||||
|
|
||||||
.item-zones-info
|
.item-zones-info
|
||||||
%section
|
%section
|
||||||
%h3 Occupies
|
%h3 Occupies
|
||||||
|
@ -86,4 +72,3 @@
|
||||||
- content_for :javascripts do
|
- content_for :javascripts do
|
||||||
= javascript_include_tag "lib/idiomorph", async: true
|
= javascript_include_tag "lib/idiomorph", async: true
|
||||||
= javascript_include_tag "outfit-viewer", async: true
|
= javascript_include_tag "outfit-viewer", async: true
|
||||||
= javascript_include_tag "items/show", async: true
|
|
||||||
|
|
Loading…
Reference in a new issue