Fix some issues with new file attachment thumbnails.

When uploading file attachments, the generated thumbnails end up with
some glitches with the caption editor and links.

Opening the caption editor would result in the editor being shifted
over. This happened because the buttons element defaulted to 'display:
span' and not 'display: block' (due to a recent Djblets change),
messing up calculations.

The download links for new attachments were also wrong, pointing to
nothing. When the attachment is first created, we have an empty
RB.FileAttachment, and we never updated those links.

Similarly, icon URLs were set to 'null', causing 404s, at first. Now,
they're just not set until there's a value.

All values going into the template are now escaped, preventing breakages
if uploading a filename that has special characters.

And finally, several this.model.on() calls have been replaced with
this.listenTo() calls.

Reviewed at https://reviews.reviewboard.org/r/6269/