summaryrefslogtreecommitdiff
path: root/app/views/shared/issuable/_sidebar_assignees.html.haml
blob: ab01094ed6e4f1581cdd5b9ff212bc64db662baa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- issuable_type = issuable_sidebar[:type]
- signed_in = !!issuable_sidebar.dig(:current_user, :id)

#js-vue-sidebar-assignees{ data: { field: "#{issuable_type}[assignee_ids]", signed_in: signed_in } }
  .title.hide-collapsed
    = _('Assignee')
    = icon('spinner spin')

.selectbox.hide-collapsed
  - if assignees.none?
    = hidden_field_tag "#{issuable_type}[assignee_ids][]", 0, id: nil
  - else
    - assignees.each do |assignee|
      = hidden_field_tag "#{issuable_type}[assignee_ids][]", assignee.id, id: nil, data: { avatar_url: assignee.avatar_url, name: assignee.name, username: assignee.username }

  - options = { toggle_class: 'js-user-search js-author-search',
    title: _('Assign to'),
    filter: true,
    dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author',
    placeholder: _('Search users'),
    data: { first_user: issuable_sidebar.dig(:current_user, :username),
      current_user: true,
      project_id: issuable_sidebar[:project_id],
      author_id: issuable_sidebar[:author_id],
      field_name: "#{issuable_type}[assignee_ids][]",
      issue_update: issuable_sidebar[:issuable_json_path],
      ability_name: issuable_type,
      null_user: true,
      display: 'static' } }

  - dropdown_options = assignees_dropdown_options(issuable_type)
  - title = dropdown_options[:title]
  - options[:toggle_class] += ' js-multiselect js-save-user-data'
  - data = { field_name: "#{issuable_type}[assignee_ids][]" }
  - data[:multi_select] = true
  - data['dropdown-title'] = title
  - data['dropdown-header'] = dropdown_options[:data][:'dropdown-header']
  - data['max-select'] = dropdown_options[:data][:'max-select'] if dropdown_options[:data][:'max-select']
  - options[:data].merge!(data)

  = dropdown_tag(title, options: options)