Hi there AppWorks fans,
Welcome to a new installment of AppWorks tips.
And in this post we’ll talk and make use of a new type of document called ‘Web Library Definition’. Not hard to work with but required if you want to expose ‘assets’ like images or icons to your runtime environment for our beloved users.
Let get right into it…
We have 2 situations we’ll try out…
Let’s say we have this start situation with some assets and some basic entities.
On the ‘Category’ entity we have a Boolean property that looks like this (with those 2 flag icons select from the above assets folder!):
And on that same entity we have a ‘Create’ form that uses that property like this (and it shows the icons!)
Let’s publish this entity and jump to the runtime of our environment (/app/start)
Now create a new instance of the entity and see what happens:
Check the developer tools with
<F12> for more details!
And there you have your 404 error for not finding the ‘asset’
When we also look in the webroot folder on the file storage you will also find nothing that indeed points to this location:
Let’s fix this with a Web Library Definition!
Go back to the design-time where (hopefully) your project is still open and right click on the assets folder for the creation of a new time of document.
Create the new WLD like this with the name ‘Assets Web Library Definition’
Save it and publish it directly (no need to publish on project level).
Now go to the storage location and see some magic happening!
The assets are published now in the ‘webroot’ folder…great!
Let’s jump back to the front-end for a refresh…
And there we are! 🤟
That was a simple “DONE”. Nothing more to say and nothing more to show. Simple stuff, but now you know how it works in the back end also and why you need this type of document! Have a great day with lots of information to experience.