editor.jade 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. .global-alerts(ng-cloak)
  20. .alert.alert-danger.small(ng-if="connection.forced_disconnect")
  21. strong Disconnected
  22. | Please refresh the page to continue.
  23. .alert.alert-warning.small(ng-if="connection.reconnection_countdown")
  24. strong Lost Connection.
  25. | Reconnecting in {{ connection.reconnection_countdown }} secs.
  26. a.pull-right(href, ng-click="tryReconnectNow()") Try Now
  27. .alert.alert-warning.small(ng-if="connection.reconnecting")
  28. strong Reconnecting...
  29. header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading")
  30. a.btn.btn-full-height(href='#', tooltip="Menu", tooltip-placement="bottom")
  31. i.fa.fa-bars
  32. span.name {{ project.name }}
  33. a(href='#', data-toggle="tooltip", title="Rename")
  34. i.fa.fa-pencil
  35. .toolbar-right
  36. a.btn.btn-full-height(href='#', tooltip="Share", tooltip-placement="bottom")
  37. i.fa.fa-group
  38. a.btn.btn-full-height(href='#', tooltip="Recent Changes", tooltip-placement="bottom")
  39. i.fa.fa-history
  40. a.btn.btn-full-height(href='#', tooltip="Chat", tooltip-placement="bottom")
  41. i.fa.fa-comment
  42. #ide-body(ng-cloak, layout="main", ng-hide="state.loading")
  43. include ./editor/file-tree
  44. .ui-layout-center
  45. .loading(ng-show="!editor.sharejs_doc || editor.opening")
  46. i.fa.fa-spin.fa-refresh
  47. | Loading...
  48. #editor(
  49. ace-editor,
  50. ng-show="!!editor.sharejs_doc && !editor.opening"
  51. theme="'cobalt'",
  52. show-print-margin="false",
  53. sharejs-doc="editor.sharejs_doc",
  54. last-updated="editor.last_updated"
  55. )
  56. //- #loadingScreen
  57. //- h3 Loading...
  58. //- p#loadingMessage Loading editor
  59. //- #errorMessages
  60. //- #connectionLostMessage(style="display: none;")
  61. //- | Lost connection.
  62. //- span#trying-reconnect
  63. //- | Reconnecting in
  64. //- span#reconnection-countdown ?
  65. //- | seconds.
  66. //- a(href='#')#try-reconnect-now Try now.
  67. //- span#reconnecting
  68. //- | Reconnecting...
  69. //- #savingProblems(style="display: none")
  70. //- | Saving...
  71. //- div#toolbar.sidebar-navigation
  72. //- ul#tabs
  73. //- #toolbar-footer
  74. //- #tab-content.tab-content
  75. //- include ../templates
  76. //- include ../templates/dropbox
  77. script(src='/socket.io/socket.io.js')
  78. script(type='text/javascript').
  79. window.project_id = "!{project_id}"
  80. window.sharelatex = !{sharelatexObject};
  81. window.userSettings = !{userSettingsObject};
  82. window.user = !{userObject};
  83. window.csrfToken = "!{csrfToken}";
  84. window.requirejs = {
  85. "paths" : {
  86. "underscore": "../libs/underscore-1.3.3",
  87. "mathjax": "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML",
  88. "moment": "libs/moment-2.4.0",
  89. "ace": "#{jsPath}ace"
  90. },
  91. "urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}",
  92. "waitSeconds": 0,
  93. "shim": {
  94. "libs/backbone": {
  95. deps: ["libs/underscore-1.3.3"]
  96. },
  97. "libs/pdfListView/PdfListView": {
  98. deps: ["libs/pdf"]
  99. },
  100. "libs/pdf": {
  101. deps: ["libs/compatibility"]
  102. }
  103. }
  104. };
  105. script(type='text/javascript').
  106. ga('send', 'event', 'editor-interaction', 'editor-opened')
  107. - locals.suppressDefaultJs = true
  108. - var fingerprintedPath = fingerprint(jsPath+'libs/pdf.worker.js')
  109. - var pdfJsWorkerPath = jsPath+'libs/pdf.worker.js?fingerprint='+fingerprintedPath
  110. script(type='text/javascript').
  111. window.sharelatex.pdfJsWorkerPath = "#{pdfJsWorkerPath}"
  112. script(
  113. data-main=jsPath+'app/ide.js',
  114. baseurl=jsPath,
  115. data-ace-base=jsPath+'ace',
  116. src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js')
  117. )
  118. - if (!anonymous)
  119. script(type="text/javascript").
  120. var chatReq = require.config({
  121. context: "chat",
  122. baseUrl: "#{chatUrl}/chat"
  123. });
  124. chatReq(["require", "chat"], function(require, Chat) {
  125. new Chat({
  126. room: {
  127. project_id: window.userSettings.project_id
  128. },
  129. url: "#{chatUrl}"
  130. })
  131. });