Sha256: 916dfe558b3c72a3b13bd3597c9e8f91b86146d9c29acebccdbb7d81dd7002ac

Contents?: true

Size: 1.46 KB

Versions: 23

Compression:

Stored size: 1.46 KB

Contents

class @Mercury.Statusbar

  constructor: (@options = {}) ->
    @visible = @options.visible
    @build()
    @bindEvents()


  build: ->
    @element = jQuery('<div>', {class: 'mercury-statusbar'})
    @aboutElement = jQuery('<a>', {class: "mercury-statusbar-about"}).appendTo(@element).html("DSC Kit Editor")
    @pathElement = jQuery('<div>', {class: 'mercury-statusbar-path'}).appendTo(@element)

    @element.css({visibility: 'hidden'}) unless @visible
    @element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')


  bindEvents: ->
    Mercury.on 'region:update', (event, options) =>
      @setPath(options.region.path()) if options.region && jQuery.type(options.region.path) == 'function'

    @aboutElement.on 'click', =>
      document.location = 'http://www.dsc.net'


  height: ->
    @element.outerHeight()


  top: ->
    top =  @element.offset().top
    currentTop = if parseInt(@element.css('bottom')) < 0 then top - @element.outerHeight() else top
    if @visible then currentTop else top + @element.outerHeight()


  setPath: (elements) ->
    path = []
    path.push("<a>#{element.tagName.toLowerCase()}</a>") for element in elements

    @pathElement.html("<span><strong>#{Mercury.I18n('Path:')} </strong>#{path.reverse().join(' &raquo; ')}</span>")


  show: ->
    @visible = true
    @element.css({opacity: 0, visibility: 'visible'})
    @element.animate({opacity: 1}, 200, 'easeInOutSine')


  hide: ->
    @visible = false
    @element.css({visibility: 'hidden'})

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
kiteditor-1.0.25 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.24 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.23 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.22 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.21 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.20 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.19 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.18 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.17 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.16 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.14 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.13 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.12 app/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.11 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.10 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.9 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.8 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.7 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.6 vendor/assets/javascripts/mercury/statusbar.js.coffee
kiteditor-1.0.5 vendor/assets/javascripts/mercury/statusbar.js.coffee