toolbarV2.pug 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. .history-toolbar(
  2. ng-controller="HistoryV2ToolbarController"
  3. ng-if="ui.view == 'history' && history.isV2"
  4. )
  5. span.history-toolbar-selected-version(ng-show="history.loadingFileTree")
  6. i.fa.fa-spin.fa-refresh
  7. |    #{translate("loading")}…
  8. //- point-in-time mode info
  9. span.history-toolbar-selected-version(
  10. ng-show="!history.loadingFileTree && history.viewMode === HistoryViewModes.POINT_IN_TIME && !history.showOnlyLabels && currentUpdate && !history.error"
  11. ) #{translate("browsing_project_as_of")} 
  12. time.history-toolbar-time {{ currentUpdate.meta.end_ts | formatDate:'Do MMM YYYY, h:mm a' }}
  13. span.history-toolbar-selected-version(
  14. ng-show="!history.loadingFileTree && history.viewMode === HistoryViewModes.POINT_IN_TIME && history.showOnlyLabels && currentUpdate && !history.error"
  15. )
  16. span(ng-if="currentUpdate.labels.length > 0")
  17. | #{translate("browsing_project_labelled")} 
  18. span.history-toolbar-selected-label(
  19. ng-repeat="label in currentUpdate.labels"
  20. )
  21. | {{ label.comment }}
  22. span(ng-if="!$last") ,
  23. span.history-toolbar-selected-label(ng-if="currentUpdate.labels.length === 0 && history.labels[0].isPseudoCurrentStateLabel && currentUpdate.toV === history.labels[0].version")
  24. | #{translate("browsing_project_latest_for_pseudo_label")}
  25. //- compare mode info
  26. span.history-toolbar-selected-version(ng-if="history.viewMode === HistoryViewModes.COMPARE && history.selection.diff && !history.selection.diff.binary && !history.selection.diff.loading && !history.selection.diff.error && !history.loadingFileTree")
  27. | <strong>{{history.selection.diff.highlights.length}} </strong>
  28. ng-pluralize(
  29. count="history.selection.diff.highlights.length",
  30. when="{\
  31. 'one': 'change',\
  32. 'other': 'changes'\
  33. }"
  34. )
  35. | in <strong>{{history.selection.diff.pathname}}</strong>
  36. //- point-in-time mode actions
  37. div.history-toolbar-actions(
  38. ng-if="history.viewMode === HistoryViewModes.POINT_IN_TIME && !history.error && history.updates.length > 0"
  39. )
  40. button.history-toolbar-btn(
  41. ng-click="showAddLabelDialog();"
  42. ng-if="!history.showOnlyLabels && permissions.write"
  43. ng-disabled="isHistoryLoading() || history.selection.range.toV == null || history.selection.range.fromV == null"
  44. )
  45. i.fa.fa-tag
  46. | &nbsp;#{translate("history_label_this_version")}
  47. button.history-toolbar-btn(
  48. ng-click="toggleHistoryViewMode();"
  49. ng-disabled="isHistoryLoading()"
  50. )
  51. i.fa.fa-exchange
  52. | &nbsp;#{translate("compare_to_another_version")}
  53. a.history-toolbar-btn-danger.pull-right(
  54. ng-hide="history.loadingFileTree || history.selection.range.toV == null"
  55. ng-href="/project/{{ project_id }}/version/{{ history.selection.range.toV }}/zip"
  56. target="_blank"
  57. )
  58. i.fa.fa-download
  59. | &nbsp;#{translate("download_project_at_this_version")}
  60. //- compare mode actions
  61. div.history-toolbar-actions(
  62. ng-if="history.viewMode === HistoryViewModes.COMPARE && !history.error && history.updates.length > 0"
  63. )
  64. button.history-toolbar-btn(
  65. ng-click="toggleHistoryViewMode();"
  66. ng-disabled="isHistoryLoading()"
  67. )
  68. i.fa
  69. | #{translate("view_single_version")}
  70. button.history-toolbar-btn-danger.pull-right(
  71. ng-if="history.selection.file.deletedAtV"
  72. ng-click="restoreDeletedFile()"
  73. ng-show="!restoreState.error"
  74. ng-disabled="restoreState.inflight"
  75. )
  76. i.fa.fa-fw.fa-step-backward
  77. span(ng-show="!restoreState.inflight")
  78. | Restore this deleted file
  79. span(ng-show="restoreState.inflight")
  80. | Restoring…
  81. span.text-danger(ng-show="restoreState.error")
  82. | Error restoring, sorry
  83. .history-toolbar-entries-list(
  84. ng-if="!history.error && history.updates.length > 0"
  85. )
  86. toggle-switch(
  87. ng-model="toolbarUIConfig.showOnlyLabels"
  88. label-true=translate("history_view_labels")
  89. label-false=translate("history_view_all")
  90. description=translate("history_view_a11y_description")
  91. )
  92. script(type="text/ng-template", id="historyV2AddLabelModalTemplate")
  93. form(
  94. name="addLabelModalForm"
  95. ng-submit="addLabelModalFormSubmit();"
  96. novalidate
  97. )
  98. .modal-header
  99. h3 #{translate("history_add_label")}
  100. .modal-body
  101. .alert.alert-danger(ng-show="state.error.message") {{ state.error.message}}
  102. .alert.alert-danger(ng-show="state.error && !state.error.message") #{translate("generic_something_went_wrong")}
  103. .form-group
  104. input.form-control(
  105. type="text"
  106. placeholder=translate("history_new_label_name")
  107. ng-model="inputs.labelName"
  108. focus-on="open"
  109. required
  110. )
  111. p.help-block(ng-if="update")
  112. | #{translate("history_new_label_added_at")}
  113. strong {{ update.meta.end_ts | formatDate:'ddd Do MMM YYYY, h:mm a' }}
  114. .modal-footer
  115. button.btn.btn-default(
  116. type="button"
  117. ng-disabled="state.inflight"
  118. ng-click="$dismiss()"
  119. ) #{translate("cancel")}
  120. input.btn.btn-primary(
  121. ng-disabled="addLabelModalForm.$invalid || state.inflight"
  122. ng-value="state.inflight ? '" + translate("history_adding_label") + "' : '" + translate("history_add_label") + "'"
  123. type="submit"
  124. )