debian-mirror-gitlab/app/assets/javascripts/ui_development_kit.js

29 lines
683 B
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2020-11-24 15:15:51 +05:30
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
2021-03-11 19:13:27 +05:30
import Api from './api';
2017-09-10 17:25:29 +05:30
2018-03-27 19:54:05 +05:30
export default () => {
2020-11-24 15:15:51 +05:30
initDeprecatedJQueryDropdown($('#js-project-dropdown'), {
2017-09-10 17:25:29 +05:30
data: (term, callback) => {
2018-12-13 13:39:08 +05:30
Api.projects(
term,
{
order_by: 'last_activity_at',
},
2021-03-08 18:12:59 +05:30
(data) => {
2018-12-13 13:39:08 +05:30
callback(data);
},
);
2017-09-10 17:25:29 +05:30
},
2021-03-08 18:12:59 +05:30
text: (project) => project.name_with_namespace || project.name,
2017-09-10 17:25:29 +05:30
selectable: true,
fieldName: 'author_id',
filterable: true,
search: {
fields: ['name_with_namespace'],
},
2021-03-08 18:12:59 +05:30
id: (data) => data.id,
isSelected: (data) => data.id === 2,
2017-09-10 17:25:29 +05:30
});
2018-03-27 19:54:05 +05:30
};