Compare commits
No commits in common. "27774d908f862f69ff3cef79e528935082207dd7" and "5f2c45442398e22dff95ed5d88b9f75e4b19b36d" have entirely different histories.
27774d908f
...
5f2c454423
2 changed files with 11 additions and 23 deletions
|
@ -4,11 +4,9 @@ document.addEventListener("change", (e) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const mainPickerForm = document.querySelector(
|
const mainPickerForm = document.querySelector(
|
||||||
"#item-preview species-color-picker form",
|
"#item-preview species-color-picker form");
|
||||||
);
|
const mainSpeciesField =
|
||||||
const mainSpeciesField = mainPickerForm.querySelector(
|
mainPickerForm.querySelector("[name='preview[species_id]']");
|
||||||
"[name='preview[species_id]']",
|
|
||||||
);
|
|
||||||
mainSpeciesField.value = e.target.value;
|
mainSpeciesField.value = e.target.value;
|
||||||
mainPickerForm.requestSubmit(); // `submit` doesn't get captured by Turbo!
|
mainPickerForm.requestSubmit(); // `submit` doesn't get captured by Turbo!
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -16,14 +14,6 @@ document.addEventListener("change", (e) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// If the preview frame fails to load, try a full pageload.
|
|
||||||
document.addEventListener("turbo:frame-missing", (e) => {
|
|
||||||
if (!e.target.matches("#item-preview")) return;
|
|
||||||
|
|
||||||
e.detail.visit(e.detail.response.url);
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
class SpeciesColorPicker extends HTMLElement {
|
class SpeciesColorPicker extends HTMLElement {
|
||||||
#internals;
|
#internals;
|
||||||
|
|
||||||
|
@ -54,7 +44,7 @@ class SpeciesFacePicker extends HTMLElement {
|
||||||
|
|
||||||
#handleClick(e) {
|
#handleClick(e) {
|
||||||
if (e.target.matches("input[type=radio]")) {
|
if (e.target.matches("input[type=radio]")) {
|
||||||
this.dispatchEvent(new Event("change", { bubbles: true }));
|
this.dispatchEvent(new Event("change", {bubbles: true}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,16 +207,15 @@ body.items-show
|
||||||
species-face-picker
|
species-face-picker
|
||||||
display: block
|
display: block
|
||||||
position: relative
|
position: relative
|
||||||
top: -10px
|
max-height: 200px // 4 rows of 50px images, and padding will offer a hint of below
|
||||||
|
padding: 10px // leave enough room for the zoomed-in selected face
|
||||||
|
margin-top: -10px
|
||||||
|
overflow: auto
|
||||||
|
|
||||||
species-face-picker-options
|
species-face-picker-options
|
||||||
display: flex
|
display: flex
|
||||||
justify-content: center
|
justify-content: center
|
||||||
flex-wrap: wrap
|
flex-wrap: wrap
|
||||||
isolation: isolate // avoid z-index conflicts between pets and noscript
|
|
||||||
overflow: auto
|
|
||||||
max-height: 200px // 4 rows of 50px images, and padding will offer a hint of below
|
|
||||||
padding: 10px // leave enough room for the zoomed-in selected face
|
|
||||||
|
|
||||||
img
|
img
|
||||||
width: 50px
|
width: 50px
|
||||||
|
@ -272,8 +271,7 @@ body.items-show
|
||||||
noscript
|
noscript
|
||||||
position: absolute
|
position: absolute
|
||||||
inset: 0
|
inset: 0
|
||||||
padding: 1em
|
background: rgba(white, .75)
|
||||||
background: rgba(white, .8)
|
|
||||||
z-index: 1
|
z-index: 1
|
||||||
cursor: auto
|
cursor: auto
|
||||||
|
|
||||||
|
@ -368,8 +366,8 @@ body.items-show
|
||||||
|
|
||||||
species-face-picker
|
species-face-picker
|
||||||
grid-area: faces
|
grid-area: faces
|
||||||
species-face-picker-options
|
max-height: 350px
|
||||||
max-height: 340px
|
margin: -10px
|
||||||
|
|
||||||
.item-preview-meta-info
|
.item-preview-meta-info
|
||||||
grid-area: meta
|
grid-area: meta
|
||||||
|
|
Loading…
Reference in a new issue