Skip to content

Instantly share code, notes, and snippets.

@skipjac
Created November 16, 2012 23:18
Show Gist options
  • Save skipjac/4091813 to your computer and use it in GitHub Desktop.
Save skipjac/4091813 to your computer and use it in GitHub Desktop.
Zendesk attachment links in Classic sidebar
<div id="attachmentList">
<div id="attachmentItem">
</div>
</div>
<script type="application/javascript">
(function () {
var processComments = function (data) {
data.forEach(function (i) {
if ( i.attachments.length > 0 ) {
i.attachments.forEach(function (att) {
$j('#attachmentItem').append('<li><a href=' + att.url + '>' + att.filename + '</a></li>');
});
}
}
);
}
$j.getJSON('/api/v1/tickets/' + ticketId + '.json', function(data) {
processComments(data.comments);
});
}());
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment