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(
ng-if="reviewPanel.entries[doc.doc.id] | notEmpty"
ng-click="reviewPanel.overview.docsCollapsedState[doc.doc.id] = ! reviewPanel.overview.docsCollapsedState[doc.doc.id]"
)
| {{ 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(
ng-repeat="(entry_id, entry) in reviewPanel.entries[doc.doc.id] | orderOverviewEntries"
ng-if="!(entry.type === 'comment' && reviewPanel.commentThreads[entry.thread_id].resolved === true)"

View file

@ -19,6 +19,7 @@ define [
openSubView: $scope.SubViews.CUR_FILE
overview:
loading: false
docsCollapsedState: {}
dropdown:
loading: false
commentThreads: {}
@ -171,6 +172,8 @@ define [
$http.get "/project/#{$scope.project_id}/ranges"
.success (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
rangesTracker = getChangeTracker(doc.id)
rangesTracker.comments = doc.ranges?.comments or []

View file

@ -567,6 +567,16 @@
margin-top: 10px;
font-weight: @rp-semibold-weight;
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 {