Pass in just assignees instead of issuable

This commit is contained in:
Heinrich Lee Yu 2018-11-30 10:33:02 +08:00 committed by Heinrich Lee Yu
parent 9f9765485e
commit ddb1d326e0
5 changed files with 16 additions and 7 deletions

View file

@ -88,4 +88,6 @@
%section.issuable-discussion %section.issuable-discussion
= render 'projects/issues/discussion' = render 'projects/issues/discussion'
= render 'shared/issuable/sidebar', issuable: @issue, issuable_sidebar: @issuable_sidebar -# `assignees` is required for populating selected assignee values in the select box
This is should be removed when sidebar is converted to Vue.
= render 'shared/issuable/sidebar', issuable_sidebar: @issuable_sidebar, assignees: @issue.assignees

View file

@ -6,6 +6,10 @@
.merge-request-details.issuable-details .merge-request-details.issuable-details
= render "projects/merge_requests/mr_box" = render "projects/merge_requests/mr_box"
-# `assignees` is required for populating selected assignee values in the select box and rendering the assignee link
This is should be removed when sidebar is converted to Vue.
= render 'shared/issuable/sidebar', issuable_sidebar: @issuable_sidebar, assignees: @merge_request.assignees
= render 'shared/issuable/sidebar', issuable: @merge_request, issuable_sidebar: @issuable_sidebar = render 'shared/issuable/sidebar', issuable: @merge_request, issuable_sidebar: @issuable_sidebar
#conflicts{ "v-cloak" => "true", data: { conflicts_path: conflicts_project_merge_request_path(@merge_request.project, @merge_request, format: :json), #conflicts{ "v-cloak" => "true", data: { conflicts_path: conflicts_project_merge_request_path(@merge_request.project, @merge_request, format: :json),

View file

@ -86,7 +86,9 @@
.mr-loading-status .mr-loading-status
= spinner = spinner
= render 'shared/issuable/sidebar', issuable: @merge_request, issuable_sidebar: @issuable_sidebar -# `assignees` is required for populating selected assignee values in the select box and rendering the assignee link
This is should be removed when sidebar is converted to Vue.
= render 'shared/issuable/sidebar', issuable_sidebar: @issuable_sidebar, assignees: @merge_request.assignees
- if @merge_request.can_be_reverted?(current_user) - if @merge_request.can_be_reverted?(current_user)
= render "projects/commit/change", type: 'revert', commit: @merge_request.merge_commit, title: @merge_request.title = render "projects/commit/change", type: 'revert', commit: @merge_request.merge_commit, title: @merge_request.title

View file

@ -18,7 +18,7 @@
.block.todo.hide-expanded .block.todo.hide-expanded
= render "shared/issuable/sidebar_todo", issuable_sidebar: issuable_sidebar, is_collapsed: true = render "shared/issuable/sidebar_todo", issuable_sidebar: issuable_sidebar, is_collapsed: true
.block.assignee.qa-assignee-block .block.assignee.qa-assignee-block
= render "shared/issuable/sidebar_assignees", issuable: issuable, issuable_sidebar: issuable_sidebar = render "shared/issuable/sidebar_assignees", issuable_sidebar: issuable_sidebar, assignees: assignees
= render_if_exists 'shared/issuable/sidebar_item_epic', issuable_sidebar: issuable_sidebar = render_if_exists 'shared/issuable/sidebar_item_epic', issuable_sidebar: issuable_sidebar

View file

@ -8,9 +8,10 @@
= _('Assignee') = _('Assignee')
= icon('spinner spin') = icon('spinner spin')
- else - else
- 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')) } .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] - if issuable_sidebar[:assignee]
= link_to_member(@project, issuable.assignee, size: 24) = link_to_member(@project, assignee, size: 24)
- else - else
= icon('user', 'aria-hidden': 'true') = icon('user', 'aria-hidden': 'true')
.title.hide-collapsed .title.hide-collapsed
@ -23,7 +24,7 @@
= sidebar_gutter_toggle_icon = sidebar_gutter_toggle_icon
.value.hide-collapsed .value.hide-collapsed
- if issuable_sidebar[:assignee] - if issuable_sidebar[:assignee]
= link_to_member(@project, issuable.assignee, size: 32, extra_class: 'bold') do = link_to_member(@project, assignee, size: 32, extra_class: 'bold') do
- if issuable_sidebar[:can_merge] - if issuable_sidebar[:can_merge]
%span.float-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: _('Not allowed to merge') } %span.float-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: _('Not allowed to merge') }
= icon('exclamation-triangle', 'aria-hidden': 'true') = icon('exclamation-triangle', 'aria-hidden': 'true')
@ -38,10 +39,10 @@
= _('assign yourself') = _('assign yourself')
.selectbox.hide-collapsed .selectbox.hide-collapsed
- if issuable.assignees.none? - if assignees.none?
= hidden_field_tag "#{issuable_type}[assignee_ids][]", 0, id: nil = hidden_field_tag "#{issuable_type}[assignee_ids][]", 0, id: nil
- else - else
- issuable.assignees.each do |assignee| - 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 } = 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', - options = { toggle_class: 'js-user-search js-author-search',