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
6b4d5d21
Commit
6b4d5d21
authored
Jul 22, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'public-groups' of
https://github.com/innogames/gitlabhq
into 7-2-dev
parents
68a9203b
1da2262e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
149 additions
and
0 deletions
+149
-0
app/controllers/public/groups_controller.rb
app/controllers/public/groups_controller.rb
+14
-0
app/models/group.rb
app/models/group.rb
+16
-0
app/views/layouts/public_groups.html.haml
app/views/layouts/public_groups.html.haml
+11
-0
app/views/public/groups/index.html.haml
app/views/public/groups/index.html.haml
+59
-0
config/routes.rb
config/routes.rb
+1
-0
features/public/public_groups.feature
features/public/public_groups.feature
+32
-0
features/steps/shared/group.rb
features/steps/shared/group.rb
+8
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+8
-0
No files found.
app/controllers/public/groups_controller.rb
0 → 100644
View file @
6b4d5d21
class
Public::GroupsController
<
ApplicationController
skip_before_filter
:authenticate_user!
,
:reject_blocked
,
:set_current_user_for_observers
,
:add_abilities
layout
"public_groups"
def
index
@groups
=
GroupsFinder
.
new
.
execute
(
current_user
)
@groups
=
@groups
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@groups
=
@groups
.
sort
(
@sort
=
params
[
:sort
])
@groups
=
@groups
.
page
(
params
[
:page
]).
per
(
20
)
end
end
app/models/group.rb
View file @
6b4d5d21
...
...
@@ -73,4 +73,20 @@ class Group < Namespace
def
public_profile?
projects
.
public_only
.
any?
end
class
<<
self
def
search
(
query
)
where
(
"LOWER(namespaces.name) LIKE :query"
,
query:
"%
#{
query
.
downcase
}
%"
)
end
def
sort
(
method
)
case
method
.
to_s
when
"newest"
then
reorder
(
"namespaces.created_at DESC"
)
when
"oldest"
then
reorder
(
"namespaces.created_at ASC"
)
when
"recently_updated"
then
reorder
(
"namespaces.updated_at DESC"
)
when
"last_updated"
then
reorder
(
"namespaces.updated_at ASC"
)
else
reorder
(
"namespaces.path, namespaces.name ASC"
)
end
end
end
end
app/views/layouts/public_groups.html.haml
0 → 100644
View file @
6b4d5d21
!!! 5
%html
{
lang:
"en"
}
=
render
"layouts/head"
,
title:
"Public Groups"
%body
{
class:
"#{app_theme} application"
,
:'data-page'
=>
body_data_page
}
=
render
"layouts/broadcast"
-
if
current_user
=
render
"layouts/head_panel"
,
title:
"Public Groups"
-
else
=
render
"layouts/public_head_panel"
,
title:
"Public Groups"
.container.navless-container
.content
=
yield
app/views/public/groups/index.html.haml
0 → 100644
View file @
6b4d5d21
%h3
.page-title
Groups (
#{
@groups
.
total_count
}
)
%p
.light
Group allows you to keep projects organized.
Use groups for uniting related projects.
%hr
.clearfix
.pull-left
=
form_tag
public_groups_path
,
method: :get
,
class:
'form-inline form-tiny'
do
|
f
|
.form-group
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"form-control search-text-input input-mn-300"
,
id:
"groups_search"
.form-group
=
submit_tag
'Search'
,
class:
"btn btn-primary wide"
.pull-right
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
-
if
@sort
.
present?
=
@sort
.
humanize
-
else
Name
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
public_groups_path
(
sort:
nil
)
do
Name
=
link_to
public_groups_path
(
sort:
'newest'
)
do
Newest
=
link_to
public_groups_path
(
sort:
'oldest'
)
do
Oldest
=
link_to
public_groups_path
(
sort:
'recently_updated'
)
do
Recently updated
=
link_to
public_groups_path
(
sort:
'last_updated'
)
do
Last updated
%hr
%ul
.bordered-list
-
@groups
.
each
do
|
group
|
%li
.clearfix
%h4
=
link_to
group_path
(
id:
group
.
path
)
do
%i
.icon-group
=
group
.
name
.clearfix
%p
=
truncate
group
.
description
,
length:
150
.clearfix
%p
.light
#{
pluralize
(
group
.
members
.
size
,
'member'
)
}
,
#{
pluralize
(
group
.
projects
.
count
,
'project'
)
}
-
unless
@groups
.
present?
.nothing-here-block
No public groups
=
paginate
@groups
,
theme:
"gitlab"
config/routes.rb
View file @
6b4d5d21
...
...
@@ -51,6 +51,7 @@ Gitlab::Application.routes.draw do
#
namespace
:public
do
resources
:projects
,
only:
[
:index
]
resources
:groups
,
only:
[
:index
]
root
to:
"projects#index"
end
...
...
features/public/public_groups.feature
View file @
6b4d5d21
...
...
@@ -117,3 +117,35 @@ Feature: Public Projects Feature
And
I visit group
"TestGroup"
members page
Then
I should see group member
"John Doe"
And
I should not see member roles
Scenario
:
I
should see group with public project in public groups area
Given
group
"TestGroup"
has public project
"Community"
When
I visit the public groups area
Then
I should see group
"TestGroup"
Scenario
:
I
should not see group with internal project in public groups area
Given
group
"TestGroup"
has internal project
"Internal"
When
I visit the public groups area
Then
I should not see group
"TestGroup"
Scenario
:
I
should not see group with private project in public groups area
When
I visit the public groups area
Then
I should not see group
"TestGroup"
Scenario
:
I
should see group with public project in public groups area as user
Given
group
"TestGroup"
has public project
"Community"
When
I sign in as a user
And
I visit the public groups area
Then
I should see group
"TestGroup"
Scenario
:
I
should see group with internal project in public groups area as user
Given
group
"TestGroup"
has internal project
"Internal"
When
I sign in as a user
And
I visit the public groups area
Then
I should see group
"TestGroup"
Scenario
:
I
should not see group with private project in public groups area as user
When
I sign in as a user
And
I visit the public groups area
Then
I should not see group
"TestGroup"
features/steps/shared/group.rb
View file @
6b4d5d21
...
...
@@ -21,6 +21,14 @@ module SharedGroup
is_member_of
(
"Mary Jane"
,
"Guest"
,
Gitlab
::
Access
::
GUEST
)
end
step
'I should see group "TestGroup"'
do
page
.
should
have_content
"TestGroup"
end
step
'I should not see group "TestGroup"'
do
page
.
should_not
have_content
"TestGroup"
end
protected
def
is_member_of
(
username
,
groupname
,
role
)
...
...
features/steps/shared/paths.rb
View file @
6b4d5d21
...
...
@@ -331,6 +331,14 @@ module SharedPaths
visit
public_project_path
(
Project
.
find_by
(
name:
"Community"
))
end
# ----------------------------------------
# Public Groups
# ----------------------------------------
step
'I visit the public groups area'
do
visit
public_groups_path
end
# ----------------------------------------
# Snippets
# ----------------------------------------
...
...
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