Pull request数量为0的时候显示在更多中

This commit is contained in:
huang 2016-09-08 16:03:32 +08:00
parent 08c64d2ac7
commit 6dbb2e4e94
3 changed files with 13 additions and 2 deletions

View File

@ -832,7 +832,13 @@ module ApplicationHelper
atts.count > 0 ? true :false
end
# 必须是项目成,项目必须提交过代码
# 如果Pull Request数量为0就显示在更多中
def allow_show_pull_request project
g = Gitlab.client
count = g.merge_requests(project.gpid).count
end
# 必须是项目成员,项目必须提交过代码
def allow_pull_request project
return false if project.gpid.nil?
g = Gitlab.client

View File

@ -41,7 +41,7 @@
</div>
<% end %>
<% if allow_pull_request(@project) %>
<% if allow_pull_request(@project) > 0 && allow_show_pull_request(@project) > 0 %>
<div class="subNav">
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<% if User.current.member_of?(@project) %>

View File

@ -1,3 +1,8 @@
<li>
<% if allow_pull_request(@project) > 0 && allow_show_pull_request(@project) == 0 %>
<%= link_to "Pull Requests", project_pull_requests_path(@project) %>
<% end %>
</li>
<li>
<% unless @project.enabled_modules.where("name = 'news'").empty? %>
<%= link_to l(:project_module_news), project_news_index_path(@project) %>