commit导出方法及显示页面
This commit is contained in:
parent
6ebaa1c90a
commit
66066e6899
4
Gemfile
4
Gemfile
|
@ -50,10 +50,10 @@ gem 'elasticsearch-model'
|
|||
gem 'elasticsearch-rails'
|
||||
|
||||
#rails 3.2.22.2 bug
|
||||
gem "test-unit", "~>3.0"
|
||||
# gem "test-unit", "~>3.0"
|
||||
|
||||
### profile
|
||||
gem 'oneapm_rpm'
|
||||
# gem 'oneapm_rpm'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
|
|
|
@ -62,12 +62,13 @@ class IssuesController < ApplicationController
|
|||
def issue_commits
|
||||
begin
|
||||
return render_404 if @project.gpid.nil?
|
||||
limit = 20
|
||||
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]
|
||||
g_project = g.project(@project.gpid)
|
||||
rev = params[:rev].nil? ? g_project.default_branch : params[:rev]
|
||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:rev)
|
||||
@commits_count = g.user_static(@project.gpid, :rev => rev).count
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count, limit, params[:page]
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
|
|
|
@ -72,12 +72,36 @@ module ApplicationHelper
|
|||
user.nil? ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 通过邮件查找用户,能查到返回用户,否则返回邮件地址
|
||||
def user_by_mail mail
|
||||
user = User.find_by_mail(mail)
|
||||
user.nil? ? mail : user.try(:show_name)
|
||||
end
|
||||
|
||||
def link_to_user_mail(mail, options={})
|
||||
user = User.find_by_mail(mail)
|
||||
user = user.nil? ? mail : user
|
||||
if user.is_a?(User)
|
||||
name = user.show_name
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id}, :class => user.css_classes
|
||||
else
|
||||
h(user.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
# 通过系统外部用户名查找用户,如果用户不存在则用邮箱替换
|
||||
def get_user_by_login_and login
|
||||
user = User.find_by_login(login)
|
||||
(user.nil? || login == "root") ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 登录名来自外部系统
|
||||
# 通过登录名查找用户,如果用户存在则显示用户姓名,否则显示登录名
|
||||
def get_user_by_login login
|
||||
user = User.find_by_login(login)
|
||||
user.nil? ? login : user.show_name
|
||||
end
|
||||
|
||||
# 重置user_path,目的是将id转换成用户名
|
||||
def user_path(resource, parameters = {})
|
||||
if Fixnum === resource
|
||||
|
|
|
@ -6,25 +6,25 @@
|
|||
</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 %>
|
||||
<% if @commits.blank? %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% else %>
|
||||
<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>
|
||||
<table class="newupload_table " cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -39,82 +39,17 @@
|
|||
<% @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>
|
||||
<td class="newupload_td04">
|
||||
<span class="newupload_table_name">
|
||||
<%= link_to commit.id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank" %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="newupload_td02"><p><%= commit.message %></p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">
|
||||
<%= link_to_user_mail(commit.author_email) %></span></td>
|
||||
<td class="newupload_td05"><%= format_date(commit.created_at) %></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">
|
||||
|
@ -122,19 +57,18 @@
|
|||
<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 style="text-align:center;">
|
||||
<div class="pages" style="width:auto; display:inline-block;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
<%= pagination_links_full @commits_pages, @commits_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,2 +1,2 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'issues/issue_commits') %>";
|
||||
pop_box_new(htmlvalue,750,600);
|
||||
pop_box_new(htmlvalue,760,860);
|
||||
|
|
|
@ -1489,7 +1489,7 @@ function pop_up_box(value,tWidth,tTop,tLeft){
|
|||
|
||||
// 公共弹框样式
|
||||
// 建议左右栏的:Width:460,Height:190
|
||||
// 建议宽屏对应值:Width:750,Height:500
|
||||
// 建议宽屏对应值:Width:760,Height:500
|
||||
function pop_box_new(value, Width, Height){
|
||||
w = ($(window).width() - Width)/2;
|
||||
h = ($(window).height() - Height)/2;
|
||||
|
|
Loading…
Reference in New Issue