Closed tbrlpld closed 4 years ago
@zerolab I put through a PR for this. Let me know if there's anything that you'd like me to adjust.
Me too ^^ #95
Let's go with url
for the full URL, and leave file
to maintain the relative path (as per https://github.com/GrappleGQL/wagtail-grapple/pull/96#issuecomment-674950403)
PR #95 has been updated accordingly.
I know you guys probably pretty busy, but I just wanted to drop this feature request for future updates 😉
Currently the
DocumentObjectType
provides the following fields:The
file
field resolves to some path like string like"documents/example.pdf"
. Now to actually generate a link where I can access the document I need to pull the Wagtail GraphQL enpoint from the plugin options, trim it to the base URL (domain) and then add the correct media URL and then add the value from thefile
field.While this certainly works, it seems fragile and introduces some coupling between the frontend and backend. Anytime the backend might have a different media URL I would need to update that in the frontend (code or configuration).
The
ImageObjectType
provides similar fields as theDocumentObjectType
and many other fileds. One of them is thesrc
field. This is a valid URL under which the respective image can be accessed. It would be great to add the same filed to theDocumentObjectType
😊Since the document model already provides a
url
proptery just like the image model, I guess the same approach as for theImageObjectType.src
could be used for theDocumentObjectType.src
.