<%
title = if com.thoughtworks.go.util.GoConstants::DEFAULT_APPROVED_BY == scope[:stage_in_status_bar].getApprovedBy()
    "Automatically approved"
elsif scope[:stage_in_status_bar].getApprovedBy().blank?
    "Awaiting approval"
else
    "Approved by #{scope[:stage_in_status_bar].getApprovedBy()}"
end

clazz = scope[:stage_in_status_bar].isAutoApproved() ?
        "auto" :
        "manual"

stage_name = scope[:stage_in_status_bar].getName()
trigger_id = "stage_bar_trigger_" + stage_name
scope[:html_opts] = {:class => clazz, :title=> title, :id => trigger_id }
   
if scope[:stage_in_status_bar].canRun() && !scope[:stage_in_status_bar].isScheduled() %>
    <%== blocking_link_to_remote_new :name=>" ", :method => :post, :url => run_stage_path(:stage_name => stage_name), :html => scope[:html_opts], :update => scope[:update_opts], :headers => {Confirm: 'true'}, :before => scope[:before_opts] %>
<% else %>
    <span class="<%= clazz %>" title="<%= title %>" id="<%= trigger_id %>"> </span>
<% end %>


<%
title = if com.thoughtworks.go.util.GoConstants::DEFAULT_APPROVED_BY == scope[:stage_in_status_bar].getApprovedBy()
    "Automatically approved"
elsif scope[:stage_in_status_bar].getApprovedBy().blank?
    "Awaiting approval"
else
    "Approved by #{scope[:stage_in_status_bar].getApprovedBy()}"
end

clazz = scope[:stage_in_status_bar].isAutoApproved() ?
        "auto" :
        "manual"

stage_name = scope[:stage_in_status_bar].getName()
trigger_id = "stage_bar_trigger_" + stage_name
scope[:html_opts] = {:class => clazz, :title=> title, :id => trigger_id }

if scope[:stage_in_status_bar].canRun() && !scope[:stage_in_status_bar].isScheduled() %>
    <%== blocking_link_to_remote_new :name=>" ", :method => :post, :url => run_stage_path(:stage_name => stage_name), :html => scope[:html_opts], :update => scope[:update_opts], :headers => {'X-GoCD-Confirm': 'true', 'Accept': 'application/vnd.go.cd+json', 'Content-Type': 'application/json'}, :before => scope[:before_opts] %>
<% else %>
    <span class="<%= clazz %>" title="<%= title %>" id="<%= trigger_id %>"> </span>
<% end %>


Fix manual stage trigger link.
Fix manual stage trigger link.
