Bootstrap collapsing behavior in files list. Store state.

This commit is contained in:
Paulo Reis 2017-02-16 15:48:58 +00:00
parent bb7ededaaf
commit a639f13cb6
3 changed files with 43 additions and 23 deletions

View file

@ -92,8 +92,15 @@
) )
.rp-overview-file-header( .rp-overview-file-header(
ng-if="reviewPanel.entries[doc.doc.id] | notEmpty" ng-if="reviewPanel.entries[doc.doc.id] | notEmpty"
ng-click="reviewPanel.overview.docsCollapsedState[doc.doc.id] = ! reviewPanel.overview.docsCollapsedState[doc.doc.id]"
) )
| {{ doc.path }} | {{ doc.path }}
span.rp-overview-file-header-collapse(
ng-class="{ 'rp-overview-file-header-collapse-on': reviewPanel.overview.docsCollapsedState[doc.doc.id] }"
)
i.fa.fa-angle-down
.rp-overview-file-entries(ng-class="{ 'rp-overview-file-entries-collapsed' : reviewPanel.overview.docsCollapsedState[doc.doc.id] }")
.rp-entry-wrapper( .rp-entry-wrapper(
ng-repeat="(entry_id, entry) in reviewPanel.entries[doc.doc.id] | orderOverviewEntries" ng-repeat="(entry_id, entry) in reviewPanel.entries[doc.doc.id] | orderOverviewEntries"
ng-if="!(entry.type === 'comment' && reviewPanel.commentThreads[entry.thread_id].resolved === true)" ng-if="!(entry.type === 'comment' && reviewPanel.commentThreads[entry.thread_id].resolved === true)"

View file

@ -19,6 +19,7 @@ define [
openSubView: $scope.SubViews.CUR_FILE openSubView: $scope.SubViews.CUR_FILE
overview: overview:
loading: false loading: false
docsCollapsedState: {}
dropdown: dropdown:
loading: false loading: false
commentThreads: {} commentThreads: {}
@ -171,6 +172,8 @@ define [
$http.get "/project/#{$scope.project_id}/ranges" $http.get "/project/#{$scope.project_id}/ranges"
.success (docs) -> .success (docs) ->
for doc in docs for doc in docs
if !$scope.reviewPanel.overview.docsCollapsedState[doc.id]?
$scope.reviewPanel.overview.docsCollapsedState[doc.id] = false
if doc.id != $scope.editor.open_doc_id # this is kept up to date in real-time, don't overwrite if doc.id != $scope.editor.open_doc_id # this is kept up to date in real-time, don't overwrite
rangesTracker = getChangeTracker(doc.id) rangesTracker = getChangeTracker(doc.id)
rangesTracker.comments = doc.ranges?.comments or [] rangesTracker.comments = doc.ranges?.comments or []

View file

@ -567,7 +567,17 @@
margin-top: 10px; margin-top: 10px;
font-weight: @rp-semibold-weight; font-weight: @rp-semibold-weight;
text-align: center; text-align: center;
cursor: pointer;
} }
.rp-overview-file-header-collapse {
display: inline-block;
float: right;
transform: rotateZ(0deg);
transition: transform 0.15s ease
}
.rp-overview-file-header-collapse-on {
transform: rotateZ(180deg);
}
.rp-comment-wrapper { .rp-comment-wrapper {
transition: .35s opacity ease-out .2s; transition: .35s opacity ease-out .2s;