binary-file.pug 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. div.binary-file.full-size(
  2. ng-controller="BinaryFileController"
  3. ng-show="ui.view == 'file'"
  4. ng-if="openFile"
  5. )
  6. img(
  7. ng-show="!failedLoad"
  8. ng-src="/project/{{ project_id }}/file/{{ openFile.id }}"
  9. ng-if="isImageFile()"
  10. ng-class="{'img-preview': !imgLoaded}"
  11. onerror="sl_binaryFilePreviewError()"
  12. onabort="sl_binaryFilePreviewError()"
  13. onload="sl_binaryFilePreviewLoaded()"
  14. )
  15. img(
  16. ng-show="!failedLoad"
  17. ng-src="/project/{{ project_id }}/file/{{ openFile.id }}?format=png"
  18. ng-if="isPreviewableFile()"
  19. ng-class="{'img-preview': !imgLoaded}"
  20. onerror="sl_binaryFilePreviewError()"
  21. onabort="sl_binaryFilePreviewError()"
  22. onload="sl_binaryFilePreviewLoaded()"
  23. )
  24. div(ng-if="isTextFile() && !textPreview.error")
  25. div.text-loading(ng-show="textPreview.loading && !textPreview.error")
  26. | #{translate('loading')}...
  27. div.text-preview(ng-show="textPreview.data && !textPreview.loading && !textPreview.error")
  28. div.scroll-container
  29. p
  30. | {{ textPreview.data }}
  31. p(ng-show="textPreview.shouldShowDots")
  32. | ...
  33. p.no-preview(
  34. ng-if="failedLoad || textPreview.error || isUnpreviewableFile()"
  35. ) #{translate("no_preview_available")}
  36. div.binary-file-footer
  37. // Linked Files: URL
  38. div(ng-if="openFile.linkedFileData.provider == 'url'")
  39. p
  40. i.fa.fa-fw.fa-external-link-square.fa-rotate-180.linked-file-icon
  41. | Imported from
  42. |
  43. a(ng-href='{{openFile.linkedFileData.url}}') {{ displayUrl(openFile.linkedFileData.url) }}
  44. |
  45. | at {{ openFile.created | formatDate:'h:mm a' }} {{ openFile.created | relativeDate }}
  46. // Linked Files: Project File
  47. div(ng-if="openFile.linkedFileData.provider == 'project_file'")
  48. p
  49. i.fa.fa-fw.fa-external-link-square.fa-rotate-180.linked-file-icon
  50. | Imported from
  51. |
  52. a(ng-if='!openFile.linkedFileData.v1_source_doc_id'
  53. ng-href='/project/{{openFile.linkedFileData.source_project_id}}' target="_blank")
  54. | {{ openFile.linkedFileData.source_project_display_name }}
  55. span(ng-if='openFile.linkedFileData.v1_source_doc_id')
  56. | {{ openFile.linkedFileData.source_project_display_name }}
  57. | /{{ openFile.linkedFileData.source_entity_path.slice(1) }},
  58. |
  59. | at {{ openFile.created | formatDate:'h:mm a' }} {{ openFile.created | relativeDate }}
  60. // Linked Files: Project Output File
  61. div(ng-if="openFile.linkedFileData.provider == 'project_output_file'")
  62. p
  63. i.fa.fa-fw.fa-external-link-square.fa-rotate-180.linked-file-icon
  64. | Imported from the output of
  65. |
  66. a(ng-if='!openFile.linkedFileData.v1_source_doc_id'
  67. ng-href='/project/{{openFile.linkedFileData.source_project_id}}' target="_blank")
  68. | {{ openFile.linkedFileData.source_project_display_name }}
  69. span(ng-if='openFile.linkedFileData.v1_source_doc_id')
  70. | {{ openFile.linkedFileData.source_project_display_name }}
  71. | : {{ openFile.linkedFileData.source_output_file_path }},
  72. |
  73. | at {{ openFile.created | formatDate:'h:mm a' }} {{ openFile.created | relativeDate }}
  74. // Bottom Controls
  75. span(ng-if="openFile.linkedFileData.provider")
  76. button.btn.btn-success(
  77. href, ng-click="refreshFile(openFile)",
  78. ng-disabled="refreshing"
  79. )
  80. i.fa.fa-fw.fa-refresh(ng-class={'fa-spin': refreshing})
  81. |
  82. span(ng-show="!refreshing") Refresh
  83. span(ng-show="refreshing") Refreshing...
  84. |  
  85. a.btn.btn-info(
  86. ng-href="/project/{{ project_id }}/file/{{ openFile.id }}"
  87. )
  88. i.fa.fa-fw.fa-download
  89. |
  90. | #{translate("download")}
  91. div(ng-if="refreshError")
  92. br
  93. .alert.alert-danger.col-md-6.col-md-offset-3
  94. | Error: {{ refreshError}}