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
Boxiang Sun
gitlab-ce
Commits
1d156c9c
Commit
1d156c9c
authored
Dec 13, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix project lookup. Show error if project transfer fails
parent
d0987301
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
2 deletions
+22
-2
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+6
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+4
-0
app/models/project.rb
app/models/project.rb
+9
-1
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+1
-1
app/views/projects/update_failed.js.haml
app/views/projects/update_failed.js.haml
+2
-0
No files found.
app/assets/javascripts/main.js.coffee
View file @
1d156c9c
...
...
@@ -7,6 +7,12 @@ window.slugify = (text) ->
window
.
ajaxGet
=
(
url
)
->
$
.
ajax
({
type
:
"GET"
,
url
:
url
,
dataType
:
"script"
})
window
.
errorMessage
=
(
message
)
->
ehtml
=
$
(
"<p>"
)
ehtml
.
addClass
(
"error_message"
)
ehtml
.
html
(
message
)
ehtml
# Disable button if text field is empty
window
.
disableButtonIfEmptyField
=
(
field_selector
,
button_selector
)
->
field
=
$
(
field_selector
)
...
...
app/controllers/projects_controller.rb
View file @
1d156c9c
...
...
@@ -46,6 +46,10 @@ class ProjectsController < ProjectResourceController
format
.
js
end
end
rescue
Project
::
TransferError
=>
ex
@error
=
ex
render
:update_failed
end
def
show
...
...
app/models/project.rb
View file @
1d156c9c
...
...
@@ -26,6 +26,8 @@ class Project < ActiveRecord::Base
include
Authority
include
Team
class
TransferError
<
StandardError
;
end
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
as:
[
:default
,
:admin
]
...
...
@@ -101,7 +103,7 @@ class Project < ActiveRecord::Base
namespace_id
=
Namespace
.
find_by_path
(
id
.
first
).
id
where
(
namespace_id:
namespace_id
).
find_by_path
(
id
.
last
)
else
find_by_path
(
id
)
where
(
path:
id
,
namespace_id:
nil
).
last
end
end
...
...
@@ -270,12 +272,18 @@ class Project < ActiveRecord::Base
self
.
path
end
if
Project
.
where
(
path:
self
.
path
,
namespace_id:
new_namespace
.
try
(
:id
)).
present?
raise
TransferError
.
new
(
"Project with same path in target namespace already exists"
)
end
Gitlab
::
ProjectMover
.
new
(
self
,
old_dir
,
new_dir
).
execute
git_host
.
move_repository
(
old_repo
,
self
)
save!
end
rescue
Gitlab
::
ProjectMover
::
ProjectMoveError
=>
ex
raise
TransferError
.
new
(
ex
.
message
)
end
def
name_with_namespace
...
...
app/views/projects/_form.html.haml
View file @
1d156c9c
...
...
@@ -22,7 +22,7 @@
%span
Namespace
.controls
-
if
can?
current_user
,
:change_namespace
,
@project
=
f
.
select
:namespace_id
,
namespaces_options
(
@project
.
namespace_id
),
{
prompt:
'Choose a project namespace'
},
{
class:
'chosen'
}
=
f
.
select
:namespace_id
,
namespaces_options
(
@project
.
namespace_id
||
Namespace
::
global_id
),
{
prompt:
'Choose a project namespace'
},
{
class:
'chosen'
}
%span
.cred
Be careful. Changing project namespace can have unintended side effects
-
else
...
...
app/views/projects/update_failed.js.haml
0 → 100644
View file @
1d156c9c
:plain
$(".save-project-loader").replaceWith(errorMessage('
#{
escape_javascript
(
@error
.
message
)
}
'));
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