Sha256: d432a6a824eb036897cbb84343b5d39b22b70ea3cf2975c322188f869c23b3fb
Contents?: true
Size: 1.24 KB
Versions: 47
Compression:
Stored size: 1.24 KB
Contents
class Para.JobTracker extends RemoteModalForm initialize: (options = {}) -> super(options) @refreshOnClose = false @trackProgress() formSuccess: (e, response) -> super(e, response) @trackProgress() trackProgress: ($progressBar) -> return unless ($progressBar = @$el.find('[data-async-progress]')).length @jobStatusURL = @$el.data('job-status-url') @progress = new Para.AsyncProgress(el: $progressBar, progressUrl: @jobStatusURL) @listenTo(@progress, 'completed', @onImportComplete) @listenTo(@progress, 'failed', @onImportComplete) onImportComplete: -> $.ajax( url: @jobStatusURL # Force HTTP ACCEPT header to HTML since Rails treats XHR request without # a specific ACCEPT header as JS or JSON by defaut. accepts: 'html': 'text/html' dataType: 'html' ).done(@onFinalModalLoaded) onFinalModalLoaded: (response) => @formSuccess(null, response) @refreshOnClose = !(@$link?.data('refresh-on-close') is false) modalHide: -> super() @progress?.stop() $(document).on 'page:change turbolinks:load', -> $('body').on 'ajax:success', '[data-job-tracker-button]', (e, response) -> new Para.JobTracker(modalMarkup: response, $link: $(e.currentTarget))
Version data entries
47 entries across 47 versions & 1 rubygems