issue和commit_id关联
This commit is contained in:
parent
bbc8d11f80
commit
5bc4c779ea
|
@ -22,9 +22,9 @@ class IssuesController < ApplicationController
|
|||
before_filter :authorize1, :only => [:show]
|
||||
before_filter :find_issue, :only => [:show, :edit, :update,:add_journal, :add_journal_in_org]
|
||||
before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form, :issue_commits]
|
||||
#before_filter :authorize, :except => [:index, :show]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply, :issue_commits]
|
||||
|
||||
before_filter :find_optional_project, :only => [:index]
|
||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||
|
@ -60,12 +60,14 @@ class IssuesController < ApplicationController
|
|||
# issue和代码提交id关联模块 --> over
|
||||
# 获取某个项目的commit_ids
|
||||
def issue_commits
|
||||
project = Project.find(@issue.project_id)
|
||||
begin
|
||||
g = Gitlab.commits(project.gpid)
|
||||
return render_404 if @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
g_project = g.project(project.gpid)
|
||||
@rev = params[:rev].nil? ? g_project.default_branch : params[:rev]
|
||||
@commits = g.g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:rev)
|
||||
@commits_count = params[:commit_count].to_i
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
|
|
|
@ -56,6 +56,8 @@ class Issue < ActiveRecord::Base
|
|||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
# ForgeMessage虚拟关联(多态)
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
|
||||
# 该关联不能关联删除,因为commit记录没有存在Trustie数据库中
|
||||
has_many :commit_issueses
|
||||
|
||||
has_many :at_messages, class_name: 'AtMessage', as: :at_message ,:dependent => :destroy
|
||||
|
||||
|
|
|
@ -135,7 +135,9 @@
|
|||
<% end %>
|
||||
</li>
|
||||
<li class="clear">完成度</li>
|
||||
<li class="clear"><span>关联Commit</span><%= link_to "<span class='btn-commit btn-blue mt-2 fr'>+</span>".html_safe, issue_commits_issues_path %></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>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<script>
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
<div id="muban_popup_box" style="width:745px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">关联Commit</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con " >
|
||||
<div class="newupload_conbox " >
|
||||
<div class=" clear">
|
||||
<div class="cl"></div>
|
||||
<ul class="clear lightheight28 fl">
|
||||
<li class="mb10 clear fl">
|
||||
<span class=" fl"> 分支 : </span>
|
||||
<select class=" fl newupload_select" style="width:180px;">
|
||||
<option> 黄井泉</option>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="hw_search_box fr mb10" >
|
||||
<input class="hw_search-input" style="width:300px;" placeholder="输入描述的关键词进行搜索" type="text">
|
||||
<a href="javascript:void(0);" class="hw_btn_search"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<% if @commits.blank? %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% else %>
|
||||
<table class="newupload_table " cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="newupload_td01"> </th>
|
||||
<th class="newupload_td04">修订号</th>
|
||||
<th>描述</th>
|
||||
<th class="newupload_td04">提交者</th>
|
||||
<th class="newupload_td05">提交日期</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @commits.each do |commit| %>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887</span></td>
|
||||
<td class="newupload_td02"><p>删除项目的实施删除版本库功能</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887</span></td>
|
||||
<td class="newupload_td02"><p>删除项目的实施删除版本库功能</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887ae</span></td>
|
||||
<td class="newupload_td02"><p>班级作品列表的“未参与”相关优化品列表的“未参与”相关优化“未参与”相关...</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎胡莎莎胡莎莎胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887</span></td>
|
||||
<td class="newupload_td02"><p>删除项目的实施删除版本库功能</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887ae</span></td>
|
||||
<td class="newupload_td02"><p>班级作品列表的“未参与”相关优化品列表的“未参与”相关优化“未参与”相关...</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎胡莎莎胡莎莎胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887</span></td>
|
||||
<td class="newupload_td02"><p>删除项目的实施删除版本库功能</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887ae</span></td>
|
||||
<td class="newupload_td02"><p>班级作品列表的“未参与”相关优化品列表的“未参与”相关优化“未参与”相关...</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎胡莎莎胡莎莎胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887</span></td>
|
||||
<td class="newupload_td02"><p>删除项目的实施删除版本库功能</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887ae</span></td>
|
||||
<td class="newupload_td02"><p>班级作品列表的“未参与”相关优化品列表的“未参与”相关优化“未参与”相关...</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎胡莎莎胡莎莎胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887</span></td>
|
||||
<td class="newupload_td02"><p>删除项目的实施删除版本库功能</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">cff887ae</span></td>
|
||||
<td class="newupload_td02"><p>班级作品列表的“未参与”相关优化品列表的“未参与”相关优化“未参与”相关...</p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">胡莎莎胡莎莎胡莎莎胡莎莎</span></td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clear">
|
||||
<div class="clear fl mt10">
|
||||
<button class=" btn btn-blue fr ">确定</button >
|
||||
<button class=" btn fr mr5">取消</button >
|
||||
</div>
|
||||
<div class="fr pages_right_min mt10" >
|
||||
<a href="javascript:void(0);" class="pages-big">上一页</a>
|
||||
<a href="javascript:void(0);" class="active ">1</a>
|
||||
<a href="javascript:void(0);">2</a>
|
||||
<a href="javascript:void(0);">3</a>
|
||||
<a href="javascript:void(0);">...</a>
|
||||
<a href="javascript:void(0);">31</a>
|
||||
<a href="javascript:void(0);" class="pages-big pages-border-right">下一页</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,2 +1,2 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'issues/issue_commits') %>";
|
||||
pop_box_new(htmlvalue,460,190);
|
||||
pop_box_new(htmlvalue,750,600);
|
||||
|
|
|
@ -1488,6 +1488,8 @@ function pop_up_box(value,tWidth,tTop,tLeft){
|
|||
}
|
||||
|
||||
// 公共弹框样式
|
||||
// 建议左右栏的:Width:460,Height:190
|
||||
// 建议宽屏对应值:Width:750,Height:500
|
||||
function pop_box_new(value, Width, Height){
|
||||
w = ($(window).width() - Width)/2;
|
||||
h = ($(window).height() - Height)/2;
|
||||
|
|
|
@ -20,7 +20,7 @@ input.radio-width90{ width: 90px; }
|
|||
.muban_icons_blue{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #3b94d6;border: 1px solid #3b94d6;}
|
||||
/*模板buttons 20161013byLB*/
|
||||
.btn{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 30px;line-height: 30px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
.btn-commit{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 20px;line-height: 20px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
.btn-commit{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 20px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
.btn:hover{background: #c3c3c3; color: #333;}
|
||||
.btn-grey{background: #d9d9d9; color: #656565;}
|
||||
.btn-grey:hover{background: #717171; color: #fff;}
|
||||
|
|
Loading…
Reference in New Issue