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
iv
gitlab-ce
Commits
bd59e59d
Commit
bd59e59d
authored
Mar 03, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add visibility level icon and a couple of specs
parent
5551ccd7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
2 deletions
+47
-2
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+5
-1
app/views/shared/groups/_group.html.haml
app/views/shared/groups/_group.html.haml
+3
-0
db/migrate/20160301124843_add_visibility_level_to_groups.rb
db/migrate/20160301124843_add_visibility_level_to_groups.rb
+1
-1
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+38
-0
No files found.
app/helpers/groups_helper.rb
View file @
bd59e59d
...
...
@@ -28,7 +28,7 @@ module GroupsHelper
group
=
Group
.
find_by
(
path:
group
)
end
if
group
&&
can?
(
current_user
,
:read_group
,
group
)
&&
group
.
avatar
.
present?
if
group
&&
group
.
avatar
.
present?
group
.
avatar
.
url
else
'no_group_avatar.png'
...
...
@@ -43,4 +43,8 @@ module GroupsHelper
full_title
end
end
def
group_visibility_description
(
group
)
"
#{
visibility_level_label
(
group
.
visibility_level
)
}
-
#{
group_visibility_level_description
(
group
.
visibility_level
)
}
"
end
end
app/views/shared/groups/_group.html.haml
View file @
bd59e59d
...
...
@@ -21,6 +21,9 @@
=
icon
(
'users'
)
=
number_with_delimiter
(
group
.
users
.
count
)
%span
{
title:
group_visibility_description
(
group
)}
=
visibility_level_icon
(
group
.
visibility_level
,
fw:
false
)
=
image_tag
group_icon
(
group
),
class:
"avatar s40 hidden-xs"
=
link_to
group
,
class:
'group-name title'
do
=
group
.
name
...
...
db/migrate/20160301124843_add_visibility_level_to_groups.rb
View file @
bd59e59d
class
AddVisibilityLevelToGroups
<
ActiveRecord
::
Migration
def
change
#All groups
will be private when created
#All groups
public by default
add_column
:namespaces
,
:visibility_level
,
:integer
,
null:
false
,
default:
20
end
end
spec/controllers/groups_controller_spec.rb
View file @
bd59e59d
...
...
@@ -20,4 +20,42 @@ describe GroupsController do
end
end
end
describe
'GET show'
do
let
(
:group
)
{
create
(
:group
,
visibility_level:
20
)
}
it
'checks if group can be read'
do
expect
(
controller
).
to
receive
(
:authorize_read_group!
)
get
:show
,
id:
group
.
path
end
end
describe
'POST create'
do
before
{
sign_in
(
create
(
:user
))
}
it
'checks if group can be created'
do
expect
(
controller
).
to
receive
(
:authorize_create_group!
)
post
:create
,
{
group:
{
name:
"any params"
}
}
end
end
describe
'DELETE destroy'
do
before
{
sign_in
(
create
(
:user
))
}
let
(
:group
)
{
create
(
:group
,
visibility_level:
20
)
}
it
'checks if group can be deleted'
do
expect
(
controller
).
to
receive
(
:authorize_admin_group!
)
delete
:destroy
,
id:
group
.
path
end
end
describe
'PUT update'
do
before
{
sign_in
(
create
(
:user
))
}
let
(
:group
)
{
create
(
:group
,
visibility_level:
20
)
}
it
'checks if group can be updated'
do
expect
(
controller
).
to
receive
(
:authorize_admin_group!
)
put
:update
,
id:
group
.
path
,
group:
{
name:
'test'
}
end
end
end
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