editor.jade 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. div.full-size(
  2. ng-show="ui.view == 'editor'"
  3. layout="pdf"
  4. layout-disabled="ui.pdfLayout != 'sideBySide'"
  5. mask-iframes-on-resize="true"
  6. resize-on="layout:main:resize"
  7. resize-proportionally="true"
  8. initial-size-east="'50%'"
  9. minimum-restore-size-east="300"
  10. allow-overflow-on="'center'"
  11. )
  12. .ui-layout-center(ng-controller="ReviewPanelController", ng-class="{'has-review-panel': ui.reviewPanelOpen, 'has-entries': reviewPanel.hasEntries }")
  13. .loading-panel(ng-show="!editor.sharejs_doc || editor.opening")
  14. span(ng-show="editor.open_doc_id")
  15. i.fa.fa-spin.fa-refresh
  16. |   #{translate("loading")}...
  17. span(ng-show="!editor.open_doc_id")
  18. i.fa.fa-arrow-left
  19. |   #{translate("open_a_file_on_the_left")}
  20. #editor(
  21. ace-editor="editor",
  22. ng-show="!!editor.sharejs_doc && !editor.opening"
  23. theme="settings.theme",
  24. keybindings="settings.mode",
  25. font-size="settings.fontSize",
  26. auto-complete="settings.autoComplete",
  27. spell-check="!anonymous",
  28. spell-check-language="project.spellCheckLanguage",
  29. highlights="onlineUserCursorHighlights[editor.open_doc_id]"
  30. show-print-margin="false",
  31. sharejs-doc="editor.sharejs_doc",
  32. last-updated="editor.last_updated",
  33. cursor-position="editor.cursorPosition",
  34. goto-line="editor.gotoLine",
  35. resize-on="layout:main:resize,layout:pdf:resize,layout:review:resize,review-panel:toggle",
  36. annotations="pdf.logEntryAnnotations[editor.open_doc_id]",
  37. read-only="!permissions.write",
  38. file-name="editor.open_doc_name",
  39. on-ctrl-enter="recompileViaKey",
  40. syntax-validation="settings.syntaxValidation",
  41. review-panel="reviewPanel",
  42. on-scroll="onScroll",
  43. scroll-events="scrollEvents",
  44. track-changes-enabled="trackChangesFeatureFlag",
  45. track-new-changes= "reviewPanel.trackNewChanges",
  46. changes-tracker="reviewPanel.changesTracker",
  47. doc-id="editor.open_doc_id"
  48. )
  49. #review-panel
  50. .review-panel-toolbar
  51. | Track Changes
  52. input(type="checkbox", ng-model="reviewPanel.trackNewChanges")
  53. .review-panel-scroller
  54. .rp-entry-list(
  55. review-panel-sorted
  56. ng-if="reviewPanel.subView === SubViews.CUR_FILE"
  57. )
  58. .rp-entry-wrapper(
  59. ng-repeat="(entry_id, entry) in reviewPanel.entries[editor.open_doc_id]"
  60. )
  61. .rp-entry-callout(
  62. ng-class="'rp-entry-callout-' + entry.type"
  63. )
  64. div(ng-switch="entry.type")
  65. .rp-entry-indicator(ng-switch-when="insert", ng-class="{ 'rp-entry-indicator-focused': entry.focused }")
  66. i.fa.fa-pencil
  67. .rp-entry-indicator(ng-switch-when="delete", ng-class="{ 'rp-entry-indicator-focused': entry.focused }")
  68. i.rp-icon-delete
  69. .rp-entry-indicator(ng-switch-when="comment", ng-class="{ 'rp-entry-indicator-focused': entry.focused }")
  70. i.fa.fa-comment
  71. .rp-entry-indicator(
  72. ng-switch-when="add-comment"
  73. ng-if="!commentState.adding"
  74. ng-click="startNewComment(); toggleReviewPanel();"
  75. )
  76. i.fa.fa-commenting
  77. .rp-entry(
  78. ng-class="[ 'rp-entry-' + entry.type, (commentState.adding ? 'rp-entry-adding-comment' : ''), (entry.focused ? 'rp-entry-focused' : '')]"
  79. )
  80. div(ng-if="entry.type == 'insert' || entry.type == 'delete'")
  81. .rp-entry-header
  82. .rp-entry-action-icon(ng-switch="entry.type")
  83. i.fa.fa-pencil(ng-switch-when="insert")
  84. i.rp-icon-delete(ng-switch-when="delete")
  85. .rp-entry-metadata
  86. p.rp-entry-metadata-line(style="color: hsl({{ users[entry.metadata.user_id].hue }}, 70%, 50%);") {{ users[entry.metadata.user_id].name }}
  87. p.rp-entry-metadata-line {{ entry.metadata.ts | date : 'MMM d, y h:mm a' }}
  88. .rp-avatar(style="background-color: hsl({{ users[entry.metadata.user_id].hue }}, 70%, 50%);") {{ users[entry.metadata.user_id].avatar_text }}
  89. .rp-entry-body(ng-switch="entry.type")
  90. span(ng-switch-when="insert") Added 
  91. ins.rp-content-highlight {{ entry.content }}
  92. span(ng-switch-when="delete") Delete 
  93. del.rp-content-highlight {{ entry.content }}
  94. .rp-entry-actions
  95. a.rp-entry-button(href, ng-click="rejectChange(entry_id)")
  96. i.fa.fa-times
  97. |  Reject
  98. a.rp-entry-button(href, ng-click="acceptChange(entry_id)")
  99. i.fa.fa-check
  100. |  Accept
  101. div(ng-if="entry.type == 'comment'")
  102. .rp-comment(
  103. ng-repeat="comment in entry.thread"
  104. ng-class="users[comment.user_id].isSelf ? 'rp-comment-self' : '';"
  105. )
  106. .rp-avatar(
  107. ng-if="!users[comment.user_id].isSelf;"
  108. style="background-color: hsl({{ users[comment.user_id].hue }}, 70%, 50%);"
  109. ) {{ users[comment.user_id].avatar_text }}
  110. .rp-comment-body(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 90%);")
  111. p.rp-comment-content {{ comment.content }}
  112. p.rp-comment-metadata
  113. | {{ comment.ts | date : 'MMM d, y h:mm a' }}
  114. |  • 
  115. span(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 40%);") {{ users[comment.user_id].name }}
  116. .rp-comment-reply
  117. textarea.rp-comment-input(
  118. ng-model="entry.replyContent"
  119. ng-keypress="handleCommentReplyKeyPress($event, entry);"
  120. placeholder="Hit \"Enter\" to reply"
  121. )
  122. .rp-entry-actions
  123. a.rp-entry-button(href)
  124. i.fa.fa-check
  125. |  Mark as resolved
  126. div(ng-if="entry.type == 'add-comment'")
  127. a.rp-add-comment-btn(
  128. href
  129. ng-if="!commentState.adding"
  130. ng-click="startNewComment()"
  131. )
  132. i.fa.fa-comment
  133. |  Add comment
  134. div(ng-if="commentState.adding")
  135. .rp-new-comment
  136. textarea.rp-comment-input(
  137. ng-model="commentState.content"
  138. placeholder="Add your comment here"
  139. )
  140. .rp-entry-actions
  141. a.rp-entry-button(href, ng-click="cancelNewComment()")
  142. i.fa.fa-times
  143. |  Cancel
  144. a.rp-entry-button(href, ng-click="submitNewComment()")
  145. i.fa.fa-comment
  146. |  Comment
  147. .rp-overview-entry-list(
  148. ng-if="reviewPanel.subView === SubViews.OVERVIEW"
  149. )
  150. .rp-overview-file(
  151. ng-repeat="(doc_id, entries) in reviewPanel.entries"
  152. )
  153. .rp-overview-file-header
  154. | {{ doc_id }}
  155. .rp-entry-wrapper(
  156. ng-repeat="(entry_id, entry) in entries"
  157. )
  158. .rp-entry-callout(
  159. ng-class="'rp-entry-callout-' + entry.type"
  160. )
  161. div(ng-switch="entry.type")
  162. .rp-entry-indicator(ng-switch-when="insert", ng-class="{ 'rp-entry-indicator-focused': entry.focused }")
  163. i.fa.fa-pencil
  164. .rp-entry-indicator(ng-switch-when="delete", ng-class="{ 'rp-entry-indicator-focused': entry.focused }")
  165. i.rp-icon-delete
  166. .rp-entry-indicator(ng-switch-when="comment", ng-class="{ 'rp-entry-indicator-focused': entry.focused }")
  167. i.fa.fa-comment
  168. .rp-entry-indicator(
  169. ng-switch-when="add-comment"
  170. ng-if="!commentState.adding"
  171. ng-click="startNewComment(); toggleReviewPanel();"
  172. )
  173. i.fa.fa-commenting
  174. .rp-entry(
  175. ng-class="[ 'rp-entry-' + entry.type, (commentState.adding ? 'rp-entry-adding-comment' : ''), (entry.focused ? 'rp-entry-focused' : '')]"
  176. )
  177. div(ng-if="entry.type == 'insert' || entry.type == 'delete'")
  178. .rp-entry-header
  179. .rp-entry-action-icon(ng-switch="entry.type")
  180. i.fa.fa-pencil(ng-switch-when="insert")
  181. i.rp-icon-delete(ng-switch-when="delete")
  182. .rp-entry-metadata
  183. p.rp-entry-metadata-line(style="color: hsl({{ users[entry.metadata.user_id].hue }}, 70%, 50%);") {{ users[entry.metadata.user_id].name }}
  184. p.rp-entry-metadata-line {{ entry.metadata.ts | date : 'MMM d, y h:mm a' }}
  185. .rp-avatar(style="background-color: hsl({{ users[entry.metadata.user_id].hue }}, 70%, 50%);") {{ users[entry.metadata.user_id].avatar_text }}
  186. .rp-entry-body(ng-switch="entry.type")
  187. span(ng-switch-when="insert") Added 
  188. ins.rp-content-highlight {{ entry.content }}
  189. span(ng-switch-when="delete") Delete 
  190. del.rp-content-highlight {{ entry.content }}
  191. .rp-entry-actions
  192. a.rp-entry-button(href, ng-click="rejectChange(entry_id)")
  193. i.fa.fa-times
  194. |  Reject
  195. a.rp-entry-button(href, ng-click="acceptChange(entry_id)")
  196. i.fa.fa-check
  197. |  Accept
  198. div(ng-if="entry.type == 'comment'")
  199. .rp-comment(
  200. ng-repeat="comment in entry.thread"
  201. ng-class="users[comment.user_id].isSelf ? 'rp-comment-self' : '';"
  202. )
  203. .rp-avatar(
  204. ng-if="!users[comment.user_id].isSelf;"
  205. style="background-color: hsl({{ users[comment.user_id].hue }}, 70%, 50%);"
  206. ) {{ users[comment.user_id].avatar_text }}
  207. .rp-comment-body(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 90%);")
  208. p.rp-comment-content {{ comment.content }}
  209. p.rp-comment-metadata
  210. | {{ comment.ts | date : 'MMM d, y h:mm a' }}
  211. |  • 
  212. span(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 40%);") {{ users[comment.user_id].name }}
  213. .rp-comment-reply
  214. textarea.rp-comment-input(
  215. ng-model="entry.replyContent"
  216. ng-keypress="handleCommentReplyKeyPress($event, entry);"
  217. placeholder="Hit \"Enter\" to reply"
  218. )
  219. .rp-entry-actions
  220. a.rp-entry-button(href)
  221. i.fa.fa-check
  222. |  Mark as resolved
  223. div(ng-if="entry.type == 'add-comment'")
  224. a.rp-add-comment-btn(
  225. href
  226. ng-if="!commentState.adding"
  227. ng-click="startNewComment()"
  228. )
  229. i.fa.fa-comment
  230. |  Add comment
  231. div(ng-if="commentState.adding")
  232. .rp-new-comment
  233. textarea.rp-comment-input(
  234. ng-model="commentState.content"
  235. placeholder="Add your comment here"
  236. )
  237. .rp-entry-actions
  238. a.rp-entry-button(href, ng-click="cancelNewComment()")
  239. i.fa.fa-times
  240. |  Cancel
  241. a.rp-entry-button(href, ng-click="submitNewComment()")
  242. i.fa.fa-comment
  243. |  Comment
  244. .rp-nav
  245. a.rp-nav-item(
  246. href
  247. ng-click="setSubView(SubViews.CUR_FILE);"
  248. ng-class="{ 'rp-nav-item-active' : reviewPanel.subView === SubViews.CUR_FILE }"
  249. )
  250. i.fa.fa-file-text-o
  251. span.rp-nav-label Current file
  252. a.rp-nav-item(
  253. href
  254. ng-click="setSubView(SubViews.OVERVIEW);"
  255. ng-class="{ 'rp-nav-item-active' : reviewPanel.subView === SubViews.OVERVIEW }"
  256. )
  257. i.fa.fa-list
  258. span.rp-nav-label Overview
  259. .ui-layout-east
  260. div(ng-if="ui.pdfLayout == 'sideBySide'")
  261. include ./pdf
  262. .ui-layout-resizer-controls.synctex-controls(
  263. ng-show="!!pdf.url && settings.pdfViewer == 'pdfjs'"
  264. ng-controller="PdfSynctexController"
  265. )
  266. a.btn.btn-default.btn-xs(
  267. tooltip="#{translate('go_to_code_location_in_pdf')}"
  268. tooltip-placement="right"
  269. tooltip-append-to-body="true"
  270. ng-click="syncToPdf()"
  271. )
  272. i.fa.fa-long-arrow-right
  273. br
  274. a.btn.btn-default.btn-xs(
  275. tooltip-html="'#{translate('go_to_pdf_location_in_code')}'"
  276. tooltip-placement="right"
  277. tooltip-append-to-body="true"
  278. ng-click="syncToCode()"
  279. )
  280. i.fa.fa-long-arrow-left
  281. div.full-size(
  282. ng-if="ui.pdfLayout == 'flat'"
  283. ng-show="ui.view == 'pdf'"
  284. )
  285. include ./pdf