PULL REQUEST 默认情况下不显示

This commit is contained in:
huang 2016-08-31 09:18:05 +08:00
parent 2b7a38062c
commit 0c221abd61
3 changed files with 10 additions and 12 deletions

View File

@ -830,11 +830,7 @@ module ApplicationHelper
return false if project.gpid.nil? return false if project.gpid.nil?
g = Gitlab.client g = Gitlab.client
count = g.user_static(project.gpid, :rev => "master").count count = g.user_static(project.gpid, :rev => "master").count
if User.current.member_of?(project) && count > 0 count
true
else
false
end
end end
# 判断版本库是否初始为gitlab # 判断版本库是否初始为gitlab

View File

@ -40,12 +40,14 @@
</div> </div>
<% end %> <% end %>
<div class="subNav"> <% if allow_pull_request(@project) %>
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %> <div class="subNav">
<% if allow_pull_request(@project) %> <%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %> <% if User.current.member_of?(@project) %>
<% end %> <%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %>
</div> <% end %>
</div>
<% end %>
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% if visible_repository?(@project) %> <% if visible_repository?(@project) %>

View File

@ -3,7 +3,7 @@
<li class="active"><%= link_to "待处理<span class='project-number-dot'>#{@requests_opened_count}</span>".html_safe, project_pull_requests_path(:type => "1"), :remote => true %></li> <li class="active"><%= link_to "待处理<span class='project-number-dot'>#{@requests_opened_count}</span>".html_safe, project_pull_requests_path(:type => "1"), :remote => true %></li>
<li><%= link_to "已处理<span class='project-number-dot'>#{@requests_merged_count}</span>".html_safe, project_pull_requests_path(:type => "2"), :remote => true %></li> <li><%= link_to "已处理<span class='project-number-dot'>#{@requests_merged_count}</span>".html_safe, project_pull_requests_path(:type => "2"), :remote => true %></li>
<li><%= link_to "已关闭<span class='project-number-dot'>#{@requests_closed_count}</span>".html_safe, project_pull_requests_path(:type => "3"), :remote => true %></li> <li><%= link_to "已关闭<span class='project-number-dot'>#{@requests_closed_count}</span>".html_safe, project_pull_requests_path(:type => "3"), :remote => true %></li>
<% if allow_pull_request(@project) %> <% if allow_pull_request(@project) && User.current.member_of?(@project) %>
<%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %> <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>