summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-09-05 15:40:49 -0500
committerPatricio Cano <suprnova32@gmail.com>2016-09-15 12:27:32 -0500
commitd0279ccba5c4a2cd8611ddec04eeff67e0e9f9c6 (patch)
tree7ac30cc01b98b417f7933f22411339547af29504
parentc788c66a85ba4682f5e27a12b5fa73489af23b5f (diff)
downloadgitlab-ce-d0279ccba5c4a2cd8611ddec04eeff67e0e9f9c6.tar.gz
Correct helper for group LFS status.
-rw-r--r--app/helpers/groups_helper.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 0352a48e050..76911efe354 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -24,27 +24,27 @@ module GroupsHelper
end
end
- def projects_with_lfs_enabled(group)
- lfs_enabled = group.projects.select(&:lfs_enabled?).size
+ def projects_with_lfs_enabled(group, status)
+ if status
+ lfs_status = group.projects.select(&:lfs_enabled?).size
+ else
+ lfs_status = group.projects.select{ |p| !p.lfs_enabled? }.size
+ end
+
size = group.projects.size
- if lfs_enabled == size || lfs_enabled == 0
- ' on all projects'
+ if lfs_status == size || lfs_status == 0
+ 'on all projects'
else
- " on #{lfs_enabled}/#{size} projects"
+ "on #{lfs_status} out of #{size} projects"
end
end
def group_lfs_status(group)
- if group.lfs_enabled?
- output = content_tag(:span, class: 'lfs-enabled') do
- 'Enabled'
- end
- else
- output = content_tag(:span, class: 'lfs-disabled') do
- 'Disabled'
- end
+ status = group.lfs_enabled? ? 'enabled' : 'disabled'
+
+ content_tag(:span, class: "lfs-#{status}") do
+ "#{status.humanize} #{projects_with_lfs_enabled(group, group.lfs_enabled?)}"
end
- output << projects_with_lfs_enabled(group)
end
end