template(name="cardAttachmentsPopup")
  ul.pop-over-list
    li
      input.js-attach-file.hide(type="file" name="file" multiple)
      a.js-computer-upload {{_ 'computer'}}
    li
      a.js-upload-clipboard-image {{_ 'clipboard'}}

template(name="previewClipboardImagePopup")
  p <kbd>Ctrl</kbd>+<kbd>V</kbd> {{_ "paste-or-dragdrop"}}
  img.preview-clipboard-image()
  button.primary.js-upload-pasted-image {{_ 'upload'}}

template(name="attachmentDeletePopup")
  p {{_ "attachment-delete-pop"}}
  button.js-confirm.negate.full(type="submit") {{_ 'delete'}}

template(name="attachmentsGalery")
  .attachments-galery
    each attachments
      .attachment-item
        a.attachment-thumbnail(href="{{link}}" title="{{name}}" data-lightbox="{{name}}")
          if link
            if isImage
              img.attachment-thumbnail-img(src="{{link}}")
            else if($eq extension 'mp3')
                video(width="100%" height="100%" controls="true")
                  source(src="{{link}}" type="audio/mpeg")
            else if($eq extension 'ogg')
                video(width="100%" height="100%" controls="true")
                  source(src="{{link}}" type="video/ogg")
            else if($eq extension 'webm')
                video(width="100%" height="100%" controls="true")
                  source(src="{{link}}" type="video/webm")
            else if($eq extension 'mp4')
                video(width="100%" height="100%" controls="true")
                  source(src="{{link}}" type="video/mp4")
            else
              span.attachment-thumbnail-ext= extension
          else
            +spinner
        p.attachment-details
          = name
          span.file-size ({{fileSize size}} KB)
          span.attachment-details-actions
            a.js-download(href="{{link}}?download=true", download="{{name}}")
              i.fa.fa-download
              | {{_ 'download'}}
            if currentUser.isBoardMember
              unless currentUser.isCommentOnly
                unless currentUser.isWorker
                  a.fa.fa-navicon.attachment-details-menu.js-open-attachment-menu(title="{{_ 'attachmentActionsPopup-title'}}")

    if currentUser.isBoardMember
      unless currentUser.isCommentOnly
        unless currentUser.isWorker
          //li.attachment-item.add-attachment
          a.js-add-attachment(title="{{_ 'add-attachment' }}")
            i.fa.fa-plus

template(name="attachmentActionsPopup")
  ul.pop-over-list
    li
      if isImage
        a(class="{{#if isCover}}js-remove-cover{{else}}js-add-cover{{/if}}")
          i.fa.fa-thumb-tack
          if isCover
            | {{_ 'remove-cover'}}
          else
            | {{_ 'add-cover'}}
      if currentUser.isBoardAdmin
        a.js-rename
          i.fa.fa-pencil-square-o
          | {{_ 'rename'}}
        a.js-confirm-delete
          i.fa.fa-close
          | {{_ 'delete'}}
        p.attachment-storage
          | {{versions.original.storage}}

        if $neq versions.original.storage "fs"
          a.js-move-storage-fs
            i.fa.fa-arrow-right
            | {{_ 'attachment-move-storage-fs'}}

        if $neq versions.original.storage "gridfs"
          if versions.original.storage
            a.js-move-storage-gridfs
              i.fa.fa-arrow-right
              | {{_ 'attachment-move-storage-gridfs'}}

template(name="attachmentRenamePopup")
  input.js-edit-attachment-name(type='text' autofocus value="{{getNameWithoutExtension}}" dir="auto")
  .edit-controls.clearfix
    button.primary.confirm.js-submit-edit-attachment-name(type="submit") {{_ 'save'}}
