mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-25 12:36:27 +10:00
27 lines
731 B
CoffeeScript
27 lines
731 B
CoffeeScript
class @ProjectSelect
|
|
constructor: ->
|
|
$('.ajax-project-select').each (i, select) ->
|
|
@groupId = $(select).data('group-id')
|
|
|
|
$(select).select2
|
|
placeholder: "Search for project"
|
|
multiple: $(select).hasClass('multiselect')
|
|
minimumInputLength: 0
|
|
query: (query) =>
|
|
callback = (projects) ->
|
|
data = { results: projects }
|
|
query.callback(data)
|
|
|
|
if @groupId
|
|
Api.groupProjects @groupId, query.term, callback
|
|
else
|
|
Api.projects query.term, callback
|
|
|
|
id: (project) ->
|
|
project.web_url
|
|
|
|
text: (project) ->
|
|
project.name_with_namespace
|
|
|
|
dropdownCssClass: "ajax-project-dropdown"
|