OSDN Git Service

Show bare repository size in admin area(projects page)
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 29 Nov 2013 12:16:17 +0000 (14:16 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 29 Nov 2013 12:16:17 +0000 (14:16 +0200)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/helpers/projects_helper.rb
app/views/admin/groups/show.html.haml
app/views/admin/projects/index.html.haml

index 6b6903c..096cef0 100644 (file)
@@ -137,8 +137,8 @@ module ProjectsHelper
     end
   end
 
-  def repository_size
-    "#{@project.repository.size} MB"
+  def repository_size(project = nil)
+    "#{(project || @project).repository.size} MB"
   rescue
     # In order to prevent 500 error
     # when application cannot allocate memory
index ca51a57..299f397 100644 (file)
@@ -39,6 +39,8 @@
           %li
             %strong
               = link_to project.name_with_namespace, [:admin, project]
+              %span.label.label-gray
+                = repository_size(project)
             %span.pull-right.light
               %span.monospace= project.path_with_namespace + ".git"
 
index 05236e3..890321d 100644 (file)
@@ -49,6 +49,8 @@
             = visibility_level_icon(project.visibility_level)
             = link_to project.name_with_namespace, [:admin, project]
             .pull-right
+              %span.label.label-gray
+                = repository_size(project)
               = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
               = link_to 'Destroy', [project], confirm: remove_project_message(project), method: :delete, class: "btn btn-small btn-remove"
         - if @projects.blank?