Compare commits
3 commits
cd095eefcb
...
56d550e86c
Author | SHA1 | Date | |
---|---|---|---|
56d550e86c | |||
7af1a97161 | |||
c5cd1f2f3d |
3 changed files with 14 additions and 17 deletions
|
@ -16,10 +16,13 @@ class AltStylesController < ApplicationController
|
|||
format.html { render }
|
||||
format.json {
|
||||
render json: @alt_styles.includes(swf_assets: [:zone]).as_json(
|
||||
only: [:id, :species_id, :color_id, :body_id, :series_name,
|
||||
:adjective_name, :thumbnail_url],
|
||||
include: {
|
||||
swf_assets: {
|
||||
only: [:id, :body_id],
|
||||
include: [:zone],
|
||||
methods: [:html5_image_url, :html5_svg_url],
|
||||
methods: [:urls, :known_glitches],
|
||||
}
|
||||
},
|
||||
methods: [:series_name, :adjective_name, :thumbnail_url],
|
||||
|
|
|
@ -12,7 +12,10 @@ export function useAltStylesForSpecies(speciesId, options = {}) {
|
|||
// NOTE: This is actually just a wrapper for `useAltStylesForSpecies`, to share
|
||||
// the same cache key!
|
||||
export function useAltStyle(id, speciesId, options = {}) {
|
||||
const query = useAltStylesForSpecies(speciesId, options);
|
||||
const query = useAltStylesForSpecies(speciesId, {
|
||||
...options,
|
||||
enabled: (options.enabled ?? true) && id != null,
|
||||
});
|
||||
|
||||
return {
|
||||
...query,
|
||||
|
@ -70,13 +73,11 @@ function normalizeSwfAssetToLayer(swfAssetData) {
|
|||
label: swfAssetData.zone.label,
|
||||
},
|
||||
bodyId: swfAssetData.body_id,
|
||||
knownGlitches: [], // TODO
|
||||
knownGlitches: swfAssetData.known_glitches,
|
||||
|
||||
// HACK: We're just simplifying this adapter, but it would be better to
|
||||
// actually check what file formats the manifest says!
|
||||
svgUrl: swfAssetData.html5_svg_url,
|
||||
canvasMovieLibraryUrl: null,
|
||||
imageUrl: swfAssetData.html5_image_url,
|
||||
swfUrl: swfAssetData.url,
|
||||
svgUrl: swfAssetData.urls.svg,
|
||||
canvasMovieLibraryUrl: swfAssetData.urls.canvas_library,
|
||||
imageUrl: swfAssetData.urls.png,
|
||||
swfUrl: swfAssetData.urls.swf,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ class SwfAsset < ApplicationRecord
|
|||
swf: url,
|
||||
png: image_url,
|
||||
svg: manifest_asset_urls[:svg],
|
||||
canvas_library: manifest_asset_urls[:js],
|
||||
manifest: manifest_url,
|
||||
}
|
||||
end
|
||||
|
@ -147,14 +148,6 @@ class SwfAsset < ApplicationRecord
|
|||
).to_s
|
||||
end
|
||||
|
||||
def html5_image_url
|
||||
manifest_asset_urls[:png]
|
||||
end
|
||||
|
||||
def html5_svg_url
|
||||
manifest_asset_urls[:svg]
|
||||
end
|
||||
|
||||
def known_glitches
|
||||
self[:known_glitches].split(',')
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue