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 ...@@ -4,6 +4,7 @@ class @ProjectSelect
@groupId = $(select).data('group-id') @groupId = $(select).data('group-id')
@includeGroups = $(select).data('include-groups') @includeGroups = $(select).data('include-groups')
@orderBy = $(select).data('order-by') || 'id' @orderBy = $(select).data('order-by') || 'id'
@selectId = $(select).data('select-id') || 'web_url'
placeholder = "Search for project" placeholder = "Search for project"
placeholder += " or group" if @includeGroups placeholder += " or group" if @includeGroups
...@@ -31,8 +32,8 @@ class @ProjectSelect ...@@ -31,8 +32,8 @@ class @ProjectSelect
else else
Api.projects query.term, @orderBy, projectsCallback Api.projects query.term, @orderBy, projectsCallback
id: (project) -> id: (project) =>
project.web_url project[@selectId]
text: (project) -> text: (project) ->
project.name_with_namespace || project.name project.name_with_namespace || project.name
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
= f.label :move_to_project_id, 'Move', class: 'control-label' = f.label :move_to_project_id, 'Move', class: 'control-label'
.col-sm-10 .col-sm-10
= project_select_tag("#{issuable.class.model_name.param_key}[move_to_project_id]", = 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) - if issuable.is_a?(MergeRequest)
%hr %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