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
94f8b51c
Commit
94f8b51c
authored
Nov 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/leave_project' of /home/git/repositories/gitlab/gitlabhq
parents
b813a488
d78b6ce4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
3 deletions
+29
-3
app/controllers/projects/team_members_controller.rb
app/controllers/projects/team_members_controller.rb
+10
-1
app/models/project.rb
app/models/project.rb
+5
-1
app/models/user.rb
app/models/user.rb
+5
-0
app/views/dashboard/projects.html.haml
app/views/dashboard/projects.html.haml
+8
-1
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/controllers/projects/team_members_controller.rb
View file @
94f8b51c
class
Projects::TeamMembersController
<
Projects
::
ApplicationController
class
Projects::TeamMembersController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_admin_project!
before_filter
:authorize_admin_project!
,
except: :leave
layout
"project_settings"
layout
"project_settings"
...
@@ -45,6 +45,15 @@ class Projects::TeamMembersController < Projects::ApplicationController
...
@@ -45,6 +45,15 @@ class Projects::TeamMembersController < Projects::ApplicationController
end
end
end
end
def
leave
project
.
users_projects
.
find_by_user_id
(
current_user
).
destroy
respond_to
do
|
format
|
format
.
html
{
redirect_to
:back
}
format
.
js
{
render
nothing:
true
}
end
end
def
apply_import
def
apply_import
giver
=
Project
.
find
(
params
[
:source_project_id
])
giver
=
Project
.
find
(
params
[
:source_project_id
])
status
=
@project
.
team
.
import
(
giver
)
status
=
@project
.
team
.
import
(
giver
)
...
...
app/models/project.rb
View file @
94f8b51c
...
@@ -447,4 +447,8 @@ class Project < ActiveRecord::Base
...
@@ -447,4 +447,8 @@ class Project < ActiveRecord::Base
order
(
'id DESC'
).
limit
(
100
).
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
update_all
(
updated_at:
Time
.
now
)
end
end
def
project_member
(
user
)
users_projects
.
where
(
user_id:
user
).
first
end
end
end
app/models/user.rb
View file @
94f8b51c
...
@@ -395,4 +395,9 @@ class User < ActiveRecord::Base
...
@@ -395,4 +395,9 @@ class User < ActiveRecord::Base
self
self
end
end
def
can_leave_project?
(
project
)
project
.
namespace
!=
namespace
&&
project
.
project_member
(
self
)
end
end
end
app/views/dashboard/projects.html.haml
View file @
94f8b51c
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
.span9
.span9
%ul
.bordered-list.my-projects.top-list
%ul
.bordered-list.my-projects.top-list
-
@projects
.
each
do
|
project
|
-
@projects
.
each
do
|
project
|
%li
%li
.my-project-row
%h4
.project-title
%h4
.project-title
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
=
project
.
name_with_namespace
=
project
.
name_with_namespace
...
@@ -63,6 +63,12 @@
...
@@ -63,6 +63,12 @@
=
public_icon
=
public_icon
Public
Public
-
if
current_user
.
can_leave_project?
(
project
)
.pull-right
=
link_to
leave_project_team_members_path
(
project
),
confirm:
"Leave project?"
,
method: :delete
,
remote:
true
,
class:
"btn-tiny btn remove-row"
,
title:
'Leave project'
do
%i
.icon-signout
Leave
-
if
project
.
forked_from_project
-
if
project
.
forked_from_project
%small
.pull-right
%small
.pull-right
%i
.icon-code-fork
%i
.icon-code-fork
...
@@ -80,6 +86,7 @@
...
@@ -80,6 +86,7 @@
%span
.light
Last activity:
%span
.light
Last activity:
%span
.date
=
project_last_activity
(
project
)
%span
.date
=
project_last_activity
(
project
)
-
if
@projects
.
blank?
-
if
@projects
.
blank?
%li
%li
%h3
.nothing_here_message
There are no projects here.
%h3
.nothing_here_message
There are no projects here.
...
...
config/routes.rb
View file @
94f8b51c
...
@@ -288,6 +288,7 @@ Gitlab::Application.routes.draw do
...
@@ -288,6 +288,7 @@ Gitlab::Application.routes.draw do
resources
:team_members
,
except:
[
:index
,
:edit
],
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
do
resources
:team_members
,
except:
[
:index
,
:edit
],
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
do
collection
do
collection
do
delete
:leave
# Used for import team
# Used for import team
# from another project
# from another project
...
...
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