Support custom viewers by customising "open" link target
From @coderofsalvation:
support for custom viewer: open model in new tab (via configurable URL via env- or UI-variable) when clicking on a preview_frame.rb. this turns manyfold into a 3D CMS with custom viewer support, instead of my current hack in app/app/components/preview_frame.rb:
def view_template
a href: "/view?#{model_model_file_path(@file.model, @file, format: @file.extension)}", target:"_blank" do
if @file
local
elsif @object.remote?
remote
else
empty
end
end
end
this might also relate to https://github.com/manyfold3d/manyfold/issues/4967 and https://github.com/manyfold3d/manyfold/issues/4964 (regarding testing)
Since its unsure what the custom viewer-URL likes to consume...perhaps like modelpath ({creator}/{modelId} e.g.) the user can compose its own url using similar variables:
-
{modelFile} -
{datapackage} -
{thumbnail}
Perhaps in an textfield, a URL like https://foo.com/view?model={modelFile}&pkg={datapackage}&thumb={thumbnail} could be entered, which would resolve to https://foo.com/view?model=https://...../foo.glb&pkg=https://....../datapackage.json&thumb=https://...../thumb.jpg e.g.
That's nice, I like the idea of composable custom URLs, like our path template tags.