window.Alchemy = {} if typeof(window.Alchemy) is 'undefined' Alchemy.FileProgress = (file) -> # Build Wrapper @$fileProgressWrapper = $('
') # Build Container @$fileProgressElement = $('
') # Append Cancel Button @$fileProgressCancel = $('') @$fileProgressElement.append @$fileProgressCancel # Append Filename @$fileProgressElement.append "
" + file.name + "
" # Append Progressbar Status Text @$fileProgressStatus = $('
 
') @$fileProgressElement.append @$fileProgressStatus # Build Progressbar Container $progressBarContainer = $('
') # Build Progressbar @$progressBar = $('
') # Knit all together $progressBarContainer.append @$progressBar @$fileProgressElement.append $progressBarContainer @$fileProgressWrapper.append @$fileProgressElement $('#uploadProgressContainer').append @$fileProgressWrapper this Alchemy.FileProgress::reset = -> @$fileProgressStatus.html ' ' @$progressBar.removeClass().addClass 'progressBarInProgress' @$progressBar.css width: '0%' Alchemy.FileProgress::setProgress = (percentage) -> @$progressBar.removeClass().addClass 'progressBarInProgress' @$progressBar.css width: percentage + '%' Alchemy.FileProgress::setComplete = -> @$progressBar.removeClass().addClass 'progressBarComplete' @$progressBar.css width: '100%' @$fileProgressCancel.hide() @$fileProgressWrapper.delay(1500).fadeOut -> $(this).remove() Alchemy.FileProgress::setError = -> @$progressBar.removeClass().addClass 'progressBarError' @$progressBar.css width: '100%' Alchemy.FileProgress::setCancelled = -> @$progressBar.removeClass().addClass 'progressBarCanceled' @$progressBar.css width: '100%' @$fileProgressCancel.hide() @$fileProgressWrapper.delay(1500).fadeOut -> $(this).remove() Alchemy.FileProgress::setStatus = (status) -> @$fileProgressStatus.text status