Commit e890c45f authored by Clement Ho's avatar Clement Ho

Add multiple assignee support to sidebar

parent ec4788d0
...@@ -113,6 +113,10 @@ module Issuable ...@@ -113,6 +113,10 @@ module Issuable
def locking_enabled? def locking_enabled?
title_changed? || description_changed? title_changed? || description_changed?
end end
def assignees
[User.first, User.last]
end
end end
module ClassMethods module ClassMethods
......
...@@ -2,6 +2,7 @@ class IssuableEntity < Grape::Entity ...@@ -2,6 +2,7 @@ class IssuableEntity < Grape::Entity
expose :id expose :id
expose :iid expose :iid
expose :assignee_id expose :assignee_id
expose :assignees, using: UserEntity
expose :author_id expose :author_id
expose :description expose :description
expose :lock_version expose :lock_version
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
= page_specific_javascript_bundle_tag('common_vue') = page_specific_javascript_bundle_tag('common_vue')
= page_specific_javascript_bundle_tag('issuable') = page_specific_javascript_bundle_tag('issuable')
- puts issuable.is_a?(Issue)
%aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } %aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' }
.issuable-sidebar .issuable-sidebar
- can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project) - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
...@@ -23,35 +25,42 @@ ...@@ -23,35 +25,42 @@
= form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f| = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f|
.block.assignee .block.assignee
.sidebar-collapsed-icon.sidebar-collapsed-user{ data: { toggle: "tooltip", placement: "left", container: "body" }, title: (issuable.assignee.name if issuable.assignee) } #js-vue-sidebar-assignees
- if issuable.assignee
= link_to_member(@project, issuable.assignee, size: 24) - content_for :page_specific_javascripts do
- else = page_specific_javascript_bundle_tag('vue_sidebar_assignees')
= icon('user', 'aria-hidden': 'true') -# .sidebar-collapsed-icon.sidebar-collapsed-user{ data: { toggle: "tooltip", placement: "left", container: "body" }, title: (issuable.assignee.name if issuable.assignee) }
.title.hide-collapsed -# - if issuable.assignee
Assignee -# = link_to_member(@project, issuable.assignee, size: 24)
= icon('spinner spin', class: 'block-loading', 'aria-hidden': 'true') -# - else
- if can_edit_issuable -# = icon('user', 'aria-hidden': 'true')
= link_to 'Edit', '#', class: 'edit-link pull-right' -# .title.hide-collapsed
.value.hide-collapsed -# Assignee
- if issuable.assignee -# = icon('spinner spin', class: 'block-loading', 'aria-hidden': 'true')
= link_to_member(@project, issuable.assignee, size: 32, extra_class: 'bold') do -# - if can_edit_issuable
- if issuable.instance_of?(MergeRequest) && !issuable.can_be_merged_by?(issuable.assignee) -# = link_to 'Edit', '#', class: 'edit-link pull-right'
%span.pull-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: 'Not allowed to merge' } -# .value.hide-collapsed
= icon('exclamation-triangle', 'aria-hidden': 'true') -# - if issuable.assignee
%span.username -# = link_to_member(@project, issuable.assignee, size: 32, extra_class: 'bold') do
= issuable.assignee.to_reference -# - if issuable.instance_of?(MergeRequest) && !issuable.can_be_merged_by?(issuable.assignee)
- else -# %span.pull-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: 'Not allowed to merge' }
%span.assign-yourself.no-value -# = icon('exclamation-triangle', 'aria-hidden': 'true')
No assignee -# %span.username
- if can_edit_issuable -# = issuable.assignee.to_reference
\- -# - else
%a.js-assign-yourself{ href: '#' } -# %span.assign-yourself.no-value
assign yourself -# No assignee
-# - if can_edit_issuable
-# \-
-# %a.js-assign-yourself{ href: '#' }
-# assign yourself
.selectbox.hide-collapsed .selectbox.hide-collapsed
= f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id' = f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id'
= dropdown_tag('Select assignee', 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: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), author_id: issuable.author_id, field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_json_path(issuable), ability_name: issuable.to_ability_name, null_user: true } }) - if issuable.instance_of?(Issue)
= dropdown_tag('Select assignee(s)', 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: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), author_id: issuable.author_id, field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_json_path(issuable), ability_name: issuable.to_ability_name, null_user: true } })
- else
= dropdown_tag('Select assignee', 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: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), author_id: issuable.author_id, field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_json_path(issuable), ability_name: issuable.to_ability_name, null_user: true } })
.block.milestone .block.milestone
.sidebar-collapsed-icon .sidebar-collapsed-icon
......
...@@ -45,6 +45,7 @@ var config = { ...@@ -45,6 +45,7 @@ var config = {
u2f: ['vendor/u2f'], u2f: ['vendor/u2f'],
users: './users/users_bundle.js', users: './users/users_bundle.js',
vue_pipelines: './vue_pipelines_index/index.js', vue_pipelines: './vue_pipelines_index/index.js',
vue_sidebar_assignees: './vue_sidebar_assignees/index.js',
}, },
output: { output: {
......
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