Decouple ranges update from the overview panel; integrate it with the dropdown.

This commit is contained in:
Paulo Reis 2017-01-09 14:59:01 +00:00
parent 5e483f2a97
commit 037389b7dd
4 changed files with 47 additions and 11 deletions

View file

@ -4,6 +4,8 @@
entries="reviewPanel.entries"
threads="reviewPanel.commentThreads"
docs="docs"
on-open="refreshResolvedCommentsDropdown();"
is-loading="reviewPanel.dropdown.loading"
)
span.review-panel-toolbar-label(ng-click="editor.wantTrackChanges = true;", ng-if="editor.wantTrackChanges === false") Track Changes is
strong off
@ -50,7 +52,7 @@
.rp-entry-list(
ng-if="reviewPanel.subView === SubViews.OVERVIEW"
)
.rp-overview-loading(ng-if="reviewPanel.overview.loading")
.rp-loading(ng-if="reviewPanel.overview.loading")
i.fa.fa-spinner.fa-spin
.rp-overview-file(
ng-repeat="doc in docs"
@ -249,13 +251,16 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate')
//- )
a.resolved-comments-toggle(
href
ng-click="state.isOpen = !state.isOpen"
ng-click="toggleOpenState();"
)
i.fa.fa-inbox
.resolved-comments-dropdown(
ng-class="{ 'resolved-comments-dropdown-open' : state.isOpen }"
)
.rp-loading(ng-if="isLoading")
i.fa.fa-spinner.fa-spin
div(
ng-if="!isLoading"
ng-repeat="doc in docs"
)
resolved-comment-entry(

View file

@ -18,6 +18,8 @@ define [
openSubView: $scope.SubViews.CUR_FILE
overview:
loading: false
dropdown:
loading: false
commentThreads: {}
$scope.commentState =
@ -115,8 +117,7 @@ define [
getChangeTracker(doc.doc_id).setIdSeed(new_id)
doc.setTrackChangesIdSeeds({pending: new_id, inflight: old_id})
refreshOverviewPanel = () ->
$scope.reviewPanel.overview.loading = true
refreshRanges = () ->
$http.get "/project/#{$scope.project_id}/ranges"
.success (docs) ->
for doc in docs
@ -125,11 +126,27 @@ define [
rangesTrackers[doc.id].comments = doc.ranges?.comments or []
rangesTrackers[doc.id].changes = doc.ranges?.changes or []
updateEntries(doc.id)
$scope.reviewPanel.overview.loading = false
# $scope.reviewPanel.overview.loading = false
.error (error) ->
console.log "loading ranges errored", error
# $scope.reviewPanel.overview.loading = false
refreshOverviewPanel = () ->
$scope.reviewPanel.overview.loading = true
refreshRanges()
.then () ->
$scope.reviewPanel.overview.loading = false
.catch () ->
$scope.reviewPanel.overview.loading = false
$scope.refreshResolvedCommentsDropdown = () ->
$scope.reviewPanel.dropdown.loading = true
refreshRanges()
.then () ->
$scope.reviewPanel.dropdown.loading = false
.catch () ->
$scope.reviewPanel.dropdown.loading = false
updateEntries = (doc_id) ->
rangesTracker = getChangeTracker(doc_id)
entries = getDocEntries(doc_id)

View file

@ -5,13 +5,22 @@ define [
restrict: "E"
templateUrl: "resolvedCommentsDropdownTemplate"
scope:
entries : "="
threads : "="
docs : "="
entries : "="
threads : "="
docs : "="
onOpen : "&"
isLoading : "="
link: (scope, element, attrs) ->
scope.state =
isOpen: false
scope.toggleOpenState = () ->
scope.state.isOpen = !scope.state.isOpen
if (scope.state.isOpen)
console.log('will call stuff')
scope.onOpen()
scope.resolvedCommentsPerFile = {}
filterResolvedComments = () ->

View file

@ -313,7 +313,7 @@
.rp-entry-actions {
display: flex;
.rp-entry-list .rp-state-overview & {
.rp-state-overview .rp-entry-list & {
display: none;
}
}
@ -340,7 +340,7 @@
border-bottom-width: 0;
}
.rp-entry-list .rp-state-overview & {
.rp-state-overview .rp-entry-list & {
margin: 4px 5px;
&:first-child {
@ -498,6 +498,11 @@
text-align: center;
}
.rp-loading {
text-align: center;
padding: 5px;
}
.rp-nav {
display: flex;
flex-shrink: 0;