Commit 11f817b3 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add ability to choose id attribute in project select helper

parent 5dea8fb9
......@@ -4,6 +4,7 @@ class @ProjectSelect
@groupId = $(select).data('group-id')
@includeGroups = $(select).data('include-groups')
@orderBy = $(select).data('order-by') || 'id'
@selectId = $(select).data('select-id') || 'web_url'
placeholder = "Search for project"
placeholder += " or group" if @includeGroups
......@@ -31,8 +32,8 @@ class @ProjectSelect
else
Api.projects query.term, @orderBy, projectsCallback
id: (project) ->
project.web_url
id: (project) =>
project[@selectId]
text: (project) ->
project.name_with_namespace || project.name
......
......@@ -73,7 +73,7 @@
= 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')
placeholder: 'Select project', class: 'custom-form-control', data: { 'select-id' => 'id' })
- if issuable.is_a?(MergeRequest)
%hr
......
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