binary-file.pug 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. | Another project
  55. span(ng-if='openFile.linkedFileData.v1_source_doc_id')
  56. | Another project
  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. | Another project
  69. span(ng-if='openFile.linkedFileData.v1_source_doc_id')
  70. | Another project
  71. | : {{ openFile.linkedFileData.source_output_file_path }},
  72. |
  73. | at {{ openFile.created | formatDate:'h:mm a' }} {{ openFile.created | relativeDate }}
  74. != moduleIncludes("binaryFile:linkedFileInfo", locals)
  75. // Bottom Controls
  76. span(ng-if="openFile.linkedFileData.provider")
  77. button.btn.btn-success(
  78. href, ng-click="refreshFile(openFile)",
  79. ng-disabled="refreshing"
  80. )
  81. i.fa.fa-fw.fa-refresh(ng-class={'fa-spin': refreshing})
  82. |
  83. span(ng-show="!refreshing") Refresh
  84. span(ng-show="refreshing") Refreshing...
  85. |  
  86. a.btn.btn-info(
  87. ng-href="/project/{{ project_id }}/file/{{ openFile.id }}"
  88. )
  89. i.fa.fa-fw.fa-download
  90. |
  91. | #{translate("download")}
  92. // Refresh Error
  93. div(ng-if="refreshError").row
  94. br
  95. .alert.alert-danger.col-md-6.col-md-offset-3
  96. | Error: {{ refreshError}}
  97. != moduleIncludes("binaryFile:linkedFileRefreshError", locals)