issue 关联commit 流程及数据创建
This commit is contained in:
parent
33a4186e69
commit
378427d070
|
@ -198,8 +198,8 @@ class IssuesController < ApplicationController
|
|||
query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
|
||||
query.update_attribute(:viewed, true) unless query.nil?
|
||||
# issue 关联的commit
|
||||
@commits = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
|
||||
|
||||
commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
|
||||
@issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
|
||||
# issue 新建的at消息
|
||||
User.current.at_messages.unviewed('Issue', @issue.id).each {|x| x.viewed!}
|
||||
# 回复的at消息
|
||||
|
@ -268,10 +268,10 @@ class IssuesController < ApplicationController
|
|||
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
|
||||
if @issue.save
|
||||
# 关联commmit
|
||||
commits = params[:had_commits]
|
||||
if commits
|
||||
commits.each do |commit|
|
||||
CommitIssues.create(:commit_id => commit.id, :project_id => @issue.project_id, :issue_id => @issue.id)
|
||||
commit_ids = params[:commit_ids]
|
||||
unless commit_ids.blank?
|
||||
commit_ids.split(",").each do |commit_id|
|
||||
CommitIssues.create(:commit_id => commit_id, :project_id => @issue.project_id, :issue_id => @issue.id)
|
||||
end
|
||||
end
|
||||
#params[:issue][:assigned_to_id] = nil if params[:issue][:assigned_to_id].to_i == 0
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<% end %>
|
||||
<!--<a href="javascript:void(0);" class="sy_btn_blue mr5 fr"> 保存并继续</a>-->
|
||||
<!--<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue mr5 fr" id="issue_confirm"> 保存</a>-->
|
||||
<input onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue fr mr5" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||
<input onclick="issue_create();" class="sy_btn_blue fr mr5" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl pro_new_conbox_right ml10 mb10">
|
||||
|
@ -136,19 +136,34 @@
|
|||
</li>
|
||||
<li class="clear">完成度</li>
|
||||
<% if @project.gpid %>
|
||||
<!--<li class="clear"><span>关联Commit</span><%#= link_to "<span class='btn-commit btn-blue mt-2 fr'>+</span>".html_safe, issue_commits_issues_path(:project_id => @project), :remote => true %></li>-->
|
||||
<%#= hidden_field_tag @issue_commit_ids %>
|
||||
<input value="" name="commit_ids" id="commit_ids" type="hidden">
|
||||
<li class="clear"><span>关联Commit</span>
|
||||
<a href="javascript:void(0)" onclick="get_issue_commit_ids('issue_commit_ids','<%= @project.id %>');">
|
||||
<span class='btn-commit btn-blue mt-2 fr'>+</span>
|
||||
</a>
|
||||
</li>
|
||||
<div id="issue_commit_ids">
|
||||
<%= render :partial => "issues/issue_commit_ids" %>
|
||||
<%= render :partial => "issues/issue_commit_ids", :locals => {:f => f} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<script>
|
||||
function issue_create(){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
for(var i=0; i < issue_commit_ids.length; i++){
|
||||
str += $(issue_commit_ids[i]).html();
|
||||
if(i != issue_commit_ids.length -1){
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
issue_desc_editor.sync();
|
||||
$('#commit_ids').val(str);
|
||||
$('#issue-form').submit();
|
||||
}
|
||||
|
||||
function get_issue_commit_ids(id, project_id){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
|
|
|
@ -88,11 +88,7 @@
|
|||
<% end %>
|
||||
<li class="clear"><span class="pro_new_conbox_leftspan mb5">关联Commit</span>
|
||||
<div id="issue_commit_ids">
|
||||
<% if @commit_ids %>
|
||||
<% @commit_ids.each do |commit_id| %>
|
||||
<div class=" btn btn-blue mb5"><a class="commit_id_value" href="#" style="color: white"><%= commit_id %></a> <a href="#" style="color:#fff;">×</a></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render :partial => "issues/issue_commit_ids" %>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue