Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
edf8dd44
Commit
edf8dd44
authored
Sep 05, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify disabling checkbox
parent
c7e17abd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+4
-8
app/views/groups/edit.html.haml
app/views/groups/edit.html.haml
+1
-1
No files found.
app/helpers/groups_helper.rb
View file @
edf8dd44
...
@@ -3,6 +3,10 @@ module GroupsHelper
...
@@ -3,6 +3,10 @@ module GroupsHelper
can?
(
current_user
,
:change_visibility_level
,
group
)
can?
(
current_user
,
:change_visibility_level
,
group
)
end
end
def
can_change_share_with_group_lock?
(
group
)
can?
(
current_user
,
:change_share_with_group_lock
,
group
)
end
def
group_icon
(
group
)
def
group_icon
(
group
)
if
group
.
is_a?
(
String
)
if
group
.
is_a?
(
String
)
group
=
Group
.
find_by_full_path
(
group
)
group
=
Group
.
find_by_full_path
(
group
)
...
@@ -65,14 +69,6 @@ module GroupsHelper
...
@@ -65,14 +69,6 @@ module GroupsHelper
{
group_name:
group
.
name
}
{
group_name:
group
.
name
}
end
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
def
share_with_group_lock_help_text
return
default_help
unless
@group
.
has_parent?
return
default_help
unless
@group
.
has_parent?
return
default_help
unless
@group
.
parent
.
share_with_group_lock?
return
default_help
unless
@group
.
parent
.
share_with_group_lock?
...
...
app/views/groups/edit.html.haml
View file @
edf8dd44
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
.col-sm-10
.col-sm-10
.checkbox
.checkbox
=
f
.
label
:share_with_group_lock
do
=
f
.
label
:share_with_group_lock
do
=
f
.
check_box
:share_with_group_lock
,
disabled:
share_with_group_lock_disabled
=
f
.
check_box
:share_with_group_lock
,
disabled:
!
can_change_share_with_group_lock?
(
@group
)
%strong
%strong
-
group_link
=
link_to
@group
.
name
,
group_path
(
@group
)
-
group_link
=
link_to
@group
.
name
,
group_path
(
@group
)
=
s_
(
"GroupSettings|Prevent sharing a project within %{group} with other groups"
).
html_safe
%
{
group:
group_link
}
=
s_
(
"GroupSettings|Prevent sharing a project within %{group} with other groups"
).
html_safe
%
{
group:
group_link
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment