issue和commit关联的一些修改和调整

This commit is contained in:
huang 2016-12-08 11:26:37 +08:00
parent a1a96e4667
commit 0785c71308
3 changed files with 26 additions and 8 deletions

View File

@ -62,7 +62,7 @@ class IssuesController < ApplicationController
def issue_commits
begin
return render_404 if @project.gpid.nil?
@issue_commit_ids = params[:issue_commit_ids].split(",")
@issue_commit_ids = (params[:issue_commit_ids].is_a?(Array) ? params[:issue_commit_ids] : params[:issue_commit_ids].split(",")) unless params[:issue_commit_ids].nil?
search = params[:search].to_s.lstrip.rstrip
@type = params[:type]
limit = 20
@ -82,7 +82,7 @@ class IssuesController < ApplicationController
# 选择对应的Commit
def commit_for_issue
history_commit_ids = params[:issue_commit_ids]
history_commit_ids = params[:issue_for_commit_ids].split(",") unless params[:issue_for_commit_ids].nil?
@issue_commit_ids = (history_commit_ids.blank? ? params[:checkbox1] : params[:checkbox1] | history_commit_ids).uniq
end

View File

@ -1,4 +1,4 @@
<div id="muban_popup_box" style="width:745px;">
<div style="width:745px;">
<div class="muban_popup_top">
<h3 class="fl">关联Commit</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
@ -13,11 +13,11 @@
<div class="cl"></div>
<%= form_tag(url_for(:controller => 'issues', :action => 'issue_commits', :project_id => @project.id, :type => "search"),
:remote => true, :method => 'get', :id => 'issue_commit_form', :class => "fl") do %>
<ul class="clear lightheight28 fl">
<ul class="clear lightheight28 fl mr100">
<li class="mb10 clear fl">
<span class=" fl">&nbsp;分支&nbsp;&nbsp;:&nbsp;</span>
<%= select_tag :branch, options_for_select(["#{@default_branch}"]+ @branch_names, @rev),
:class => "fl newupload_select", :style => "width:180px;",
:class => "fl newupload_select", :style => "width:180px;height:28px;",
:onchange => "$('#issue_commit_form').submit();" %>
</li>
</ul>

View File

@ -1,4 +1,4 @@
<%= form_tag(url_for(:controller => 'issues', :action => 'commit_for_issue', :project_id => @project.id, :issue_commit_ids => @issue_commit_ids), :remote => true, :method => 'get', :id => 'commit_for_issue', :class => "fl") do %>
<%= form_tag(url_for(:controller => 'issues', :action => 'commit_for_issue', :project_id => @project.id), :remote => true, :method => 'get', :id => 'commit_for_issue', :class => "fl") do %>
<table class="newupload_table " cellspacing="0" cellpadding="0">
<thead>
<tr>
@ -22,10 +22,11 @@
</tr>
<% end %>
</tbody>
<input value="" name="issue_for_commit_ids" id="issue_for_commit_ids" type="hidden">
</table>
<div class="clear">
<div class="clear fl mt10">
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#commit_for_issue').submit();hideModal()">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="search_and_branch_for_commit_ids();">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml10" onclick="hideModal()">取&nbsp;&nbsp;消</a>
</div>
<div style="text-align:center;">
@ -38,4 +39,21 @@
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<script>
function search_and_branch_for_commit_ids(){
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 += ",";
}
}
alert(str);
$('#issue_for_commit_ids').val(str);
$('#commit_for_issue').submit();
hideModal();
}
</script>