超过1w的用k+

This commit is contained in:
huang 2016-10-19 16:35:26 +08:00
parent da78adc697
commit a722cb0031
2 changed files with 12 additions and 7 deletions

View File

@ -37,6 +37,11 @@ module ApplicationHelper
# super
# end
# 超出1w后用k+形式显示
def switch_integer_into_k number
number > 10000 ? (number / 1000).to_s + "k+" : number
end
# 隐藏项目以外的信息
# return: true 显示false 不显示
def hidden_unproject_infos

View File

@ -25,7 +25,7 @@
<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"><%= project_acts %></span>
<span class="issues_nav_tag ml5"><%= switch_integer_into_k(project_acts) %></span>
<% end %>
</li>
<!--问题跟踪-->
@ -33,7 +33,7 @@
<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"><%= project_issue_count %></span>
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_issue_count %></span>
<% end %>
</li>
<% end %>
@ -42,7 +42,7 @@
<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"><%= project_score.board_num %></span>
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.board_num %></span>
<% end %>
</li>
<% end %>
@ -51,7 +51,7 @@
<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"><%= project_file_num %></span>
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_file_num %></span>
<% end %>
</li>
<% end %>
@ -59,19 +59,19 @@
<% 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"><%= project_score.changeset_num %></span>
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.changeset_num %></span>
<% end %>
</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"><%= project_score.pull_request_num %></span>
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.pull_request_num %></span>
</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">25</span>
<span class="issues_nav_tag ml5"><%= switch_integer_into_k @project.versions.count %></span>
</li>
<!--日历-->
<% unless @project.enabled_modules.where("name = 'calendar'").empty? %>