 BaseView = require 'lib/base_view'
-
 module.exports = class PopoverView extends BaseView
 
     template: require 'views/templates/popover'

        popoverWidth = @$popover.innerWidth()

        # Container is the screen, except the sidebar.
        containerOffset = @container.offset()
        containerHeight = @container.innerHeight()
        containerWidth = @container.innerWidth()

        # Target is the calendar's cell clicked.
        targetOffset = @target.offset()
        targetWidth = @target.width()
        targetLeftBorder = targetOffset.left - containerOffset.left

        # Margin between the popover and the cell.
        popoverMargin = 15

        # Cell is on the left side
        if targetOffset.left < (containerWidth / 2)
            left = targetLeftBorder + targetWidth + popoverMargin

        # Cell is on the right side
        else
            left = targetLeftBorder - popoverWidth - popoverMargin

        # Cell is on the upper side
        if targetOffset.top < (containerHeight / 2)
            top = '10vh'
            bottom = 'auto'

        # Cell is on the lower side
        else
            top = 'auto'
            bottom = '5vh'

        @target = options.target
        @container = options.container
        @parentView = options.parentView
        @$tabCells = $ '.fc-day-grid-container'

        return @

