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
f6c482c0
Commit
f6c482c0
authored
Jan 24, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
User can create group
parent
d9027df5
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
117 additions
and
31 deletions
+117
-31
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+22
-4
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+6
-1
app/models/user.rb
app/models/user.rb
+1
-1
app/views/dashboard/_groups.html.haml
app/views/dashboard/_groups.html.haml
+1
-1
app/views/groups/new.html.haml
app/views/groups/new.html.haml
+21
-0
app/views/layouts/_head_panel.html.haml
app/views/layouts/_head_panel.html.haml
+1
-1
app/views/projects/_new_form.html.haml
app/views/projects/_new_form.html.haml
+6
-0
app/views/users/_profile.html.haml
app/views/users/_profile.html.haml
+23
-0
app/views/users/show.html.haml
app/views/users/show.html.haml
+6
-22
config/routes.rb
config/routes.rb
+1
-1
features/group/create_group.feature
features/group/create_group.feature
+11
-0
features/steps/group/group.rb
features/steps/group/group.rb
+18
-0
No files found.
app/controllers/groups_controller.rb
View file @
f6c482c0
class
GroupsController
<
ApplicationController
respond_to
:html
layout
'group'
layout
'group'
,
except:
[
:new
,
:create
]
before_filter
:group
before_filter
:projects
before_filter
:group
,
except:
[
:new
,
:create
]
# Authorize
before_filter
:authorize_read_group!
before_filter
:authorize_read_group!
,
except:
[
:new
,
:create
]
# Load group projects
before_filter
:projects
,
except:
[
:new
,
:create
]
def
new
@group
=
Group
.
new
end
def
create
@group
=
Group
.
new
(
params
[
:group
])
@group
.
path
=
@group
.
name
.
dup
.
parameterize
if
@group
.
name
@group
.
owner
=
current_user
if
@group
.
save
redirect_to
@group
,
notice:
'Group was successfully created.'
else
render
action:
"new"
end
end
def
show
@events
=
Event
.
in_projects
(
project_ids
).
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
...
...
app/helpers/tab_helper.rb
View file @
f6c482c0
...
...
@@ -39,7 +39,12 @@ module TabHelper
# Returns a list item element String
def
nav_link
(
options
=
{},
&
block
)
if
path
=
options
.
delete
(
:path
)
if
path
.
respond_to?
(
:each
)
c
=
path
.
map
{
|
p
|
p
.
split
(
'#'
).
first
}
a
=
path
.
map
{
|
p
|
p
.
split
(
'#'
).
last
}
else
c
,
a
,
_
=
path
.
split
(
'#'
)
end
else
c
=
options
.
delete
(
:controller
)
a
=
options
.
delete
(
:action
)
...
...
app/models/user.rb
View file @
f6c482c0
...
...
@@ -220,7 +220,7 @@ class User < ActiveRecord::Base
end
def
can_create_group?
is_admin
?
can_create_project
?
end
def
abilities
...
...
app/views/dashboard/_groups.html.haml
View file @
f6c482c0
...
...
@@ -5,7 +5,7 @@
(
#{
groups
.
count
}
)
-
if
current_user
.
can_create_group?
%span
.right
=
link_to
new_
admin_
group_path
,
class:
"btn very_small info"
do
=
link_to
new_group_path
,
class:
"btn very_small info"
do
%i
.icon-plus
New Group
%ul
.well-list
...
...
app/views/groups/new.html.haml
0 → 100644
View file @
f6c482c0
%h3
.page_title
New Group
%hr
=
form_for
@group
do
|
f
|
-
if
@group
.
errors
.
any?
.alert-message.block-message.error
%span
=
@group
.
errors
.
full_messages
.
first
.clearfix
=
f
.
label
:name
do
Group name is
.input
=
f
.
text_field
:name
,
placeholder:
"Ex. OpenSource"
,
class:
"xxlarge left"
=
f
.
submit
'Create group'
,
class:
"btn primary"
%hr
.padded
%ul
%li
Group is kind of directory for several projects
%li
All created groups are private
%li
People within a group see only projects they have access to
%li
All projects of group will be stored in group directory
%li
You will be able to move existing projects into group
app/views/layouts/_head_panel.html.haml
View file @
f6c482c0
...
...
@@ -17,7 +17,7 @@
=
link_to
new_project_path
,
title:
"Create New Project"
,
class:
'has_bottom_tooltip'
,
'data-original-title'
=>
'New project'
do
%i
.icon-plus
%li
=
link_to
profile_path
,
title:
"
Your
Profile"
,
class:
'has_bottom_tooltip'
,
'data-original-title'
=>
'Your profile'
do
=
link_to
profile_path
,
title:
"
My
Profile"
,
class:
'has_bottom_tooltip'
,
'data-original-title'
=>
'Your profile'
do
%i
.icon-user
%li
.separator
%li
...
...
app/views/projects/_new_form.html.haml
View file @
f6c482c0
...
...
@@ -15,6 +15,12 @@
%span
Namespace
.input
=
f
.
select
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
]
||
:current_user
),
{},
{
class:
'chosen'
}
-
elsif
current_user
.
can_create_group?
.clearfix
.input.light
Need a group for several projects?
=
link_to
new_group_path
,
class:
"btn very_small"
do
Create a group
%hr
%p
.padded
New projects are private by default. You choose who can see the project and commit to repository.
app/views/users/_profile.html.haml
0 → 100644
View file @
f6c482c0
.ui-box
%h5
.title
Profile
%ul
.well-list
%li
%strong
Email
%span
.right
=
mail_to
@user
.
email
-
unless
@user
.
skype
.
blank?
%li
%strong
Skype
%span
.right
=
@user
.
skype
-
unless
@user
.
linkedin
.
blank?
%li
%strong
LinkedIn
%span
.right
=
@user
.
linkedin
-
unless
@user
.
twitter
.
blank?
%li
%strong
Twitter
%span
.right
=
@user
.
twitter
-
unless
@user
.
bio
.
blank?
%li
%strong
Bio
%span
.right
=
@user
.
bio
app/views/users/show.html.haml
View file @
f6c482c0
...
...
@@ -3,6 +3,11 @@
%h3
.page_title
=
image_tag
gravatar_icon
(
@user
.
email
,
90
),
class:
"avatar s90"
=
@user
.
name
-
if
@user
==
current_user
.right
=
link_to
profile_path
,
class:
'btn small'
do
%i
.icon-edit
Edit Profile
%br
%small
@
#{
@user
.
username
}
%br
...
...
@@ -12,26 +17,5 @@
%h5
Recent events
=
render
@events
.span4
.ui-box
%h5
.title
Profile
%ul
.well-list
%li
%strong
Email
%span
.right
=
mail_to
@user
.
email
-
unless
@user
.
skype
.
blank?
%li
%strong
Skype
%span
.right
=
@user
.
skype
-
unless
@user
.
linkedin
.
blank?
%li
%strong
LinkedIn
%span
.right
=
@user
.
linkedin
-
unless
@user
.
twitter
.
blank?
%li
%strong
Twitter
%span
.right
=
@user
.
twitter
-
unless
@user
.
bio
.
blank?
%li
%strong
Bio
%span
.right
=
@user
.
bio
=
render
'profile'
=
render
'projects'
config/routes.rb
View file @
f6c482c0
...
...
@@ -112,7 +112,7 @@ Gitlab::Application.routes.draw do
#
# Groups Area
#
resources
:groups
,
constraints:
{
id:
/[^\/]+/
},
only:
[
:show
]
do
resources
:groups
,
constraints:
{
id:
/[^\/]+/
},
only:
[
:show
,
:new
,
:create
]
do
member
do
get
:issues
get
:merge_requests
...
...
features/group/create_group.feature
0 → 100644
View file @
f6c482c0
Feature
:
Groups
Background
:
Given
I sign in as a user
Scenario
:
Create a group from dasboard
Given
I have group with projects
And
I visit dashboard page
When
I click new group link
And
submit form with new group info
Then
I should be redirected to group page
And
I should see newly created group
features/steps/group/group.rb
View file @
f6c482c0
...
...
@@ -64,6 +64,24 @@ class Groups < Spinach::FeatureSteps
author:
current_user
end
When
'I click new group link'
do
click_link
"New Group"
end
And
'submit form with new group info'
do
fill_in
'group_name'
,
:with
=>
'Samurai'
click_button
"Create group"
end
Then
'I should see newly created group'
do
page
.
should
have_content
"Samurai"
page
.
should
have_content
"You will only see events from projects in this group"
end
Then
'I should be redirected to group page'
do
current_path
.
should
==
group_path
(
Group
.
last
)
end
protected
def
current_group
...
...
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