Sha256: a346d1b52da45fdd56dac121b9122ef407f6d7b1ed669bdc99b6ca74a7445150

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

var YawlProcess = {
  url : null,

  updateStepState : function() {
    $.ajax(YawlProcess.url, {
      success: YawlProcess.updateStepsBody
    });
  },

  updateStepsBody : function(r, s, x) {
    $("#steps tbody").html(r);
    YawlProcess.updateStepProgress();

    var pctCompleted = YawlProcess.stepPctCompleted();
    if (pctCompleted != 100) {
      setTimeout(YawlProcess.updateStepState, 5000);
    }
  },

  updateStepProgress : function() {
    var pctCompleted = YawlProcess.stepPctCompleted();
    $("#process-progress").css("width", pctCompleted + "%");
    if (pctCompleted == 100) {
      $("#process-progress").parent().removeClass("progress-striped active");
      $("#process-progress").addClass("bar-success");
    }
  },

  stepPctCompleted : function() {
    var total = $(".step").size();
    var completed = $(".step-state").filter(function() { return $(this).html() == "completed" }).size();
    return Math.round(completed / total * 100.0);
  },

  init : function() {
    $(document).ready(function() {
      YawlProcess.updateStepProgress();
      setTimeout(YawlProcess.updateStepState, 5000);
    });
  }
};

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yawl_rails-0.3.0 app/assets/javascripts/yawl_rails/processes.js
yawl_rails-0.2.2 app/assets/javascripts/yawl_rails/processes.js
yawl_rails-0.2.1 app/assets/javascripts/yawl_rails/processes.js
yawl_rails-0.2.0 app/assets/javascripts/yawl_rails/processes.js
yawl_rails-0.1.1 app/assets/javascripts/yawl_rails/processes.js
yawl_rails-0.1.0 app/assets/javascripts/yawl_rails/processes.js