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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
1fb99264
Commit
1fb99264
authored
Mar 25, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use TransferContext for project
parent
850881a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
app/contexts/projects/transfer_context.rb
app/contexts/projects/transfer_context.rb
+27
-0
app/views/projects/transfer.js.haml
app/views/projects/transfer.js.haml
+7
-0
No files found.
app/contexts/projects/transfer_context.rb
0 → 100644
View file @
1fb99264
module
Projects
class
TransferContext
<
BaseContext
def
execute
(
role
=
:default
)
namespace_id
=
params
[
:project
].
delete
(
:namespace_id
)
allowed_transfer
=
can?
(
current_user
,
:change_namespace
,
project
)
||
role
==
:admin
if
allowed_transfer
&&
namespace_id
.
present?
if
namespace_id
==
Namespace
.
global_id
if
project
.
namespace
.
present?
# Transfer to global namespace from anyone
project
.
transfer
(
nil
)
end
elsif
namespace_id
.
to_i
!=
project
.
namespace_id
# Transfer to someone namespace
namespace
=
Namespace
.
find
(
namespace_id
)
project
.
transfer
(
namespace
)
end
end
rescue
ProjectTransferService
::
TransferError
=>
ex
project
.
reload
project
.
errors
.
add
(
:namespace_id
,
ex
.
message
)
false
end
end
end
app/views/projects/transfer.js.haml
0 → 100644
View file @
1fb99264
-
if
@project
.
errors
[
:namespace_id
].
present?
:plain
$("#tab-transfer .errors-holder").replaceWith(errorMessage('
#{
escape_javascript
(
@project
.
errors
[
:namespace_id
].
first
)
}
'));
$("#tab-transfer .form-actions input").removeAttr('disabled').removeClass('disabled');
-
else
:plain
location.href = "
#{
edit_project_path
(
@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