new-file-modal.pug 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. script(type='text/ng-template', id='newFileModalTemplate')
  2. .modal-header
  3. h3 Add Files
  4. .modal-body.modal-new-file(ng-show="file_count < 2000")
  5. table
  6. tr
  7. td.modal-new-file--list
  8. ul.list-unstyled
  9. li(ng-class="type == 'doc' ? 'active' : null")
  10. a(href, ng-click="type = 'doc'")
  11. i.fa.fa-fw.fa-file
  12. |
  13. | New File
  14. li(ng-class="type == 'upload' ? 'active' : null")
  15. a(href, ng-click="type = 'upload'")
  16. i.fa.fa-fw.fa-upload
  17. |
  18. | Upload
  19. li(ng-class="type == 'project' ? 'active' : null")
  20. a(href, ng-click="type = 'project'")
  21. i.fa.fa-fw.fa-folder-open
  22. |
  23. | From Another Project
  24. if hasFeature('link-url')
  25. li(ng-class="type == 'url' ? 'active' : null")
  26. a(href, ng-click="type = 'url'")
  27. i.fa.fa-fw.fa-globe
  28. |
  29. | From External URL
  30. != moduleIncludes("newFileModal:selector", locals)
  31. td(class="modal-new-file--body modal-new-file--body-{{type}}")
  32. div(ng-if="type == 'doc'", ng-controller="NewDocModalController")
  33. form(novalidate, name="newDocForm")
  34. label(for="name") File Name
  35. input.form-control(
  36. type="text",
  37. placeholder="File Name",
  38. required,
  39. ng-model="inputs.name",
  40. on-enter="create()",
  41. select-name-on="open",
  42. valid-file,
  43. name="name"
  44. )
  45. div.alert.alert-danger.row-spaced-small(ng-if="error")
  46. div(ng-switch="error")
  47. span(ng-switch-when="already exists") #{translate("file_already_exists")}
  48. span(ng-switch-default) {{error}}
  49. div.alert.alert-danger.row-spaced-small(ng-show="newDocForm.name.$error.validFile && newDocForm.name.$viewValue.length")
  50. | #{translate('files_cannot_include_invalid_characters')}
  51. div(ng-if="type == 'upload'", ng-controller="UploadFileModalController")
  52. .alert.alert-warning.small(ng-if="tooManyFiles") #{translate("maximum_files_uploaded_together", {max:"{{max_files}}"})}
  53. .alert.alert-warning.small(ng-if="rateLimitHit") #{translate("too_many_files_uploaded_throttled_short_period")}
  54. .alert.alert-warning.small(ng-if="notLoggedIn") #{translate("session_expired_redirecting_to_login", {seconds:"{{secondsToRedirect}}"})}
  55. .alert.alert-warning.small(ng-if="conflicts.length > 0")
  56. p.text-center
  57. | The following files already exist in this project:
  58. ul.text-center.list-unstyled.row-spaced-small
  59. li(ng-repeat="conflict in conflicts track by $index"): strong {{ conflict }}
  60. p.text-center.row-spaced-small
  61. | Do you want to overwrite them?
  62. p.text-center
  63. a(href, ng-click="doUpload()").btn.btn-primary Overwrite
  64. | &nbsp;
  65. a(href, ng-click="cancel()").btn.btn-default Cancel
  66. div(
  67. fine-upload
  68. endpoint="/project/{{ project_id }}/upload"
  69. template-id="qq-file-uploader-template"
  70. multiple="true"
  71. auto-upload="false"
  72. on-complete-callback="onComplete"
  73. on-upload-callback="onUpload"
  74. on-validate-batch="onValidateBatch"
  75. on-error-callback="onError"
  76. on-submit-callback="onSubmit"
  77. on-cancel-callback="onCancel"
  78. control="control"
  79. params="{'folder_id': parent_folder_id}"
  80. )
  81. div(ng-if="type == 'project'", ng-controller="ProjectLinkedFileModalController")
  82. div
  83. form
  84. .form-controls
  85. label(for="project-select") Select a Project
  86. span(ng-show="state.inFlight.projects")
  87. | &nbsp;
  88. i.fa.fa-spinner.fa-spin
  89. select.form-control(
  90. name="project-select"
  91. ng-model="data.selectedProjectId"
  92. ng-disabled="!shouldEnableProjectSelect()"
  93. )
  94. option(value="" disabled selected) - Please Select a Project
  95. option(
  96. ng-repeat="project in data.projects"
  97. value="{{ project._id }}"
  98. ) {{ project.name }}
  99. small(ng-if="hasNoProjects() && shouldEnableProjectSelect() ")
  100. | No other projects found, please create another project first
  101. .form-controls.row-spaced-small(ng-if="!state.isOutputFilesMode")
  102. label(for="project-entity-select") Select a File
  103. span(ng-show="state.inFlight.entities")
  104. | &nbsp;
  105. i.fa.fa-spinner.fa-spin
  106. select.form-control(
  107. name="project-entity-select"
  108. ng-model="data.selectedProjectEntity"
  109. ng-disabled="!shouldEnableProjectEntitySelect()"
  110. )
  111. option(value="" disabled selected) - Please Select a File
  112. option(
  113. ng-repeat="projectEntity in data.projectEntities"
  114. value="{{ projectEntity.path }}"
  115. ) {{ projectEntity.path.slice(1) }}
  116. .form-controls.row-spaced-small(ng-if="state.isOutputFilesMode")
  117. label(for="project-entity-select") Select an Output File
  118. span(ng-show="state.inFlight.compile")
  119. | &nbsp;
  120. i.fa.fa-spinner.fa-spin
  121. select.form-control(
  122. name="project-output-file-select"
  123. ng-model="data.selectedProjectOutputFile"
  124. ng-disabled="!shouldEnableProjectOutputFileSelect()"
  125. )
  126. option(value="" disabled selected) - Please Select an Output File
  127. option(
  128. ng-repeat="outputFile in data.projectOutputFiles"
  129. value="{{ outputFile.path }}"
  130. ) {{ outputFile.path }}
  131. div.toggle-output-files-button
  132. | or&nbsp;
  133. a(
  134. href="#"
  135. ng-click="toggleOutputFilesMode()"
  136. )
  137. span(ng-show="state.isOutputFilesMode") select from source files
  138. span(ng-show="!state.isOutputFilesMode") select from output files
  139. .form-controls.row-spaced-small
  140. label(for="name") #{translate("file_name_in_this_project")}
  141. input.form-control(
  142. type="text"
  143. placeholder="example.tex"
  144. required
  145. ng-model="data.name"
  146. name="name"
  147. )
  148. div.alert.alert-danger.row-spaced-small(ng-if="error")
  149. div(ng-switch="error")
  150. span(ng-switch-when="already exists") #{translate("file_already_exists")}
  151. span(ng-switch-when="too many files") #{translate("project_has_too_many_files")}
  152. span(ng-switch-default) Error, something went wrong!
  153. div(ng-if="type == 'url'", ng-controller="UrlLinkedFileModalController")
  154. form(novalidate, name="newLinkedFileForm")
  155. label(for="url") URL to fetch the file from
  156. input.form-control(
  157. type="text",
  158. placeholder="www.example.com/my_file",
  159. required,
  160. ng-model="inputs.url",
  161. focus-on="open",
  162. on-enter="create()",
  163. name="url"
  164. )
  165. .row-spaced-small
  166. label(for="name") #{translate("file_name_in_this_project")}
  167. input.form-control(
  168. type="text",
  169. placeholder="my_file",
  170. required,
  171. ng-model="inputs.name",
  172. ng-change="nameChangedByUser = true"
  173. valid-file,
  174. on-enter="create()",
  175. name="name"
  176. )
  177. .text-danger.row-spaced-small(ng-show="newDocForm.name.$error.validFile")
  178. | #{translate('files_cannot_include_invalid_characters')}
  179. div.alert.alert-danger.row-spaced-small(ng-if="error")
  180. div(ng-switch="error")
  181. span(ng-switch-when="already exists") #{translate("file_already_exists")}
  182. span(ng-switch-when="too many files") #{translate("project_has_too_many_files")}
  183. span(ng-switch-default) {{error}}
  184. != moduleIncludes("newFileModal:panel", locals)
  185. .modal-footer
  186. .modal-footer-left.approaching-file-limit(ng-if="file_count > 1900 && file_count < 2000")
  187. | #{translate("project_approaching_file_limit")} ({{file_count}}/2000)
  188. .alert.alert-warning.at-file-limit(ng-if="file_count >= 2000")
  189. | #{translate("project_has_too_many_files")}
  190. button.btn.btn-default(
  191. ng-disabled="state.inflight"
  192. ng-click="cancel()"
  193. ) #{translate("cancel")}
  194. button.btn.btn-primary(
  195. ng-disabled="state.inflight || !state.valid"
  196. ng-click="create()"
  197. ng-hide="type == 'upload'"
  198. )
  199. span(ng-hide="state.inflight") #{translate("create")}
  200. span(ng-show="state.inflight") #{translate("creating")}…
  201. script(type="text/template", id="qq-file-uploader-template")
  202. div.qq-uploader-selector
  203. div(qq-hide-dropzone="").qq-upload-drop-area-selector.qq-upload-drop-area
  204. span.qq-upload-drop-area-text-selector #{translate('drop_files_here_to_upload')}
  205. div Drag here
  206. div.row-spaced-small.small #{translate('or')}
  207. div.row-spaced-small
  208. div.qq-upload-button-selector.btn.btn-primary
  209. | Select from your computer
  210. ul.qq-upload-list-selector
  211. li
  212. div.qq-progress-bar-container-selector
  213. div(
  214. role="progressbar"
  215. aria-valuenow="0"
  216. aria-valuemin="0"
  217. aria-valuemax="100"
  218. class="qq-progress-bar-selector qq-progress-bar"
  219. )
  220. span.qq-upload-file-selector.qq-upload-file
  221. span.qq-upload-size-selector.qq-upload-size
  222. a(type="button").qq-btn.qq-upload-cancel-selector.qq-upload-cancel #{translate('cancel')}
  223. button(type="button").qq-btn.qq-upload-retry-selector.qq-upload-retry #{translate('retry')}
  224. span(role="status").qq-upload-status-text-selector.qq-upload-status-text