From a722cb003108be1eb0cd9076d98b24e28f0f8660 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 19 Oct 2016 16:35:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E8=BF=871w=E7=9A=84=E7=94=A8k+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 5 +++++ app/views/layouts/_base_project_top.html.erb | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0f6798328..41abef7c2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/views/layouts/_base_project_top.html.erb b/app/views/layouts/_base_project_top.html.erb index 542c9ee73..ed83ea940 100644 --- a/app/views/layouts/_base_project_top.html.erb +++ b/app/views/layouts/_base_project_top.html.erb @@ -25,7 +25,7 @@
  • <%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname" %> <% if project_acts > 0 %> - <%= project_acts %> + <%= switch_integer_into_k(project_acts) %> <% end %>
  • @@ -33,7 +33,7 @@
  • <%= link_to l(:label_issue_tracking), project_issues_path(@project, :remote => true), :class => "pro_new_proname" %> <% if project_issue_count > 0 %> - <%= project_issue_count %> + <%= switch_integer_into_k project_issue_count %> <% end %>
  • <% end %> @@ -42,7 +42,7 @@
  • <%= link_to l(:project_module_boards), project_boards_path(@project), :class => "pro_new_proname" %> <% unless project_score.board_num == 0 %> - <%= project_score.board_num %> + <%= switch_integer_into_k project_score.board_num %> <% end %>
  • <% end %> @@ -51,7 +51,7 @@
  • <%= link_to l(:project_module_files), project_files_path(@project), :class => "pro_new_proname" %> <% unless project_file_num == 0 %> - <%= project_file_num %> + <%= switch_integer_into_k project_file_num %> <% end %>
  • <% end %> @@ -59,19 +59,19 @@ <% if visible_repository?(@project) %>
  • <%= 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 %> - <%= project_score.changeset_num %> + <%= switch_integer_into_k project_score.changeset_num %> <% end %>
  • <% end %>
  • <%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname" %> - <%= project_score.pull_request_num %> + <%= switch_integer_into_k project_score.pull_request_num %>
  • <%= link_to l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %> - 25 + <%= switch_integer_into_k @project.versions.count %>
  • <% unless @project.enabled_modules.where("name = 'calendar'").empty? %>