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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
58df72fa
Commit
58df72fa
authored
Mar 14, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible to exclude project in projects select
parent
bcd58069
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
9 deletions
+24
-9
app/assets/javascripts/project_select.js.coffee
app/assets/javascripts/project_select.js.coffee
+21
-6
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+3
-3
No files found.
app/assets/javascripts/project_select.js.coffee
View file @
58df72fa
...
...
@@ -6,6 +6,7 @@ class @ProjectSelect
@
orderBy
=
$
(
select
).
data
(
'order-by'
)
||
'id'
@
selectId
=
$
(
select
).
data
(
'select-id'
)
||
'web_url'
@
accessLevel
=
$
(
select
).
data
(
'access-level'
)
@
withoutId
=
$
(
select
).
data
(
'without-id'
)
placeholder
=
"Search for project"
placeholder
+=
" or group"
if
@
includeGroups
...
...
@@ -31,11 +32,13 @@ class @ProjectSelect
finalCallback
=
(
projects
)
->
options
.
callback
({
results
:
projects
})
@
withoutIdCallbackDecorator
(
@
accessLevelCallbackDecorator
(
@
groupsCallbackDecorator
(
finalCallback
)
)
)
groupsCallbackDecorator
:
(
callback
)
=>
return
callback
unless
@
includeGroups
...
...
@@ -52,10 +55,22 @@ class @ProjectSelect
# Requires ECMAScript >= 5
#
(
projects
)
=>
data
=
projects
.
filter
(
i
)
=>
max
=
Math
.
max
(
i
.
permissions
.
group_access
?
.
access_level
?
0
,
i
.
permissions
.
project_access
?
.
access_level
?
0
)
data
=
projects
.
filter
(
p
)
=>
max
=
Math
.
max
(
p
.
permissions
.
group_access
?
.
access_level
?
0
,
p
.
permissions
.
project_access
?
.
access_level
?
0
)
max
>=
@
accessLevel
callback
(
data
)
withoutIdCallbackDecorator
:
(
callback
)
=>
return
callback
unless
@
withoutId
##
# Requires ECMAScript >= 5
#
(
projects
)
=>
data
=
projects
.
filter
(
p
)
=>
p
.
id
!=
@
withoutId
callback
(
data
)
app/views/shared/issuable/_form.html.haml
View file @
58df72fa
...
...
@@ -72,9 +72,9 @@
.form-group
=
f
.
label
:move_to_project_id
,
'Move'
,
class:
'control-label'
.col-sm-10
=
project_select_tag
(
"
#{
issuable
.
class
.
model_name
.
param_key
}
[move_to_project_id]"
,
placeholder:
'Select project'
,
class:
'custom-form-control
'
,
data:
{
'select-id'
=>
'id'
,
'access-level'
=>
Gitlab
::
Access
::
REPORTER
})
=
project_select_tag
(
:move_to_project_id
,
placeholder:
'Select project'
,
class:
'custom-form-control'
,
data:
{
'select-id'
=>
'id
'
,
'access-level'
=>
Gitlab
::
Access
::
REPORTER
,
'without-id'
=>
issuable
.
project
.
id
})
-
if
issuable
.
is_a?
(
MergeRequest
)
%hr
...
...
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