mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 12:04:14 -05:00
Toggle review panel and track changes with ui elements
This commit is contained in:
parent
a907ec04fc
commit
064ae1945a
7 changed files with 65 additions and 10 deletions
|
@ -41,9 +41,13 @@ div.full-size(
|
||||||
review-panel="reviewPanel",
|
review-panel="reviewPanel",
|
||||||
on-scroll="onScroll",
|
on-scroll="onScroll",
|
||||||
scroll-events="scrollEvents",
|
scroll-events="scrollEvents",
|
||||||
track-changes-enabled="true"
|
track-changes-enabled="trackChangesFeatureFlag"
|
||||||
|
track-new-changes= "reviewPanel.trackNewChanges"
|
||||||
)
|
)
|
||||||
#review-panel
|
#review-panel
|
||||||
|
.review-panel-toolbar
|
||||||
|
| Track Changes
|
||||||
|
input(type="checkbox", ng-model="reviewPanel.trackNewChanges")
|
||||||
.review-panel-scroller
|
.review-panel-scroller
|
||||||
.review-entry-list(review-panel-sorted)
|
.review-entry-list(review-panel-sorted)
|
||||||
.review-entry(ng-repeat="(entry_id, entry) in reviewPanel.entries", ng-style="{'top': top}")
|
.review-entry(ng-repeat="(entry_id, entry) in reviewPanel.entries", ng-style="{'top': top}")
|
||||||
|
|
|
@ -90,7 +90,15 @@ div(ng-if="!shouldABTestHeaderLabels")
|
||||||
) {{ user.name.slice(0,1) }}
|
) {{ user.name.slice(0,1) }}
|
||||||
| {{ user.name }}
|
| {{ user.name }}
|
||||||
|
|
||||||
|
a.btn.btn-full-height(
|
||||||
|
href,
|
||||||
|
ng-if="trackChangesFeatureFlag",
|
||||||
|
ng-class="{ active: ui.reviewPanelOpen }"
|
||||||
|
tooltip="#{translate('review')}",
|
||||||
|
tooltip-placement="bottom",
|
||||||
|
ng-click="toggleReviewPanel()"
|
||||||
|
)
|
||||||
|
| Review
|
||||||
a.btn.btn-full-height(
|
a.btn.btn-full-height(
|
||||||
href,
|
href,
|
||||||
ng-if="permissions.admin",
|
ng-if="permissions.admin",
|
||||||
|
|
|
@ -57,6 +57,9 @@ define [
|
||||||
else
|
else
|
||||||
this.$originalApply(fn);
|
this.$originalApply(fn);
|
||||||
|
|
||||||
|
if window.location.search.match /tcon=true/ # track changes on
|
||||||
|
$scope.trackChangesFeatureFlag = true
|
||||||
|
|
||||||
$scope.state = {
|
$scope.state = {
|
||||||
loading: true
|
loading: true
|
||||||
load_progress: 40
|
load_progress: 40
|
||||||
|
@ -67,12 +70,11 @@ define [
|
||||||
view: "editor"
|
view: "editor"
|
||||||
chatOpen: false
|
chatOpen: false
|
||||||
pdfLayout: 'sideBySide'
|
pdfLayout: 'sideBySide'
|
||||||
reviewPanelOpen: false
|
reviewPanelOpen: localStorage("ui.reviewPanelOpen.#{window.project_id}") and $scope.trackChangesFeatureFlag
|
||||||
showCodeCheckerOnboarding: !window.userSettings.syntaxValidation?
|
showCodeCheckerOnboarding: !window.userSettings.syntaxValidation?
|
||||||
}
|
}
|
||||||
$scope.user = window.user
|
$scope.user = window.user
|
||||||
|
|
||||||
|
|
||||||
$scope.shouldABTestPlans = false
|
$scope.shouldABTestPlans = false
|
||||||
if $scope.user.signUpDate >= '2016-10-27'
|
if $scope.user.signUpDate >= '2016-10-27'
|
||||||
$scope.shouldABTestPlans = true
|
$scope.shouldABTestPlans = true
|
||||||
|
@ -82,9 +84,12 @@ define [
|
||||||
|
|
||||||
$scope.chat = {}
|
$scope.chat = {}
|
||||||
|
|
||||||
ide.toggleReviewPanel = () ->
|
ide.toggleReviewPanel = $scope.toggleReviewPanel = () ->
|
||||||
$scope.ui.reviewPanelOpen = !$scope.ui.reviewPanelOpen
|
$scope.ui.reviewPanelOpen = !$scope.ui.reviewPanelOpen
|
||||||
$scope.$digest()
|
|
||||||
|
$scope.$watch "ui.reviewPanelOpen", (value) ->
|
||||||
|
if value?
|
||||||
|
localStorage "ui.reviewPanelOpen.#{window.project_id}", value
|
||||||
|
|
||||||
# Only run the header AB test for newly registered users.
|
# Only run the header AB test for newly registered users.
|
||||||
_abTestStartDate = new Date(Date.UTC(2016, 8, 28))
|
_abTestStartDate = new Date(Date.UTC(2016, 8, 28))
|
||||||
|
|
|
@ -55,6 +55,7 @@ define [
|
||||||
reviewPanel: "="
|
reviewPanel: "="
|
||||||
onScroll: "="
|
onScroll: "="
|
||||||
scrollEvents: "="
|
scrollEvents: "="
|
||||||
|
trackNewChanges: "="
|
||||||
trackChangesEnabled: "="
|
trackChangesEnabled: "="
|
||||||
}
|
}
|
||||||
link: (scope, element, attrs) ->
|
link: (scope, element, attrs) ->
|
||||||
|
@ -87,8 +88,6 @@ define [
|
||||||
highlightsManager = new HighlightsManager(scope, editor, element)
|
highlightsManager = new HighlightsManager(scope, editor, element)
|
||||||
cursorPositionManager = new CursorPositionManager(scope, editor, element, localStorage)
|
cursorPositionManager = new CursorPositionManager(scope, editor, element, localStorage)
|
||||||
trackChangesManager = new TrackChangesManager(scope, editor, element)
|
trackChangesManager = new TrackChangesManager(scope, editor, element)
|
||||||
if scope.trackChangesEnabled and window.location.search.match /tcon=true/ # track changes on
|
|
||||||
trackChangesManager.enabled = true
|
|
||||||
|
|
||||||
# Prevert Ctrl|Cmd-S from triggering save dialog
|
# Prevert Ctrl|Cmd-S from triggering save dialog
|
||||||
editor.commands.addCommand
|
editor.commands.addCommand
|
||||||
|
@ -217,6 +216,21 @@ define [
|
||||||
session = editor.getSession()
|
session = editor.getSession()
|
||||||
session.setOption("useWorker", value);
|
session.setOption("useWorker", value);
|
||||||
|
|
||||||
|
scope.$watch "trackNewChanges", (track_new_changes) ->
|
||||||
|
return if !track_new_changes?
|
||||||
|
if track_new_changes
|
||||||
|
trackChangesManager.turn_on_tracking()
|
||||||
|
else
|
||||||
|
trackChangesManager.turn_off_tracking()
|
||||||
|
|
||||||
|
scope.$watch "trackChangesEnabled", (enabled) ->
|
||||||
|
return if !enabled?
|
||||||
|
if enabled
|
||||||
|
trackChangesManager.enable()
|
||||||
|
else
|
||||||
|
trackChangesManager.disable()
|
||||||
|
|
||||||
|
|
||||||
editor.setOption("scrollPastEnd", true)
|
editor.setOption("scrollPastEnd", true)
|
||||||
|
|
||||||
updateCount = 0
|
updateCount = 0
|
||||||
|
|
|
@ -9,9 +9,7 @@ define [
|
||||||
|
|
||||||
constructor: (@$scope, @editor, @element) ->
|
constructor: (@$scope, @editor, @element) ->
|
||||||
@changesTracker = new ChangesTracker()
|
@changesTracker = new ChangesTracker()
|
||||||
@changesTracker.track_changes = true
|
|
||||||
@changeIdToMarkerIdMap = {}
|
@changeIdToMarkerIdMap = {}
|
||||||
@enabled = false
|
|
||||||
window.trackChangesManager ?= @
|
window.trackChangesManager ?= @
|
||||||
|
|
||||||
@changesTracker.on "insert:added", (change) =>
|
@changesTracker.on "insert:added", (change) =>
|
||||||
|
@ -69,6 +67,18 @@ define [
|
||||||
@editor.renderer.on "resize", () =>
|
@editor.renderer.on "resize", () =>
|
||||||
@recalculateReviewEntriesScreenPositions()
|
@recalculateReviewEntriesScreenPositions()
|
||||||
|
|
||||||
|
enable: () ->
|
||||||
|
@enabled = true
|
||||||
|
|
||||||
|
disable: () ->
|
||||||
|
@disabled = false
|
||||||
|
|
||||||
|
turn_on_tracking: () ->
|
||||||
|
@changesTracker.track_changes = true
|
||||||
|
|
||||||
|
turn_off_tracking: () ->
|
||||||
|
@changesTracker.track_changes = false
|
||||||
|
|
||||||
addComment: (offset, length, comment) ->
|
addComment: (offset, length, comment) ->
|
||||||
@changesTracker.addComment offset, length, {
|
@changesTracker.addComment offset, length, {
|
||||||
comment: comment
|
comment: comment
|
||||||
|
|
|
@ -5,6 +5,7 @@ define [
|
||||||
App.controller "ReviewPanelController", ($scope, $element, ide) ->
|
App.controller "ReviewPanelController", ($scope, $element, ide) ->
|
||||||
$scope.reviewPanel =
|
$scope.reviewPanel =
|
||||||
entries: {}
|
entries: {}
|
||||||
|
trackNewChanges: false
|
||||||
|
|
||||||
scroller = $element.find(".review-panel-scroller")
|
scroller = $element.find(".review-panel-scroller")
|
||||||
list = $element.find(".review-entry-list")
|
list = $element.find(".review-entry-list")
|
||||||
|
|
|
@ -11,6 +11,19 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.review-panel-toolbar {
|
||||||
|
height: 32px;
|
||||||
|
padding: 6px;
|
||||||
|
border-bottom: 1px solid grey;
|
||||||
|
background-color: #eee;
|
||||||
|
text-align: center;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.review-panel-scroller {
|
.review-panel-scroller {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
Loading…
Reference in a new issue