2019-02-15 15:39:39 +05:30
|
|
|
- issuable_type = issuable_sidebar[:type]
|
|
|
|
- signed_in = !!issuable_sidebar.dig(:current_user, :id)
|
|
|
|
- can_edit_issuable = issuable_sidebar.dig(:current_user, :can_edit)
|
|
|
|
|
|
|
|
- if issuable_type == "issue"
|
|
|
|
#js-vue-sidebar-assignees{ data: { field: "#{issuable_type}[assignee_ids]", signed_in: signed_in } }
|
2017-08-17 22:00:37 +05:30
|
|
|
.title.hide-collapsed
|
2018-03-17 18:26:18 +05:30
|
|
|
= _('Assignee')
|
2017-08-17 22:00:37 +05:30
|
|
|
= icon('spinner spin')
|
|
|
|
- else
|
2019-02-15 15:39:39 +05:30
|
|
|
- assignee = assignees.first
|
|
|
|
.sidebar-collapsed-icon.sidebar-collapsed-user{ data: { toggle: "tooltip", placement: "left", container: "body", boundary: 'viewport' }, title: (issuable_sidebar.dig(:assignee, :name) || _('Assignee')) }
|
|
|
|
- if issuable_sidebar[:assignee]
|
|
|
|
= link_to_member(@project, assignee, size: 24)
|
2017-08-17 22:00:37 +05:30
|
|
|
- else
|
|
|
|
= icon('user', 'aria-hidden': 'true')
|
|
|
|
.title.hide-collapsed
|
2018-03-17 18:26:18 +05:30
|
|
|
= _('Assignee')
|
2017-08-17 22:00:37 +05:30
|
|
|
= icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
|
|
|
|
- if can_edit_issuable
|
2018-11-08 19:23:39 +05:30
|
|
|
= link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link float-right'
|
2017-09-10 17:25:29 +05:30
|
|
|
- if !signed_in
|
2018-11-08 19:23:39 +05:30
|
|
|
%a.gutter-toggle.float-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => _('Toggle sidebar') }
|
2017-09-10 17:25:29 +05:30
|
|
|
= sidebar_gutter_toggle_icon
|
2017-08-17 22:00:37 +05:30
|
|
|
.value.hide-collapsed
|
2019-02-15 15:39:39 +05:30
|
|
|
- if issuable_sidebar[:assignee]
|
|
|
|
= link_to_member(@project, assignee, size: 32, extra_class: 'bold') do
|
|
|
|
- unless issuable_sidebar[:assignee][:can_merge]
|
2018-11-08 19:23:39 +05:30
|
|
|
%span.float-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: _('Not allowed to merge') }
|
2017-08-17 22:00:37 +05:30
|
|
|
= icon('exclamation-triangle', 'aria-hidden': 'true')
|
|
|
|
%span.username
|
2019-02-15 15:39:39 +05:30
|
|
|
@#{issuable_sidebar[:assignee][:username]}
|
2017-08-17 22:00:37 +05:30
|
|
|
- else
|
|
|
|
%span.assign-yourself.no-value
|
2018-03-17 18:26:18 +05:30
|
|
|
= _('No assignee')
|
2017-08-17 22:00:37 +05:30
|
|
|
- if can_edit_issuable
|
|
|
|
\-
|
|
|
|
%a.js-assign-yourself{ href: '#' }
|
2018-03-17 18:26:18 +05:30
|
|
|
= _('assign yourself')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
.selectbox.hide-collapsed
|
2019-02-15 15:39:39 +05:30
|
|
|
- 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 }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
- 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' } }
|
2018-03-17 18:26:18 +05:30
|
|
|
- title = _('Select assignee')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
- if issuable_type == "issue"
|
2017-09-10 17:25:29 +05:30
|
|
|
- dropdown_options = issue_assignees_dropdown_options
|
|
|
|
- title = dropdown_options[:title]
|
2017-08-17 22:00:37 +05:30
|
|
|
- options[:toggle_class] += ' js-multiselect js-save-user-data'
|
2019-02-15 15:39:39 +05:30
|
|
|
- data = { field_name: "#{issuable_type}[assignee_ids][]" }
|
2017-08-17 22:00:37 +05:30
|
|
|
- data[:multi_select] = true
|
|
|
|
- data['dropdown-title'] = title
|
2017-09-10 17:25:29 +05:30
|
|
|
- data['dropdown-header'] = dropdown_options[:data][:'dropdown-header']
|
2018-11-08 19:23:39 +05:30
|
|
|
- data['max-select'] = dropdown_options[:data][:'max-select'] if dropdown_options[:data][:'max-select']
|
2017-08-17 22:00:37 +05:30
|
|
|
- options[:data].merge!(data)
|
|
|
|
|
|
|
|
= dropdown_tag(title, options: options)
|