summaryrefslogtreecommitdiff
path: root/app/helpers/groups_helper.rb
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-09-06 11:48:00 -0500
committerPatricio Cano <suprnova32@gmail.com>2016-09-15 14:10:49 -0500
commit02ddb9dff4084f615f744614cf81dc4166d61668 (patch)
treecb960761b5f5786d635d6acf06512ea713ad572e /app/helpers/groups_helper.rb
parentd0279ccba5c4a2cd8611ddec04eeff67e0e9f9c6 (diff)
downloadgitlab-ce-02ddb9dff4084f615f744614cf81dc4166d61668.tar.gz
Syntax fixes and better tests for helper methods. Updated docs.group-specific-lfs-settings
Diffstat (limited to 'app/helpers/groups_helper.rb')
-rw-r--r--app/helpers/groups_helper.rb21
1 files changed, 11 insertions, 10 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 76911efe354..ab880ed6de0 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -24,19 +24,20 @@ module GroupsHelper
end
end
- 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
+ def projects_lfs_status(group)
+ lfs_status =
+ if group.lfs_enabled?
+ group.projects.select(&:lfs_enabled?).size
+ else
+ group.projects.reject(&:lfs_enabled?).size
+ end
size = group.projects.size
- if lfs_status == size || lfs_status == 0
- 'on all projects'
+ if lfs_status == size
+ 'for all projects'
else
- "on #{lfs_status} out of #{size} projects"
+ "for #{lfs_status} out of #{pluralize(size, 'project')}"
end
end
@@ -44,7 +45,7 @@ module GroupsHelper
status = group.lfs_enabled? ? 'enabled' : 'disabled'
content_tag(:span, class: "lfs-#{status}") do
- "#{status.humanize} #{projects_with_lfs_enabled(group, group.lfs_enabled?)}"
+ "#{status.humanize} #{projects_lfs_status(group)}"
end
end
end