2017-09-27 11:35:28 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.controller "AutoCompileOnboardingController", ($scope) ->
|
2017-09-27 12:45:28 -04:00
|
|
|
recompileBtn = angular.element('#recompile')
|
2017-09-28 06:32:38 -04:00
|
|
|
popover = angular.element('.onboarding__autocompile')
|
2017-09-27 12:45:28 -04:00
|
|
|
{ top, left } = recompileBtn.offset()
|
2017-09-28 06:32:38 -04:00
|
|
|
|
2017-09-28 07:16:02 -04:00
|
|
|
# If pdf panel smaller than recompile button + popover, show to left.
|
|
|
|
# Otherwise show to right
|
2017-09-28 06:32:38 -04:00
|
|
|
if $scope.ui.pdfWidth < 475
|
|
|
|
$scope.placement = 'left'
|
|
|
|
popover.offset({
|
|
|
|
top: top,
|
2017-09-28 06:55:20 -04:00
|
|
|
left: left - popover.width()
|
2017-09-28 06:32:38 -04:00
|
|
|
})
|
|
|
|
else
|
|
|
|
$scope.placement = 'right'
|
|
|
|
angular.element('.onboarding__autocompile').offset({
|
|
|
|
top: top,
|
2017-09-28 06:55:20 -04:00
|
|
|
left: left + recompileBtn.width()
|
2017-09-28 06:32:38 -04:00
|
|
|
})
|
|
|
|
|
2017-09-27 12:20:06 -04:00
|
|
|
$scope.dismiss = () ->
|
|
|
|
$scope.onboarding.autoCompile = 'dismissed'
|