缺陷状态根据完成度调整
This commit is contained in:
parent
c852e72e36
commit
e9cf61e0f4
|
@ -8,7 +8,8 @@
|
|||
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
|
||||
<%= f.select :status_id,
|
||||
(@allowed_statuses.collect { |p| [p.name, p.id] }),
|
||||
{:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", :no_label => true},
|
||||
{:no_label => true},
|
||||
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
|
||||
:class => "w150" %>
|
||||
<% else %>
|
||||
<%= h(@issue.status.name) %>
|
||||
|
@ -92,7 +93,8 @@
|
|||
<li><label class="label02"> % 完成 : </label>
|
||||
<% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
|
||||
<%= f.select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }),
|
||||
{:required => @issue.required_attribute?('done_ratio'), :no_label => true, :onchange => "PrecentChange(this.value)"},
|
||||
{:required => @issue.required_attribute?('done_ratio'), :no_label => true},
|
||||
:onchange => "PrecentChange(this.value)",
|
||||
:class => "w150" %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
|
|
@ -239,4 +239,39 @@ function showAndScrollTo(id, focus) {
|
|||
$('#'+focus).focus();
|
||||
}
|
||||
$('html, body').animate({scrollTop: $('#'+id).offset().top}, 400);
|
||||
|
||||
|
||||
|
||||
/*缺陷完成度决定缺陷状态*/
|
||||
function PrecentChange(obj){
|
||||
var _v= obj;
|
||||
if(_v==100)
|
||||
{
|
||||
//var select=$("select[id='issue_status_id']");
|
||||
$("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected");
|
||||
}
|
||||
else if(_v==0)
|
||||
{
|
||||
//alert(1);
|
||||
$("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected");
|
||||
}
|
||||
else if(_v!=100&&_v!=0)
|
||||
{
|
||||
// alert(2);
|
||||
$("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected");
|
||||
}
|
||||
}
|
||||
|
||||
// Can't use Rails' remote select because we need the form data
|
||||
// 根据缺陷状态值改变完成度状态
|
||||
function updateIssueFrom(url) {
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'post',
|
||||
data: $('#issue-form').serialize()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue