Put the new item preview in a Turbo frame
Nice, gotta say, this is a pretty neat way of making things feel more app-y! There's some missing pieces here about like, loading state etc, but the vibes are pretty good, and the implementation was dead-easy!
This commit is contained in:
parent
cf1d28dd62
commit
9838301712
1 changed files with 19 additions and 18 deletions
|
@ -13,26 +13,27 @@
|
|||
how we handle zones. Until then, these items will be <em>very</em> buggy,
|
||||
sorry!
|
||||
|
||||
%outfit-viewer
|
||||
%outfit-pet-appearance
|
||||
= outfit_viewer_layers @pet_layers
|
||||
%outfit-item-appearance
|
||||
= outfit_viewer_layers @item_layers
|
||||
= turbo_frame_tag "item-preview" do
|
||||
%outfit-viewer
|
||||
%outfit-pet-appearance
|
||||
= outfit_viewer_layers @pet_layers
|
||||
%outfit-item-appearance
|
||||
= outfit_viewer_layers @item_layers
|
||||
|
||||
= form_for item_path(@item), method: :get, class: "species-color-picker",
|
||||
data: {"is-valid": @preview_error.nil?} do |f|
|
||||
- if @preview_error == :pet_type_does_not_exist
|
||||
%span.error-icon{title: "We haven't seen this kind of pet before."} ⚠️
|
||||
- elsif @preview_error == :no_item_data
|
||||
%span.error-icon{title: "We haven't seen this item on this pet before."} ⚠️
|
||||
= form_for item_path(@item), method: :get, class: "species-color-picker",
|
||||
data: {"is-valid": @preview_error.nil?} do |f|
|
||||
- if @preview_error == :pet_type_does_not_exist
|
||||
%span.error-icon{title: "We haven't seen this kind of pet before."} ⚠️
|
||||
- elsif @preview_error == :no_item_data
|
||||
%span.error-icon{title: "We haven't seen this item on this pet before."} ⚠️
|
||||
|
||||
= select_tag "preview[color_id]",
|
||||
options_from_collection_for_select(Color.funny.alphabetical,
|
||||
"id", "human_name", @selected_preview_pet_type.color_id)
|
||||
= select_tag "preview[species_id]",
|
||||
options_from_collection_for_select(Species.alphabetical,
|
||||
"id", "human_name", @selected_preview_pet_type.species_id)
|
||||
= submit_tag "Go", name: nil
|
||||
= select_tag "preview[color_id]",
|
||||
options_from_collection_for_select(Color.funny.alphabetical,
|
||||
"id", "human_name", @selected_preview_pet_type.color_id)
|
||||
= select_tag "preview[species_id]",
|
||||
options_from_collection_for_select(Species.alphabetical,
|
||||
"id", "human_name", @selected_preview_pet_type.species_id)
|
||||
= submit_tag "Go", name: nil
|
||||
|
||||
- unless @contributors_with_counts.empty?
|
||||
#item-contributors
|
||||
|
|
Loading…
Reference in a new issue