Sha256: 252cb8d18469f9c01763801d5703ce1668bee3ef8741ff6127a3b63422fa7308

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

class @Notifications
  IMAGES =
    success: '<%= image_path "deploy_success.jpg" %>'
    failed: '<%= image_path "deploy_failed.jpg" %>'
    error: '<%= image_path "deploy_error.jpg" %>'

  @init: (outputStream) ->
    outputStream.addEventListener('status', new this().statusUpdated)

  statusUpdated: (task) =>
    return if task.status in ['pending', 'running']
    return unless $.notifyCheck() == $.NOTIFY_ALLOWED
    $.notify(@url(task), @title(task), @message(task))

  url: (task) ->
    IMAGES[task.status]

  message: (task) ->
    deployShortSha = $('.short-sha').text()
    switch task.status
      when 'success'
        'Your deploy of ' + deployShortSha + ' was successful!'
      when 'failed'
        'Your deploy of ' + deployShortSha + ' failed.'
      when 'error'
        'Error while deploying ' + deployShortSha + ' .'
      else
        'Your deploy of ' + deployShortSha + ' ended with status: ' + task.status

  title: (task) ->
    $('.repo-name').attr('data-repo-full-name')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shipit-engine-0.0.1.pre app/assets/javascripts/task/notifications.js.coffee.erb