Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-09-06 19:48:00 +0300
committerPatricio Cano <suprnova32@gmail.com>2016-09-15 22:10:49 +0300
commit02ddb9dff4084f615f744614cf81dc4166d61668 (patch)
treecb960761b5f5786d635d6acf06512ea713ad572e /app
parentd0279ccba5c4a2cd8611ddec04eeff67e0e9f9c6 (diff)
Syntax fixes and better tests for helper methods. Updated docs.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/groups_controller.rb8
-rw-r--r--app/controllers/groups_controller.rb10
-rw-r--r--app/helpers/groups_helper.rb21
-rw-r--r--app/views/admin/groups/_form.html.haml2
-rw-r--r--app/views/groups/_group_lfs_settings.html.haml (renamed from app/views/shared/groups/_group_lfs_settings.html.haml)0
-rw-r--r--app/views/groups/edit.html.haml2
6 files changed, 22 insertions, 21 deletions
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb
index adb8a891c32..aed77d0358a 100644
--- a/app/controllers/admin/groups_controller.rb
+++ b/app/controllers/admin/groups_controller.rb
@@ -61,13 +61,13 @@ class Admin::GroupsController < Admin::ApplicationController
def group_params
params.require(:group).permit(
- :name,
+ :avatar,
:description,
+ :lfs_enabled,
+ :name,
:path,
- :avatar,
- :visibility_level,
:request_access_enabled,
- :lfs_enabled
+ :visibility_level
)
end
end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 2f7113aa709..b83c3a872cf 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -122,15 +122,15 @@ class GroupsController < Groups::ApplicationController
def group_params
params.require(:group).permit(
- :name,
+ :avatar,
:description,
+ :lfs_enabled,
+ :name,
:path,
- :avatar,
:public,
- :visibility_level,
- :share_with_group_lock,
:request_access_enabled,
- :lfs_enabled
+ :share_with_group_lock,
+ :visibility_level
)
end
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
diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml
index cb631cbfb8d..817910f7ddf 100644
--- a/app/views/admin/groups/_form.html.haml
+++ b/app/views/admin/groups/_form.html.haml
@@ -13,7 +13,7 @@
.col-sm-offset-2.col-sm-10
= render 'shared/allow_request_access', form: f
- = render 'shared/groups/group_lfs_settings', f: f
+ = render 'groups/group_lfs_settings', f: f
- if @group.new_record?
.form-group
diff --git a/app/views/shared/groups/_group_lfs_settings.html.haml b/app/views/groups/_group_lfs_settings.html.haml
index af57065f0fc..af57065f0fc 100644
--- a/app/views/shared/groups/_group_lfs_settings.html.haml
+++ b/app/views/groups/_group_lfs_settings.html.haml
diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml
index 849d0f360e7..c766370d5a0 100644
--- a/app/views/groups/edit.html.haml
+++ b/app/views/groups/edit.html.haml
@@ -25,7 +25,7 @@
.col-sm-offset-2.col-sm-10
= render 'shared/allow_request_access', form: f
- = render 'shared/groups/group_lfs_settings', f: f
+ = render 'group_lfs_settings', f: f
.form-group
%hr