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