项目版本库历史记录代码优化及界面调整
This commit is contained in:
parent
9ee36f05bc
commit
c3745be0eb
|
@ -430,29 +430,21 @@ update
|
|||
|
||||
end
|
||||
|
||||
# 注:由于考虑到性能所以commits api每次返回20条记录
|
||||
def changes
|
||||
# 顶部导航
|
||||
@project_menu_type = 5
|
||||
|
||||
@entry = @repository.entry(@path, @rev)
|
||||
(show_error_not_found; return) unless @entry
|
||||
g = Gitlab.client
|
||||
limit = 20
|
||||
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
|
||||
limit = 10
|
||||
# 每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
|
||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:@rev)
|
||||
@commits_count = params[:commit_count].nil? ? @g.user_static(@project.gpid, :rev => @rev).count : params[:commit_count].to_i
|
||||
@commits_pages = Paginator.new @commits_count, limit, params[:page]
|
||||
# @offset ||= @commits_pages.offset
|
||||
# @commits = paginateHelper @commits, limit
|
||||
|
||||
#add by hx
|
||||
#rep_count = commit_count(@project)
|
||||
|
||||
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
|
||||
@commits_count = params[:commit_count].to_i
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
|
||||
|
||||
@commit = g.commit(@project.gpid,@rev)
|
||||
# @changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
|
||||
#@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
|
|
|
@ -1,48 +1,21 @@
|
|||
<%= form_tag(
|
||||
{:controller => 'repositories', :action => 'diff', :id => project,
|
||||
:repository_id => @repository.identifier_param, :path => to_path_param(path)},
|
||||
:method => :get
|
||||
) do %>
|
||||
<table class="list changesets">
|
||||
<!--<thead><tr>-->
|
||||
<!--<th>#</th>-->
|
||||
<!--<th></th>-->
|
||||
<!--<th></th>-->
|
||||
<!--<th><%= l(:label_date) %></th>-->
|
||||
<!--<th><%= l(:field_author) %></th>-->
|
||||
<!--<th><%= l(:field_comments) %></th>-->
|
||||
<!--</tr></thead>-->
|
||||
<tbody>
|
||||
|
||||
<% show_diff = revisions.size > 1 %>
|
||||
<% line_num = 1 %>
|
||||
<% revisions.each do |changeset| %>
|
||||
<div class="col-md-10 col-sm-12">
|
||||
<ul class="bordered-list">
|
||||
<li class="commit js-toggle-container">
|
||||
<%= render :partial => 'commit_details', :locals => {:changeset => changeset} %>
|
||||
<div style="padding-left:30px;" class="commit-row-title">
|
||||
<strong class="str-truncated">
|
||||
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
|
||||
</strong>
|
||||
<div class="pull-right" title="修订号">
|
||||
<%= link_to truncate(changeset.short_id.to_s, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => project.id, :changeset => changeset.id} %>
|
||||
</div>
|
||||
<div class="notes_count">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<p style="padding-top: 10px;">
|
||||
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
|
||||
</p>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||
</ul>
|
||||
|
||||
<% @commits.chunk { |c| format_date(c.created_at).to_date }.each do |day, commits| %>
|
||||
<div class="pullreques_pullbox">
|
||||
<div class="pullreques_pull_top clear">
|
||||
<p class="fl c_grey ml15"><%= day %></p>
|
||||
<p class="fr c_green mr15"><%= commits.count %>个提交</p>
|
||||
</div>
|
||||
<ul class="pullreques_pull_list">
|
||||
<% commits.each do |commit| %>
|
||||
<li class="clear">
|
||||
<span class="fl c_grey ml15 "><%= time_tag(commit.created_at) %>前</span>
|
||||
<%= link_to get_user_by_mail(commit.author_email).show_name, user_path(get_user_by_mail(commit.author_email)), :target => "_blank", :class => "pullreques_pull_name fl ml10" %>
|
||||
<p class="pullreques_pull_txt ml10 fl"><%= commit.title %></p>
|
||||
<%= link_to truncate(commit.short_id, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank", :class => "fr mr15 c_grey" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,26 +1,38 @@
|
|||
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
|
||||
<div class="wrap-big">
|
||||
<div class="project_r_h">
|
||||
<%= render :partial => "top" %>
|
||||
<div class="new_roadmap_conbox mb10" >
|
||||
<div class=" clear">
|
||||
<ul class="reply-container-branch fl" >
|
||||
<%= render :partial => 'navigation' %>
|
||||
</ul>
|
||||
</div>
|
||||
<% @commits.chunk { |c| format_date(c.created_at).to_date }.each do |day, commits| %>
|
||||
<div class="pullreques_pullbox">
|
||||
<div class="pullreques_pull_top clear">
|
||||
<p class="fl c_grey ml15"><%= day %></p>
|
||||
<p class="fr c_green mr15"><%= commits.count %>个提交</p>
|
||||
</div>
|
||||
<ul class="pullreques_pull_list">
|
||||
<% commits.each do |commit| %>
|
||||
<li class="clear">
|
||||
<span class="fl c_grey ml15 "><%= time_tag(commit.created_at) %>前</span>
|
||||
<%= link_to get_user_by_mail(commit.author_email).show_name, user_path(get_user_by_mail(commit.author_email)), :target => "_blank", :class => "pullreques_pull_name fl ml10" %>
|
||||
<p class="pullreques_pull_txt ml10 fl"><%= commit.title %></p>
|
||||
<%= link_to truncate(commit.short_id, :length => 20), {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank", :class => "fr mr15 c_grey" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="repository_con " style="line-height:1.9;">
|
||||
<%= render :partial => 'navigation' %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'link_to_functions' %>
|
||||
|
||||
<%= render_properties(@properties) %>
|
||||
|
||||
<div class="mt10">
|
||||
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path , :revisions => @commits, :entry => @entry , :commits_pages => @commits_pages , :commits_count => @commits_count}) unless @commits.empty? %>
|
||||
<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 => false, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
|
||||
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
|
||||
<% html_title(l(:label_change_plural)) -%>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -931,6 +931,7 @@ p.pro_new_grey{ line-height: 1.9; }
|
|||
.container-big-grey {width:970px; background-color:#f1f1f1;}
|
||||
.reply-banner {width:968px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;}
|
||||
.reply-container {border-bottom:1px solid #e3e3e3; width:940px; margin-top:15px; min-height:50px;}
|
||||
.reply-container-branch {width:940px; margin-top:6px; min-height:35px; padding-left: 10px;}
|
||||
.reply-content {float:left; width:892px;}
|
||||
|
||||
/* 新版里程碑 20161019byLB */
|
||||
|
|
Loading…
Reference in New Issue