   )
   $modal.find('.document-modal-next').on('click', -> initDocumentModal(nextFileCard($fileCard)))
   $modal.find('.document-modal-prev').on('click', -> initDocumentModal(prevFileCard($fileCard)))
-  createPreview($modal.find('.document-modal-content'), filename, url)
+  createPreview($modal.find('.document-modal-content'), title, filename, url)
   findOrCreateDocumentModal().replaceWith($modal)
   $('body').addClass('no-scroll')
 

    <div class="document-modal-header">
      <div class="document-modal-title left white-text">
        <%= MTL.fileIcon(filename, { class: 'left' }) %>
        <%- filename %>
      </div>
      <div class="document-modal-toolbar right">
        <a href="<%- url %>" target="_blank">

isPDF = (filename) ->
  fileExtension(filename) == 'pdf'

createPreview = ($container, title, filename, url) ->
  switch
    when isImage(filename)
      $container.append($('<img/>', { src: url, alt: filename }))
    when isPDF(filename) && PDFObject.supportsPDFs
      PDFObject.embed(url, $container, { width: '800px', height: $(window).height() + 'px' })
    else
      $container.append(MTL.renderTemplate('no_preview', { title: title, filename: filename, url: url }))

findOrCreateDocumentModal = ->
  return $('<div/>').appendTo('body') unless $('body > .document-modal').first().length
