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
Léo-Paul Géneau
gitlab-ce
Commits
0cf7afac
Commit
0cf7afac
authored
Oct 30, 2017
by
Francisco Javier López
Committed by
Filipa Lacerda
Oct 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed project select to use it independently and not onlt as a combobutton
parent
7399eb43
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
10 deletions
+19
-10
app/assets/javascripts/project_select.js
app/assets/javascripts/project_select.js
+14
-10
changelogs/unreleased/fix-project-select-js-without-button.yml
...elogs/unreleased/fix-project-select-js-without-button.yml
+5
-0
No files found.
app/assets/javascripts/project_select.js
View file @
0cf7afac
...
@@ -2,13 +2,15 @@
...
@@ -2,13 +2,15 @@
import
Api
from
'
./api
'
;
import
Api
from
'
./api
'
;
import
ProjectSelectComboButton
from
'
./project_select_combo_button
'
;
import
ProjectSelectComboButton
from
'
./project_select_combo_button
'
;
(
function
()
{
(
function
()
{
this
.
ProjectSelect
=
(
function
()
{
this
.
ProjectSelect
=
(
function
()
{
function
ProjectSelect
()
{
function
ProjectSelect
()
{
$
(
'
.ajax-project-select
'
).
each
(
function
(
i
,
select
)
{
$
(
'
.ajax-project-select
'
).
each
(
function
(
i
,
select
)
{
var
placeholder
;
var
placeholder
;
const
simpleFilter
=
$
(
select
).
data
(
'
simple-filter
'
)
||
false
;
this
.
groupId
=
$
(
select
).
data
(
'
group-id
'
);
this
.
groupId
=
$
(
select
).
data
(
'
group-id
'
);
this
.
includeGroups
=
$
(
select
).
data
(
'
include-groups
'
);
this
.
includeGroups
=
$
(
select
).
data
(
'
include-groups
'
);
this
.
allProjects
=
$
(
select
).
data
(
'
all-projects
'
)
||
false
;
this
.
orderBy
=
$
(
select
).
data
(
'
order-by
'
)
||
'
id
'
;
this
.
orderBy
=
$
(
select
).
data
(
'
order-by
'
)
||
'
id
'
;
this
.
withIssuesEnabled
=
$
(
select
).
data
(
'
with-issues-enabled
'
);
this
.
withIssuesEnabled
=
$
(
select
).
data
(
'
with-issues-enabled
'
);
this
.
withMergeRequestsEnabled
=
$
(
select
).
data
(
'
with-merge-requests-enabled
'
);
this
.
withMergeRequestsEnabled
=
$
(
select
).
data
(
'
with-merge-requests-enabled
'
);
...
@@ -21,10 +23,10 @@ import ProjectSelectComboButton from './project_select_combo_button';
...
@@ -21,10 +23,10 @@ import ProjectSelectComboButton from './project_select_combo_button';
$
(
select
).
select2
({
$
(
select
).
select2
({
placeholder
:
placeholder
,
placeholder
:
placeholder
,
minimumInputLength
:
0
,
minimumInputLength
:
0
,
query
:
(
function
(
_this
)
{
query
:
(
function
(
_this
)
{
return
function
(
query
)
{
return
function
(
query
)
{
var
finalCallback
,
projectsCallback
;
var
finalCallback
,
projectsCallback
;
finalCallback
=
function
(
projects
)
{
finalCallback
=
function
(
projects
)
{
var
data
;
var
data
;
data
=
{
data
=
{
results
:
projects
results
:
projects
...
@@ -32,9 +34,9 @@ import ProjectSelectComboButton from './project_select_combo_button';
...
@@ -32,9 +34,9 @@ import ProjectSelectComboButton from './project_select_combo_button';
return
query
.
callback
(
data
);
return
query
.
callback
(
data
);
};
};
if
(
_this
.
includeGroups
)
{
if
(
_this
.
includeGroups
)
{
projectsCallback
=
function
(
projects
)
{
projectsCallback
=
function
(
projects
)
{
var
groupsCallback
;
var
groupsCallback
;
groupsCallback
=
function
(
groups
)
{
groupsCallback
=
function
(
groups
)
{
var
data
;
var
data
;
data
=
groups
.
concat
(
projects
);
data
=
groups
.
concat
(
projects
);
return
finalCallback
(
data
);
return
finalCallback
(
data
);
...
@@ -50,23 +52,25 @@ import ProjectSelectComboButton from './project_select_combo_button';
...
@@ -50,23 +52,25 @@ import ProjectSelectComboButton from './project_select_combo_button';
return
Api
.
projects
(
query
.
term
,
{
return
Api
.
projects
(
query
.
term
,
{
order_by
:
_this
.
orderBy
,
order_by
:
_this
.
orderBy
,
with_issues_enabled
:
_this
.
withIssuesEnabled
,
with_issues_enabled
:
_this
.
withIssuesEnabled
,
with_merge_requests_enabled
:
_this
.
withMergeRequestsEnabled
with_merge_requests_enabled
:
_this
.
withMergeRequestsEnabled
,
membership
:
!
_this
.
allProjects
,
},
projectsCallback
);
},
projectsCallback
);
}
}
};
};
})(
this
),
})(
this
),
id
:
function
(
project
)
{
id
:
function
(
project
)
{
if
(
simpleFilter
)
return
project
.
id
;
return
JSON
.
stringify
({
return
JSON
.
stringify
({
name
:
project
.
name
,
name
:
project
.
name
,
url
:
project
.
web_url
,
url
:
project
.
web_url
,
});
});
},
},
text
:
function
(
project
)
{
text
:
function
(
project
)
{
return
project
.
name_with_namespace
||
project
.
name
;
return
project
.
name_with_namespace
||
project
.
name
;
},
},
dropdownCssClass
:
"
ajax-project-dropdown
"
dropdownCssClass
:
"
ajax-project-dropdown
"
});
});
if
(
simpleFilter
)
return
select
;
return
new
ProjectSelectComboButton
(
select
);
return
new
ProjectSelectComboButton
(
select
);
});
});
}
}
...
...
changelogs/unreleased/fix-project-select-js-without-button.yml
0 → 100644
View file @
0cf7afac
---
title
:
Use project select dropdown not only as a combobutton
merge_request
:
15043
author
:
type
:
fixed
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