Commit ece146ae authored by Jerome Mariette's avatar Jerome Mariette
Browse files

sort active workflows to display

parent 5beba97b
......@@ -64,12 +64,21 @@
$this.$element.html(alert_message);
},
success: function(data) {
var workflow_by_id = {};
var workflow_by_id = {},
all_ids = new Array(),
workflows_sorted = new Array();
for (var i in data) {
workflow_by_id[data[i]["id"]] = data[i];
workflow_by_id[data[i]["id"]] = data[i];
all_ids.push(data[i]["id"]);
}
all_ids.sort(function(a, b) {
return b - a;
});
for (var i in all_ids) {
workflows_sorted.push(workflow_by_id[all_ids[i]]);
}
$this.$element.html("");
$.tmpl($this.options.template, {workflows: data}).appendTo($this.$element);
$.tmpl($this.options.template, {workflows: workflows_sorted}).appendTo($this.$element);
$("[id^=activewf_btn_]").click(function(){
var workflow_id = $(this).attr("id").split("activewf_btn_")[1];
$this.$element.trigger('select.active', workflow_by_id[workflow_id]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment