mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add history toolbar (just scaffolding); show files at point in time.
This commit is contained in:
parent
81c93e11d0
commit
f4f3a4375b
10 changed files with 69 additions and 19 deletions
|
@ -57,9 +57,12 @@ block content
|
||||||
include ./editor/share
|
include ./editor/share
|
||||||
!= moduleIncludes("publish:body", locals)
|
!= moduleIncludes("publish:body", locals)
|
||||||
|
|
||||||
|
include ./editor/history/toolbarV2.pug
|
||||||
|
|
||||||
main#ide-body(
|
main#ide-body(
|
||||||
ng-cloak,
|
ng-cloak,
|
||||||
role="main",
|
role="main",
|
||||||
|
ng-class="{ 'ide-history-open' : (ui.view == 'history' && history.isV2) }",
|
||||||
layout="main",
|
layout="main",
|
||||||
ng-hide="state.loading",
|
ng-hide="state.loading",
|
||||||
resize-on="layout:chat:resize",
|
resize-on="layout:chat:resize",
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
aside.file-tree.file-tree-history.full-size(
|
aside.file-tree.full-size(
|
||||||
ng-controller="HistoryV2FileTreeController"
|
ng-controller="HistoryV2FileTreeController"
|
||||||
ng-if="ui.view == 'history' && history.isV2"
|
ng-if="ui.view == 'history' && history.isV2"
|
||||||
)
|
)
|
||||||
.toolbar.toolbar-filetree
|
.history-file-tree-inner
|
||||||
span Modified files
|
|
||||||
|
|
||||||
.file-tree-inner
|
|
||||||
history-file-tree(
|
history-file-tree(
|
||||||
file-tree="currentFileTree"
|
file-tree="currentFileTree"
|
||||||
selected-pathname="history.selection.pathname"
|
selected-pathname="history.selection.pathname"
|
||||||
|
|
|
@ -44,7 +44,7 @@ div#history(ng-show="ui.view == 'history'")
|
||||||
include ./history/entriesListV2
|
include ./history/entriesListV2
|
||||||
|
|
||||||
include ./history/diffPanelV1
|
include ./history/diffPanelV1
|
||||||
include ./history/diffPanelV2
|
include ./history/previewPanelV2
|
||||||
|
|
||||||
script(type="text/ng-template", id="historyRestoreDiffModalTemplate")
|
script(type="text/ng-template", id="historyRestoreDiffModalTemplate")
|
||||||
.modal-header
|
.modal-header
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
.diff-panel.full-size(ng-if="history.isV2", ng-controller="HistoryV2DiffController")
|
.diff-panel.full-size(
|
||||||
|
ng-if="history.isV2 && history.viewMode === HistoryViewModes.COMPARE"
|
||||||
|
ng-controller="HistoryV2DiffController"
|
||||||
|
)
|
||||||
.diff(
|
.diff(
|
||||||
ng-if="!!history.diff && !history.diff.loading && !history.diff.error",
|
ng-if="!!history.diff && !history.diff.loading && !history.diff.error",
|
||||||
ng-class="{ 'diff-binary': history.diff.binary }"
|
ng-class="{ 'diff-binary': history.diff.binary }"
|
||||||
|
@ -48,3 +51,18 @@
|
||||||
| #{translate("loading")}...
|
| #{translate("loading")}...
|
||||||
.error-panel(ng-show="history.diff.error")
|
.error-panel(ng-show="history.diff.error")
|
||||||
.alert.alert-danger #{translate("generic_something_went_wrong")}
|
.alert.alert-danger #{translate("generic_something_went_wrong")}
|
||||||
|
|
||||||
|
.point-in-time-panel.full-size(
|
||||||
|
ng-if="history.isV2 && history.viewMode === HistoryViewModes.POINT_IN_TIME"
|
||||||
|
)
|
||||||
|
.point-in-time-editor-container(
|
||||||
|
ng-if="!!history.selectedFile"
|
||||||
|
)
|
||||||
|
.hide-ace-cursor(
|
||||||
|
ace-editor="history-pointintime",
|
||||||
|
theme="settings.theme",
|
||||||
|
font-size="settings.fontSize",
|
||||||
|
text="history.selectedFile.text",
|
||||||
|
read-only="true",
|
||||||
|
resize-on="layout:main:resize",
|
||||||
|
)
|
|
@ -0,0 +1,4 @@
|
||||||
|
.history-toolbar(
|
||||||
|
ng-if="ui.view == 'history' && history.isV2"
|
||||||
|
) Browsing project as of
|
||||||
|
time.history-toolbar-time {{ history.selection.updates[0].meta.end_ts | formatDate:'Do MMM YYYY, h:mm a' }}
|
|
@ -15,6 +15,7 @@ define [
|
||||||
class HistoryManager
|
class HistoryManager
|
||||||
constructor: (@ide, @$scope) ->
|
constructor: (@ide, @$scope) ->
|
||||||
@reset()
|
@reset()
|
||||||
|
@$scope.HistoryViewModes = HistoryViewModes
|
||||||
|
|
||||||
@$scope.toggleHistory = () =>
|
@$scope.toggleHistory = () =>
|
||||||
if @$scope.ui.view == "history"
|
if @$scope.ui.view == "history"
|
||||||
|
@ -57,7 +58,8 @@ define [
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
files: []
|
files: []
|
||||||
diff: null
|
diff: null # When history.viewMode == HistoryViewModes.COMPARE
|
||||||
|
selectedFile: null # When history.viewMode == HistoryViewModes.POINT_IN_TIME
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreFile: (version, pathname) ->
|
restoreFile: (version, pathname) ->
|
||||||
|
@ -132,7 +134,8 @@ define [
|
||||||
@ide.$http
|
@ide.$http
|
||||||
.get(url)
|
.get(url)
|
||||||
.then (response) =>
|
.then (response) =>
|
||||||
{ data } = response
|
@$scope.history.selectedFile =
|
||||||
|
text : response.data.diff[0].u
|
||||||
.catch () ->
|
.catch () ->
|
||||||
|
|
||||||
reloadDiff: () ->
|
reloadDiff: () ->
|
||||||
|
|
|
@ -73,9 +73,13 @@
|
||||||
|
|
||||||
#ide-body {
|
#ide-body {
|
||||||
.full-size;
|
.full-size;
|
||||||
top: 40px;
|
top: @ide-body-top-offset;
|
||||||
|
&.ide-history-open {
|
||||||
|
top: @ide-body-top-offset + @editor-toolbar-height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#editor, #editor-rich-text {
|
#editor, #editor-rich-text {
|
||||||
.full-size;
|
.full-size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
.history-toolbar {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
top: @ide-body-top-offset;
|
||||||
|
height: @editor-toolbar-height;
|
||||||
|
line-height: @editor-toolbar-height;
|
||||||
|
background-color: @editor-toolbar-bg;
|
||||||
|
z-index: 1;
|
||||||
|
color: #FFF;
|
||||||
|
padding-left: (@line-height-computed / 2);
|
||||||
|
}
|
||||||
|
.history-toolbar-time {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
.history-entries {
|
.history-entries {
|
||||||
font-size: @history-base-font-size;
|
font-size: @history-base-font-size;
|
||||||
color: @history-base-color;
|
color: @history-base-color;
|
||||||
|
@ -64,7 +78,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-file-tree {
|
.history-file-tree-inner {
|
||||||
|
.full-size;
|
||||||
|
overflow-y: auto;
|
||||||
|
background-color: @file-tree-bg;
|
||||||
}
|
}
|
||||||
.history-file-entity-wrapper {
|
.history-file-entity-wrapper {
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.diff-panel {
|
.diff-panel,
|
||||||
|
.point-in-time-panel {
|
||||||
.full-size;
|
.full-size;
|
||||||
margin-right: @changesListWidth;
|
margin-right: @changesListWidth;
|
||||||
}
|
}
|
||||||
|
@ -59,11 +60,7 @@
|
||||||
.full-size;
|
.full-size;
|
||||||
top: 40px;
|
top: 40px;
|
||||||
}
|
}
|
||||||
.hide-ace-cursor {
|
|
||||||
.ace_active-line, .ace_cursor-layer, .ace_gutter-active-line {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.diff-deleted {
|
.diff-deleted {
|
||||||
padding: @line-height-computed;
|
padding: @line-height-computed;
|
||||||
}
|
}
|
||||||
|
@ -305,6 +302,12 @@
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hide-ace-cursor {
|
||||||
|
.ace_active-line, .ace_cursor-layer, .ace_gutter-active-line {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.editor-dark {
|
.editor-dark {
|
||||||
#history {
|
#history {
|
||||||
aside.change-list {
|
aside.change-list {
|
||||||
|
|
|
@ -888,6 +888,7 @@
|
||||||
@footer-padding : 2em;
|
@footer-padding : 2em;
|
||||||
|
|
||||||
// Editor header
|
// Editor header
|
||||||
|
@ide-body-top-offset : 40px;
|
||||||
@toolbar-header-bg-color : transparent;
|
@toolbar-header-bg-color : transparent;
|
||||||
@toolbar-header-shadow : 0 0 2px #ccc;
|
@toolbar-header-shadow : 0 0 2px #ccc;
|
||||||
@toolbar-btn-color : @link-color;
|
@toolbar-btn-color : @link-color;
|
||||||
|
|
Loading…
Reference in a new issue