editor.jade 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. extends ../layout
  2. block vars
  3. - var suppressNavbar = true
  4. - var suppressFooter = true
  5. - var suppressDefaultJs = true
  6. block scripts
  7. //- Only use the native bootstrap on the editor page,
  8. //- since we use the Angular-based bootstrap elsewhere.
  9. script(src=jsPath+'libs/bootstrap-3.1.1.js')
  10. script(src=jsPath+'libs/jquery-layout.js')
  11. script(src=jsPath+'libs/jquery.storage.js')
  12. block content
  13. .editor(ng-controller="IdeController")
  14. .loading-screen(ng-show="state.loading")
  15. .container
  16. h3 Loading...
  17. .progress
  18. .progress-bar(ng-style="{'width': state.load_progress + '%'}")
  19. header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading")
  20. a.btn.btn-full-height(href='#', tooltip="Menu", tooltip-placement="bottom")
  21. i.fa.fa-bars
  22. span.name {{ project.name }}
  23. a(href='#', data-toggle="tooltip", title="Rename")
  24. i.fa.fa-pencil
  25. .toolbar-right
  26. a.btn.btn-full-height(href='#', tooltip="Share", tooltip-placement="bottom")
  27. i.fa.fa-group
  28. a.btn.btn-full-height(href='#', tooltip="Recent Changes", tooltip-placement="bottom")
  29. i.fa.fa-history
  30. a.btn.btn-full-height(href='#', tooltip="Chat", tooltip-placement="bottom")
  31. i.fa.fa-comment
  32. #editor-content(ng-cloak, layout="main", ng-hide="state.loading")
  33. aside#file-tree.ui-layout-west(ng-controller="FileTreeController")
  34. .toolbar.toolbar-small
  35. a(
  36. href,
  37. ng-click="openNewDocModal()",
  38. tooltip-html-unsafe="New<br>File",
  39. tooltip-placement="bottom"
  40. )
  41. i.fa.fa-file
  42. a(href, tooltip="New Folder", tooltip-placement="bottom")
  43. i.fa.fa-folder
  44. a(href, tooltip="Upload File", tooltip-placement="bottom")
  45. i.fa.fa-upload
  46. .toolbar-right
  47. a(href, tooltip="Rename", tooltip-placement="bottom")
  48. i.fa.fa-pencil
  49. a(href, tooltip="Delete", tooltip-placement="bottom", tooltip-append-to-body="true")
  50. i.fa.fa-trash-o
  51. ul.list-unstyled.file-tree-list
  52. file-entity(
  53. entity="entity",
  54. ng-repeat="entity in rootFolder.children | orderBy:'name'"
  55. )
  56. .ui-layout-center
  57. script(type='text/ng-template', id='entityListItemTemplate')
  58. li(
  59. ng-class="{ 'selected': entity.selected }",
  60. ng-controller="FileTreeEntityController"
  61. )
  62. .entity(ng-if="entity.type == 'doc'")
  63. .entity-name(ng-click="select()")
  64. //- Just a spacer to align with folders
  65. i.fa.fa-fw.toggle
  66. i.fa.fa-fw.fa-file
  67. | {{ entity.name }}
  68. .entity(ng-if="entity.type == 'file'")
  69. .entity-name(ng-click="select()")
  70. i.fa.fa-fw.toggle
  71. i.fa.fa-fw.fa-image
  72. | {{ entity.name }}
  73. .entity(ng-if="entity.type == 'folder'", ng-controller="FileTreeFolderController")
  74. .entity-name
  75. i.fa.fa-fw.toggle(
  76. ng-class="{'fa-chevron-right': !expanded, 'fa-chevron-down': expanded}"
  77. ng-click="toggleExpanded()"
  78. )
  79. i.fa.fa-fw(
  80. ng-class="{\
  81. 'fa-folder': !expanded, \
  82. 'fa-folder-open': expanded \
  83. }"
  84. ng-click="select()"
  85. )
  86. span(ng-click="select()") {{ entity.name }}
  87. ul.list-unstyled(ng-show="expanded")
  88. file-entity(entity="child", ng-repeat="child in entity.children | orderBy:'name'")
  89. script(type='text/ng-template', id='newDocModalTemplate')
  90. .modal-header
  91. h3 New File
  92. .modal-body
  93. form(novalidate, name="newDocForm")
  94. input.form-control(
  95. type="text",
  96. placeholder="File Name",
  97. required,
  98. ng-model="inputs.name",
  99. ng-enter="create()",
  100. focus-on="open"
  101. )
  102. .modal-footer
  103. button.btn.btn-default(
  104. ng-disabled="state.inflight"
  105. ng-click="cancel()"
  106. ) Cancel
  107. button.btn.btn-primary(
  108. ng-disabled="newDocForm.$invalid || state.inflight"
  109. ng-click="create()"
  110. )
  111. span(ng-hide="state.inflight") Create
  112. span(ng-show="state.inflight") Creating...
  113. //- #loadingScreen
  114. //- h3 Loading...
  115. //- p#loadingMessage Loading editor
  116. //- #errorMessages
  117. //- #connectionLostMessage(style="display: none;")
  118. //- | Lost connection.
  119. //- span#trying-reconnect
  120. //- | Reconnecting in
  121. //- span#reconnection-countdown ?
  122. //- | seconds.
  123. //- a(href='#')#try-reconnect-now Try now.
  124. //- span#reconnecting
  125. //- | Reconnecting...
  126. //- #savingProblems(style="display: none")
  127. //- | Saving...
  128. //- div#toolbar.sidebar-navigation
  129. //- ul#tabs
  130. //- #toolbar-footer
  131. //- #tab-content.tab-content
  132. //- include ../templates
  133. //- include ../templates/dropbox
  134. script(src='/socket.io/socket.io.js')
  135. script(type='text/javascript').
  136. window.project_id = "!{project_id}"
  137. window.sharelatex = !{sharelatexObject};
  138. window.userSettings = !{userSettingsObject};
  139. window.user = !{userObject};
  140. window.csrfToken = "!{csrfToken}";
  141. window.requirejs = {
  142. "paths" : {
  143. "underscore": "libs/underscore-1.3.3",
  144. "mathjax": "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML",
  145. "moment": "libs/moment-2.4.0"
  146. },
  147. "urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}",
  148. "waitSeconds": 0,
  149. "shim": {
  150. "libs/backbone": {
  151. deps: ["libs/underscore-1.3.3"]
  152. },
  153. "libs/pdfListView/PdfListView": {
  154. deps: ["libs/pdf"]
  155. },
  156. "libs/pdf": {
  157. deps: ["libs/compatibility"]
  158. }
  159. }
  160. };
  161. script(type='text/javascript').
  162. ga('send', 'event', 'editor-interaction', 'editor-opened')
  163. - locals.suppressDefaultJs = true
  164. - var fingerprintedPath = fingerprint(jsPath+'libs/pdf.worker.js')
  165. - var pdfJsWorkerPath = jsPath+'libs/pdf.worker.js?fingerprint='+fingerprintedPath
  166. script(type='text/javascript').
  167. window.sharelatex.pdfJsWorkerPath = "#{pdfJsWorkerPath}"
  168. script(
  169. data-main=jsPath+'app/ide.js',
  170. baseurl=jsPath,
  171. data-ace-base=jsPath+'ace',
  172. src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js')
  173. )
  174. - if (!anonymous)
  175. script(type="text/javascript").
  176. var chatReq = require.config({
  177. context: "chat",
  178. baseUrl: "#{chatUrl}/chat"
  179. });
  180. chatReq(["require", "chat"], function(require, Chat) {
  181. new Chat({
  182. room: {
  183. project_id: window.userSettings.project_id
  184. },
  185. url: "#{chatUrl}"
  186. })
  187. });