Merge branch 'hjq_new_course' into szzh
This commit is contained in:
commit
2d2ae1e6a6
|
@ -348,10 +348,6 @@ update
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@changesets = g.commits(@project.gpid, :ref_name => @rev)
|
@changesets = g.commits(@project.gpid, :ref_name => @rev)
|
||||||
# @changesets = @repository.latest_changesets(@path, @rev)
|
# @changesets = @repository.latest_changesets(@path, @rev)
|
||||||
# @changesets_count = @repository.latest_changesets(@path, @rev).count
|
# @changesets_count = @repository.latest_changesets(@path, @rev).count
|
||||||
|
@ -378,19 +374,6 @@ update
|
||||||
|
|
||||||
alias_method :browse, :show
|
alias_method :browse, :show
|
||||||
|
|
||||||
#add by hx
|
|
||||||
def count_commits(project_id , left , right)
|
|
||||||
count = 0
|
|
||||||
(left..right).each do |page|
|
|
||||||
if $g.commits(project_id,:page => page).count == 0
|
|
||||||
break
|
|
||||||
else
|
|
||||||
count = count + $g.commits(project_id,:page => page).count
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return count
|
|
||||||
end
|
|
||||||
|
|
||||||
def changes
|
def changes
|
||||||
@entry = @repository.entry(@path, @rev)
|
@entry = @repository.entry(@path, @rev)
|
||||||
(show_error_not_found; return) unless @entry
|
(show_error_not_found; return) unless @entry
|
||||||
|
@ -400,26 +383,10 @@ update
|
||||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
|
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
|
||||||
|
|
||||||
#add by hx
|
#add by hx
|
||||||
if g.commits(@project.gpid , :page=>200).count > 0
|
rep_count = commit_count(@project)
|
||||||
count = 4020
|
|
||||||
elsif g.commits(@project.gpid , :page=>25).count==0
|
|
||||||
count = count_commits(@project.gpid , 0 , 25)
|
|
||||||
elsif g.commits(@project.gpid , :page=>50).count ==0
|
|
||||||
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
|
|
||||||
elsif g.commits(@project.gpid , :page=>75).count ==0
|
|
||||||
count = count_commits(@project.gpid , 50 , 75)+ 50 * 20
|
|
||||||
elsif g.commits(@project.gpid , :page=>100).count== 0
|
|
||||||
count = count_commits(@project.gpid , 75 , 100) + 75 * 20
|
|
||||||
elsif g.commits(@project.gpid , :page=>125).count==0
|
|
||||||
count = count_commits(@project.gpid , 100 , 125) + 100 * 20
|
|
||||||
elsif g.commits(@project.gpid , :page=>150).count==0
|
|
||||||
count = count_commits(@project.gpid , 125 , 150) + 125 * 20
|
|
||||||
else
|
|
||||||
count = count_commits(@project.gpid , 150 ,200) + 150 * 20
|
|
||||||
end
|
|
||||||
|
|
||||||
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
|
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
|
||||||
@commits_count = count
|
@commits_count = rep_count
|
||||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
|
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
|
||||||
|
|
||||||
@commit = g.commit(@project.gpid,@rev)
|
@commit = g.commit(@project.gpid,@rev)
|
||||||
|
|
|
@ -668,6 +668,42 @@ module ApplicationHelper
|
||||||
return rep.blank? ? true :false
|
return rep.blank? ? true :false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 获取Gitlab版本库提交总数
|
||||||
|
def commit_count(project)
|
||||||
|
g = Gitlab.client
|
||||||
|
#add by hx
|
||||||
|
if g.commits(project.gpid , :page=>200).count > 0
|
||||||
|
count = 4020
|
||||||
|
elsif g.commits(project.gpid , :page=>25).count==0
|
||||||
|
count = count_commits(project.gpid , 0 , 25)
|
||||||
|
elsif g.commits(project.gpid , :page=>50).count ==0
|
||||||
|
count = count_commits(project.gpid , 25 , 50)+ 25 * 20
|
||||||
|
elsif g.commits(project.gpid , :page=>75).count ==0
|
||||||
|
count = count_commits(project.gpid , 50 , 75)+ 50 * 20
|
||||||
|
elsif g.commits(project.gpid , :page=>100).count== 0
|
||||||
|
count = count_commits(project.gpid , 75 , 100) + 75 * 20
|
||||||
|
elsif g.commits(project.gpid , :page=>125).count==0
|
||||||
|
count = count_commits(project.gpid , 100 , 125) + 100 * 20
|
||||||
|
elsif g.commits(project.gpid , :page=>150).count==0
|
||||||
|
count = count_commits(project.gpid , 125 , 150) + 125 * 20
|
||||||
|
else
|
||||||
|
count = count_commits(project.gpid , 150 ,200) + 150 * 20
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#add by hx
|
||||||
|
def count_commits(project_id , left , right)
|
||||||
|
count = 0
|
||||||
|
(left..right).each do |page|
|
||||||
|
if $g.commits(project_id,:page => page).count == 0
|
||||||
|
break
|
||||||
|
else
|
||||||
|
count = count + $g.commits(project_id,:page => page).count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
# 获取单一gitlab项目
|
# 获取单一gitlab项目
|
||||||
def gitlab_repository(project)
|
def gitlab_repository(project)
|
||||||
rep = Repository.where("project_id =? and type =?", project.id,"Repository::Gitlab" ).first
|
rep = Repository.where("project_id =? and type =?", project.id,"Repository::Gitlab" ).first
|
||||||
|
|
|
@ -22,6 +22,7 @@ module ProjectScoreHelper
|
||||||
|
|
||||||
#代码提交数量
|
#代码提交数量
|
||||||
def changesets_num project
|
def changesets_num project
|
||||||
|
# commit_count(project)
|
||||||
project.changesets.count
|
project.changesets.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -395,13 +395,13 @@ class Mailer < ActionMailer::Base
|
||||||
user = User.find_by_mail(recipients)
|
user = User.find_by_mail(recipients)
|
||||||
@user = user
|
@user = user
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
@token = Token.get_token_from_user(user, 'autologin')
|
||||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value)
|
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||||
|
|
||||||
# edit
|
# edit
|
||||||
@issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
|
@issue_author_url = url_for(user_activities_url(@author))
|
||||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
|
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
||||||
|
|
||||||
@user_url = url_for(my_account_url(user,:token => @token.value))
|
@user_url = url_for(my_account_url(user))
|
||||||
|
|
||||||
|
|
||||||
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||||
|
@ -471,7 +471,7 @@ class Mailer < ActionMailer::Base
|
||||||
recipients = @project.manager_recipients
|
recipients = @project.manager_recipients
|
||||||
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||||
@token = Token.get_token_from_user(@user, 'autologin')
|
@token = Token.get_token_from_user(@user, 'autologin')
|
||||||
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members', :token => @token.value)
|
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||||
mail :to => recipients,
|
mail :to => recipients,
|
||||||
:subject => s
|
:subject => s
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,42 +20,31 @@
|
||||||
<div class="col-md-10 col-sm-12">
|
<div class="col-md-10 col-sm-12">
|
||||||
<ul class="bordered-list">
|
<ul class="bordered-list">
|
||||||
<li class="commit js-toggle-container">
|
<li class="commit js-toggle-container">
|
||||||
<div class="commit-row-title">
|
<div class="commit-row-info">
|
||||||
|
<% if !user_commit_rep(changeset.author_email).nil? %>
|
||||||
|
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
|
||||||
|
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||||
|
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>提交于
|
||||||
|
<div class="committed_ago">
|
||||||
|
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>前 </time>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<span class="commit-author-name"><%= changeset.author_email %></span>提交于
|
||||||
|
<div class="committed_ago">
|
||||||
|
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div style="padding-left:30px;" class="commit-row-title">
|
||||||
<strong class="str-truncated">
|
<strong class="str-truncated">
|
||||||
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
|
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
|
||||||
</strong>
|
</strong>
|
||||||
|
|
||||||
<div class="pull-right" title="修订号">
|
<div class="pull-right" title="修订号">
|
||||||
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
|
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="notes_count">
|
<div class="notes_count">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="commit-row-info">
|
|
||||||
<% if !user_commit_rep(changeset.author_email).nil? %>
|
|
||||||
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
|
|
||||||
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
|
||||||
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>
|
|
||||||
提交于
|
|
||||||
<div class="committed_ago">
|
|
||||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>
|
|
||||||
前
|
|
||||||
</time>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<span class="commit-author-name"><%= changeset.author_email %></span>
|
|
||||||
提交于
|
|
||||||
<div class="committed_ago">
|
|
||||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>
|
|
||||||
前
|
|
||||||
</time>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,7 +54,6 @@
|
||||||
<p style="padding-top: 10px;">
|
<p style="padding-top: 10px;">
|
||||||
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
|
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul class="wlist">
|
<ul class="wlist">
|
||||||
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true %>
|
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue