mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #267 from sharelatex/pr-log-dropdown
"Other logs & files" dropdown / dropup
This commit is contained in:
commit
efacd9e7f2
3 changed files with 33 additions and 5 deletions
|
@ -145,7 +145,7 @@ div.full-size.pdf(ng-controller="PdfController")
|
|||
p.entry-content(ng-show="entry.content") {{ entry.content.trim() }}
|
||||
|
||||
p
|
||||
.pull-right
|
||||
.files-dropdown-container
|
||||
a.btn.btn-default.btn-sm(
|
||||
href,
|
||||
tooltip="#{translate('clear_cached_files')}",
|
||||
|
@ -155,12 +155,15 @@ div.full-size.pdf(ng-controller="PdfController")
|
|||
)
|
||||
i.fa.fa-trash-o
|
||||
|
|
||||
div.dropdown(style="display: inline-block;", dropdown)
|
||||
div.files-dropdown(
|
||||
ng-class="shouldDropUp ? 'dropup' : 'dropdown'"
|
||||
dropdown
|
||||
)
|
||||
a.btn.btn-default.btn-sm(
|
||||
href
|
||||
dropdown-toggle
|
||||
)
|
||||
| !{translate("other_logs_and_files")}
|
||||
| !{translate("other_logs_and_files")}
|
||||
span.caret
|
||||
ul.dropdown-menu.dropdown-menu-right
|
||||
li(ng-repeat="file in pdf.outputFiles")
|
||||
|
|
|
@ -15,6 +15,22 @@ define [
|
|||
$scope.shouldShowLogs = false
|
||||
$scope.wikiEnabled = window.wikiEnabled;
|
||||
|
||||
# view logic to check whether the files dropdown should "drop up" or "drop down"
|
||||
$scope.shouldDropUp = false
|
||||
|
||||
logsContainerEl = document.querySelector ".pdf-logs"
|
||||
filesDropdownEl = logsContainerEl?.querySelector ".files-dropdown"
|
||||
|
||||
# get the top coordinate of the files dropdown as a ratio (to the logs container height)
|
||||
# logs container supports scrollable content, so it's possible that ratio > 1.
|
||||
getFilesDropdownTopCoordAsRatio = () ->
|
||||
filesDropdownEl?.getBoundingClientRect().top / logsContainerEl?.getBoundingClientRect().height
|
||||
|
||||
$scope.$watch "shouldShowLogs", (shouldShow) ->
|
||||
if shouldShow
|
||||
$scope.$applyAsync () ->
|
||||
$scope.shouldDropUp = getFilesDropdownTopCoordAsRatio() > 0.65
|
||||
|
||||
# log hints tracking
|
||||
$scope.trackLogHintsLearnMore = () ->
|
||||
event_tracking.sendCountly "logs-hints-learn-more"
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
font-weight: 700;
|
||||
|
||||
.fa {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.entry-message {
|
||||
|
@ -138,7 +138,7 @@
|
|||
&:hover .line-no {
|
||||
color: inherit;
|
||||
.fa {
|
||||
display: inline-block;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,3 +284,12 @@
|
|||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.files-dropdown-container {
|
||||
.pull-right();
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.files-dropdown {
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue