Commit da123cbe authored by minghuan lei's avatar minghuan lei Committed by Mike Greiling

Resolve "Remove IIFEs from project_select.js"

parent c5099d46
...@@ -30,8 +30,7 @@ const projectSelect = () => { ...@@ -30,8 +30,7 @@ const projectSelect = () => {
$(select).select2({ $(select).select2({
placeholder, placeholder,
minimumInputLength: 0, minimumInputLength: 0,
query: (function(_this) { query: query => {
return function(query) {
var finalCallback, projectsCallback; var finalCallback, projectsCallback;
finalCallback = function(projects) { finalCallback = function(projects) {
var data; var data;
...@@ -40,7 +39,7 @@ const projectSelect = () => { ...@@ -40,7 +39,7 @@ const projectSelect = () => {
}; };
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) {
...@@ -53,27 +52,27 @@ const projectSelect = () => { ...@@ -53,27 +52,27 @@ const projectSelect = () => {
} else { } else {
projectsCallback = finalCallback; projectsCallback = finalCallback;
} }
if (_this.groupId) { if (this.groupId) {
return Api.groupProjects( return Api.groupProjects(
_this.groupId, this.groupId,
query.term, query.term,
{ {
with_issues_enabled: _this.withIssuesEnabled, with_issues_enabled: this.withIssuesEnabled,
with_merge_requests_enabled: _this.withMergeRequestsEnabled, with_merge_requests_enabled: this.withMergeRequestsEnabled,
with_shared: _this.withShared, with_shared: this.withShared,
include_subgroups: _this.includeProjectsInSubgroups, include_subgroups: this.includeProjectsInSubgroups,
}, },
projectsCallback, projectsCallback,
); );
} else if (_this.userId) { } else if (this.userId) {
return Api.userProjects( return Api.userProjects(
_this.userId, this.userId,
query.term, query.term,
{ {
with_issues_enabled: _this.withIssuesEnabled, with_issues_enabled: this.withIssuesEnabled,
with_merge_requests_enabled: _this.withMergeRequestsEnabled, with_merge_requests_enabled: this.withMergeRequestsEnabled,
with_shared: _this.withShared, with_shared: this.withShared,
include_subgroups: _this.includeProjectsInSubgroups, include_subgroups: this.includeProjectsInSubgroups,
}, },
projectsCallback, projectsCallback,
); );
...@@ -81,16 +80,15 @@ const projectSelect = () => { ...@@ -81,16 +80,15 @@ const projectSelect = () => {
return Api.projects( return Api.projects(
query.term, 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, membership: !this.allProjects,
}, },
projectsCallback, projectsCallback,
); );
} }
}; },
})(this),
id(project) { id(project) {
if (simpleFilter) return project.id; if (simpleFilter) return project.id;
return JSON.stringify({ return JSON.stringify({
......
---
title: Remove IIFEs from project_select.js
merge_request: 19288
author: minghuan lei
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment