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
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-09-01 08:58:05 +0300
committerMichael Kozono <mkozono@gmail.com>2017-09-06 22:07:20 +0300
commit8437a24ff46220e2813ce3d82a52062dd259276b (patch)
treec132cfe1a881a9aa7b2eb5794e0c983ebf9dfce9 /app/helpers/groups_helper.rb
parentc93e8f246a3ade5e60e770533393ed1a6df91731 (diff)
Vary share lock setting UI
…based on whether the current user owns the parent group and whether the parent group or current group is share locked.
Diffstat (limited to 'app/helpers/groups_helper.rb')
-rw-r--r--app/helpers/groups_helper.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index eab1feb8a1f..1ced92e0828 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -65,6 +65,22 @@ module GroupsHelper
{ group_name: group.name }
end
+ def share_with_group_lock_disabled
+ return false unless @group.has_parent?
+ return false unless @group.parent.share_with_group_lock?
+ return false unless @group.share_with_group_lock?
+ return false if @group.has_owner?(current_user)
+ return true
+ end
+
+ def share_with_group_lock_help_text
+ return default_help unless @group.has_parent?
+ return default_help unless @group.parent.share_with_group_lock?
+ return parent_locked_and_has_been_overridden unless @group.share_with_group_lock?
+ return parent_locked_but_you_can_override if @group.has_owner?(current_user)
+ return parent_locked_so_ask_the_owner
+ end
+
private
def group_title_link(group, hidable: false, show_avatar: false)
@@ -80,4 +96,20 @@ module GroupsHelper
output.html_safe
end
end
+
+ def default_help
+ "This setting will be applied to all subgroups unless overridden by a group owner."
+ end
+
+ def parent_locked_but_you_can_override
+ "This setting is applied on #{@group.parent.name}. You can override the setting or remove the share lock from the parent group."
+ end
+
+ def parent_locked_so_ask_the_owner
+ "This setting is applied on #{@group.parent.name}. To share this group with another group, ask the owner to override the setting or remove the share lock from the parent group."
+ end
+
+ def parent_locked_and_has_been_overridden
+ "This setting is applied on #{@group.parent.name} and has been overridden on this subgroup."
+ end
end