Sha256: 660003b6fa66836748df0d8034f75d97a13c8d76bbd8b80d279c0a4f35a5e116

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

//модуль для показа прогресс-бара создания отчетов

app.modules.progressBar = (function(self) {

  function _requestError(data) {
    var payload = data.payload;

    if (app.config.progressBar.documentLocationError) {
      alert('Ошибка');
      location.href = app.config.progressBar.documentLocationError;
    }

    if (payload && payload.error_messages) {
      $('.js-pberrors').html(payload.error_messages.join('<br>'));
    }
  }

  function _requestSuccess(data) {
    var
      progress = data.progress;

    if (progress && progress.message) {
      $('.js-pbstat').text(progress.num + ' из ' + progress.total + ' (' + Math.round(progress.percent) + '%)');
    }
  }

  function _init() {
    $('.js-progressbar').progressBar({
      url: app.config.progressBar.url,
      pid: app.config.progressBar.pid,
      onSuccess: function() {
        location.href = app.config.progressBar.documentLocation;
      },
      onError: function(data) {
        _requestError(data);
      },
      onRequestSuccess: function(data) {
        _requestSuccess(data);
      }
    });
  }

  self.load = function() {
    _init();
  };
  return self;
}(app.modules.progressBar || {}));

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-integration-3.8.2 app/assets/javascripts/standalone/progress_bar.js
resque-integration-3.8.1 app/assets/javascripts/standalone/progress_bar.js
resque-integration-3.8.0 app/assets/javascripts/standalone/progress_bar.js
resque-integration-3.7.1 app/assets/javascripts/standalone/progress_bar.js
resque-integration-3.5.1 app/assets/javascripts/standalone/progress_bar.js
resque-integration-3.5.0 app/assets/javascripts/standalone/progress_bar.js
resque-integration-3.4.1 app/assets/javascripts/standalone/progress_bar.js