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
254c5aaa
Commit
254c5aaa
authored
Sep 19, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
few fixes based on MR feedback
parent
173b1128
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
20 deletions
+11
-20
app/assets/javascripts/importer_status.js
app/assets/javascripts/importer_status.js
+5
-5
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+2
-11
app/views/import/github/status.html.haml
app/views/import/github/status.html.haml
+4
-4
No files found.
app/assets/javascripts/importer_status.js
View file @
254c5aaa
...
@@ -10,24 +10,24 @@
...
@@ -10,24 +10,24 @@
ImporterStatus
.
prototype
.
initStatusPage
=
function
()
{
ImporterStatus
.
prototype
.
initStatusPage
=
function
()
{
$
(
'
.js-add-to-import
'
).
off
(
'
click
'
).
on
(
'
click
'
,
(
function
(
_this
)
{
$
(
'
.js-add-to-import
'
).
off
(
'
click
'
).
on
(
'
click
'
,
(
function
(
_this
)
{
return
function
(
e
)
{
return
function
(
e
)
{
var
$btn
,
$namespace_input
,
$target_field
,
$tr
,
id
,
target_namespace
;
var
$btn
,
$namespace_input
,
$target_field
,
$tr
,
id
,
target_namespace
,
newName
;
$btn
=
$
(
e
.
currentTarget
);
$btn
=
$
(
e
.
currentTarget
);
$tr
=
$btn
.
closest
(
'
tr
'
);
$tr
=
$btn
.
closest
(
'
tr
'
);
$target_field
=
$tr
.
find
(
'
.import-target
'
);
$target_field
=
$tr
.
find
(
'
.import-target
'
);
$namespace_input
=
$target_field
.
find
(
'
.js-select-namespace option:selected
'
);
$namespace_input
=
$target_field
.
find
(
'
.js-select-namespace option:selected
'
);
id
=
$tr
.
attr
(
'
id
'
).
replace
(
'
repo_
'
,
''
);
id
=
$tr
.
attr
(
'
id
'
).
replace
(
'
repo_
'
,
''
);
target_namespace
=
null
;
target_namespace
=
null
;
new
_n
ame
=
null
;
new
N
ame
=
null
;
if
(
$namespace_input
.
length
>
0
)
{
if
(
$namespace_input
.
length
>
0
)
{
target_namespace
=
$namespace_input
[
0
].
innerHTML
;
target_namespace
=
$namespace_input
[
0
].
innerHTML
;
new_n
ame
=
$target_field
.
find
(
'
#path
'
).
prop
(
'
value
'
);
newN
ame
=
$target_field
.
find
(
'
#path
'
).
prop
(
'
value
'
);
$target_field
.
empty
().
append
(
target_namespace
+
"
/
"
+
new
_n
ame
);
$target_field
.
empty
().
append
(
target_namespace
+
"
/
"
+
new
N
ame
);
}
}
$btn
.
disable
().
addClass
(
'
is-loading
'
);
$btn
.
disable
().
addClass
(
'
is-loading
'
);
return
$
.
post
(
_this
.
import_url
,
{
return
$
.
post
(
_this
.
import_url
,
{
repo_id
:
id
,
repo_id
:
id
,
target_namespace
:
target_namespace
,
target_namespace
:
target_namespace
,
new_name
:
new
_n
ame
new_name
:
new
N
ame
},
{
},
{
dataType
:
'
script
'
dataType
:
'
script
'
});
});
...
...
app/helpers/namespaces_helper.rb
View file @
254c5aaa
module
NamespacesHelper
module
NamespacesHelper
def
namespaces_options
(
selected
=
:current_user
,
extra_groups
=
[],
display_path:
false
)
def
namespaces_options
(
selected
=
:current_user
,
display_path:
false
,
extra_group:
nil
)
groups
=
current_user
.
owned_groups
+
current_user
.
masters_groups
groups
=
current_user
.
owned_groups
+
current_user
.
masters_groups
groups
+=
process_extra_groups
(
extra_groups
)
if
extra_groups
.
any?
groups
<<
extra_group
if
extra_group
&&
!
Group
.
exists?
(
name:
extra_group
.
name
)
users
=
[
current_user
.
namespace
]
users
=
[
current_user
.
namespace
]
...
@@ -28,15 +28,6 @@ module NamespacesHelper
...
@@ -28,15 +28,6 @@ module NamespacesHelper
grouped_options_for_select
(
options
,
selected
)
grouped_options_for_select
(
options
,
selected
)
end
end
def
process_extra_groups
(
extra_groups
)
# Remove duplicate groups - we either keep the ones that exist for the user
# (already in groups) or ignore those that do not belong to the user.
duplicated_groups
=
extra_groups
.
map
{
|
name
|
Namespace
.
where
(
name:
name
).
pluck
(
:name
)
}
extra_groups
=
extra_groups
-
duplicated_groups
.
flatten
extra_groups
.
map
{
|
name
|
Group
.
new
(
name:
name
)
}
end
def
namespace_icon
(
namespace
,
size
=
40
)
def
namespace_icon
(
namespace
,
size
=
40
)
if
namespace
.
kind_of?
(
Group
)
if
namespace
.
kind_of?
(
Group
)
group_icon
(
namespace
)
group_icon
(
namespace
)
...
...
app/views/import/github/status.html.haml
View file @
254c5aaa
...
@@ -48,10 +48,10 @@
...
@@ -48,10 +48,10 @@
%fieldset
.row
%fieldset
.row
.input-group
.input-group
.col-xs-11.col-sm-5.project-path
.col-xs-11.col-sm-5.project-path
-
if
current_user
.
can_select_namespace?
&&
!
current_user
.
can_create_group?
-
if
current_user
.
can_select_namespace?
=
select_tag
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
]
||
:current_user
,
display_path:
true
),
{
class:
'project-path select2 js-select-namespace'
,
tabindex:
1
}
-
selected
=
params
[
:namespace_id
]
||
:current_user
-
elsif
current_user
.
can_create_group?
-
opts
=
current_user
.
can_create_group?
?
{
extra_groups:
[
repo
.
owner
.
login
]
}
:
{
display_path:
true
}
=
select_tag
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
]
||
:current_user
,
[
repo
.
owner
.
login
]
),
{
class:
'project-path select2 js-select-namespace'
,
tabindex:
1
}
=
select_tag
:namespace_id
,
namespaces_options
(
selected
,
opts
),
{
class:
'project-path select2 js-select-namespace'
,
tabindex:
1
}
-
else
-
else
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"form-control"
,
tabindex:
2
,
autofocus:
true
,
disabled:
true
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"form-control"
,
tabindex:
2
,
autofocus:
true
,
disabled:
true
...
...
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