项目base中统计数字四舍五入,数字中添加链接
This commit is contained in:
parent
2425f7e159
commit
601de5d67f
|
@ -39,7 +39,7 @@ module ApplicationHelper
|
|||
|
||||
# 超出1w后用k+形式显示
|
||||
def switch_integer_into_k number
|
||||
number > 10000 ? (number / 1000).to_s + "k+" : number
|
||||
number > 10000 ? (number.to_f / 1000).round.to_s + "k" : number
|
||||
end
|
||||
|
||||
# 隐藏项目以外的信息
|
||||
|
|
|
@ -23,55 +23,39 @@
|
|||
<div class="pro_new_topnav mt15">
|
||||
<ul>
|
||||
<li id="project_menu_01">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname" %>
|
||||
<% if project_acts > 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k(project_acts) %></span>
|
||||
<% end %>
|
||||
<%= link_to "#{l(:label_activity)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k(project_acts)}</span>".html_safe, {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname", :title => "#{project_acts}" %>
|
||||
</li>
|
||||
<!--问题跟踪-->
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<li id="project_menu_02">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project, :remote => true), :class => "pro_new_proname" %>
|
||||
<% if project_issue_count > 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_issue_count %></span>
|
||||
<% end %>
|
||||
<%= link_to project_issue_count > 0 ? "#{l(:label_issue_tracking)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_issue_count}</span>".html_safe : "#{l(:label_issue_tracking)}", project_issues_path(@project, :remote => true), :class => "pro_new_proname", :title => "#{project_issue_count}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--讨论区-->
|
||||
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
|
||||
<li id="project_menu_03">
|
||||
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "pro_new_proname" %>
|
||||
<% unless project_score.board_num == 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.board_num %></span>
|
||||
<% end %>
|
||||
<%= link_to project_score.board_num > 0 ? "#{l(:project_module_boards)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.board_num}</span>".html_safe : "#{l(:project_module_boards)}", project_boards_path(@project), :class => "pro_new_proname", :title => "#{project_score.board_num}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--资源库-->
|
||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||
<li id="project_menu_04">
|
||||
<%= link_to l(:project_module_files), project_files_path(@project), :class => "pro_new_proname" %>
|
||||
<% unless project_file_num == 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_file_num %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<%= link_to project_file_num > 0 ? "#{l(:project_module_files)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_file_num}</span>".html_safe : l(:project_module_files), project_files_path(@project), :class => "pro_new_proname", :title => "#{project_file_num}" %>
|
||||
<% end %>
|
||||
<!--版本库-->
|
||||
<% if visible_repository?(@project) %>
|
||||
<li id="project_menu_05"><%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname" %>
|
||||
<% unless @project.project_score.changeset_num == 0 %>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.changeset_num %></span>
|
||||
<% end %>
|
||||
<li id="project_menu_05"><%= link_to @project.project_score.changeset_num > 0 ? "#{l(:project_module_repository)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.changeset_num}</span>".html_safe : "#{l(:project_module_repository)}",({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname", :title => "#{project_score.changeset_num}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--Pull Request-->
|
||||
<li id="project_menu_06">
|
||||
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname" %>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.pull_request_num %></span>
|
||||
<%= link_to project_score.pull_request_num >0 ? "Pull Requests <span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.pull_request_num}</span>".html_safe : "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname", :title => "#{project_score.pull_request_num}" %>
|
||||
<% if project_score.pull_request_num >0 %>
|
||||
<% end %>
|
||||
</li>
|
||||
<!--里程碑-->
|
||||
<li id="project_menu_07">
|
||||
<%= link_to l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %>
|
||||
<span class="issues_nav_tag ml5"><%= switch_integer_into_k @project.versions.count %></span>
|
||||
<%= link_to @project.versions.count >0 ? "#{l(:label_roadmap)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k @project.versions.count}</span>".html_safe : l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %>
|
||||
</li>
|
||||
<!--日历-->
|
||||
<% unless @project.enabled_modules.where("name = 'calendar'").empty? %>
|
||||
|
|
Loading…
Reference in New Issue