Is it possible to make a list of attachments automatically show up when someone uploaded files to the page?
I can think of inserting [[module Files]] as a template in all of the pages, but that creates clutter and distraction when there is no uploaded file in the page. It would be better if that module show up only when somebody has actually uploaded a file. Can this be done?
Using CSS, most likely yes.
See: http://shane.wikify.me/blog:87 for how to hide the "Manage attachments" link, if you want to. You can easily put it somewhere else on the page using a button if you wish.
Now, if you can hide that first row as well (File name, File type, Size) then it will be invisible when no files are uploaded to the page.
The downside is that you'll also be missing that first row when there are files attached to the page.
Some CSS to do this is:
/* Hide table header */ .page-files th { display: none; } /* Hide manage-attachments link */ .manage-attachments-link { display: none; }
Put that into either a CSS module, your site- or category-wide theme.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
One small problem with the above approach. When there is no file attached to the page, I see the "No files attached to this page." message.
Is there a way to do away that line when there is no file attached to the page?
Unfortunately, no. There are other places that I wish we could remove these "error" messages as well. The gallery module is one that comes to mind off the top of my head. Those modules could use a "quietMode=true" option or something similar so we can use them in live templates or on other pages where we know in advance that not every page will have a file or image attached.
Ed
Actually, for a moment there I thought there was a way!
The error message "No files attached to this page." is contained within a <p> element, whilst the list of files uses a table. Therefore by hiding that paragraph element, you don't affect the list of files - only the error message.
So I used this CSS to hide it:
/* Hide "no files" error message */ #files-739386 p { display: none; }
The only problem is… not only is that number unique, but it changes every time you refresh the page, making this only work when using FireBug or something similar to test CSS changes.
:(
Anyone know why this number changes? Seems completely random to me…
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
Yes, since the number is not consistent, I don't think there's an easy (or hard) way to get around this with CSS.
My guess is that the number is associated with a database query that is built on the fly and keeps it from colliding with the results for a similar query being run on thousands of other sites.
The only real solutions I can see would be to have a class added to wrap those messages so we could manage them with CSS or to add an option in the module attributes to turn them off.
Probably the CSS class is the easiest for Wikidot to implement, and therefore the most likely wish to actually be accepted. I'll add it to the feedback site…
… and here it is: http://feedback.wikidot.com/wish:578
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server