Is there a macro for returning the icon specific to a file's type?
For instance, I notice the attachments macro shows an "MS Excel" icon when an "xls" is attached and an "Adobe Acrobat" icon when a "pdf" is attached. What does that macro use to figure out which icon to display?
Community moderators have prevented the ability to post new answers.
You could just use CSS to achieve this e.g.
a[href$='.pdf'] { display:inline-block; padding-left:20px; line-height:18px; background:transparent url(/path/to/pdf-icon.png) center left no-repeat; }
...read more.
Sweet! I just added the styling to my user macro and it worked nicely!
<style type="text/css"> a[href$='.pdf'] { display:inline-block; padding-left:20px; line-height:18px; background:transparent url(.../confluence/images/icons/attachments/pdf.gif) center left no-repeat; } </style>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are using a user macro and have an $attachment variable available, you could just insert the following line to automatically display the appropriate icon depending on the content type of the attachment:
#parse ("/pages/includes/attachment_icon.vm")
Otherwise you could create a user macro with either one of the following lines:
<span class="icon icon-file-pdf" title="$action.getText("pdf.file")">$action.getText("pdf.file")</span>
<span class="icon icon-file-image" title="$action.getText("jpeg.file")">$action.getText("jpeg.file")</span>
<span class="icon icon-file-excel" title="$action.getText("excel.file")">$action.getText("excel.file")</span>
...
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Very cool! I'm actually looping through a page's attachment list and this works pretty nicely when used for each loop iteration.
#foreach( $attachment in $attachmentsList ) #parse ("/pages/includes/attachment_icon.vm") #end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.