% if @object.state != "Running" %>
<%= form_tag '/jobs', style: "display:inline; padding-left: 1em" do |f| %>
<% [:script, :script_version, :repository, :supplied_script_version, :nondeterministic].each do |d| %>
<%= hidden_field :job, d, :value => @object[d] %>
<% end %>
<% [:script_parameters, :runtime_constraints].each do |d| %>
<%= hidden_field :job, d, :value => JSON.dump(@object[d]) %>
<% end %>
<%= button_tag ({class: 'btn btn-sm btn-primary', id: "re-run-same-job-button",
title: 'Re-run job using the same script version as this run'}) do %>
Re-run same version
<% end %>
<% end %>
<% if @object.respond_to? :supplied_script_version and !@object.supplied_script_version.nil? and !@object.supplied_script_version.empty? and @object.script_version != @object.supplied_script_version%>
<%= form_tag '/jobs', style: "display:inline" do |f| %>
<% [:script, :repository, :supplied_script_version, :nondeterministic].each do |d| %>
<%= hidden_field :job, d, :value => @object[d] %>
<% end %>
<%= hidden_field :job, :script_version, :value => @object[:supplied_script_version] %>
<% [:script_parameters, :runtime_constraints].each do |d| %>
<%= hidden_field :job, d, :value => JSON.dump(@object[d]) %>
<% end %>
<%= button_tag ({class: 'btn btn-sm btn-primary', id: "re-run-latest-job-button",
title: 'Re-run job using the latest script version'}) do%>
Re-run latest version
<% end %>
<% end %>
<% end %>
<% end %>