class @Notifications IMAGES = success: '<%= image_path "deploy_success.jpg" %>' failed: '<%= image_path "deploy_failed.jpg" %>' error: '<%= image_path "deploy_error.jpg" %>' @init: (outputStream, task) -> outputStream.addEventListener('status', new this(task).statusUpdated) constructor: ({@repo, @description}) -> statusUpdated: (status) => return unless status of IMAGES return unless $.notifyCheck() == $.NOTIFY_ALLOWED $.notify(IMAGES[status], @repo, @message(status)) message: (status) -> deployShortSha = $('.short-sha').text() switch status when 'success' "Your #{@description} was successful!" when 'failed' "Your #{@description} failed." when 'error' "Error during #{@description}." else "Your #{@description} ended with status: #{status}"