Fixes #6413 - Drag & Drop (macros / group move) available on all tabs in detail search, but should be limited to tickets.
Approved-by: Dusan Vuckovic <dv@zammad.com>
This commit is contained in:
@@ -166,6 +166,7 @@ class App.Search extends App.Controller
|
||||
parent: @
|
||||
parentEl: elLocal
|
||||
appEl: @appEl
|
||||
dragEnabled: => @model is 'Ticket'
|
||||
batchSuccess: =>
|
||||
@search(0, true)
|
||||
)
|
||||
|
||||
@@ -248,6 +248,7 @@ class App.TicketOverviewTable extends App.Controller
|
||||
attribute =
|
||||
name: 'icon_priority'
|
||||
display: ''
|
||||
parentClass: 'table-priority-icon'
|
||||
translation: false
|
||||
width: '24px'
|
||||
displayWidth: 24
|
||||
|
||||
@@ -75,6 +75,8 @@ class App.TicketBatch extends App.Controller
|
||||
))
|
||||
|
||||
startDragItem: (event) =>
|
||||
return if @dragEnabled && !@dragEnabled()
|
||||
|
||||
event.preventDefault()
|
||||
|
||||
App.TicketOverviewCollection.fetch()
|
||||
|
||||
@@ -78,6 +78,7 @@ class App.TicketList extends App.Controller
|
||||
attribute =
|
||||
name: 'icon_priority'
|
||||
display: ''
|
||||
parentClass: 'table-priority-icon'
|
||||
translation: false
|
||||
width: '22px'
|
||||
displayWidth: 22
|
||||
|
||||
@@ -14423,6 +14423,16 @@ output {
|
||||
&:nth-child(n + 4) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// The priority icon column pushes the ticket number one cell further.
|
||||
&.table-priority-icon ~ td:nth-child(3) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&.table-priority-icon ~ td:nth-child(4) {
|
||||
display: block;
|
||||
flex-shrink: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox-replacement > .icon,
|
||||
|
||||
@@ -150,6 +150,43 @@ RSpec.describe 'Search', authenticated_as: :authenticate, searchindex: true, typ
|
||||
expect(page).to have_css('.batch-overlay-circle--top.js-batch-macro-circle')
|
||||
.and(have_css('.batch-overlay-circle--bottom.js-batch-assign-circle'))
|
||||
end
|
||||
|
||||
context 'with priority icons enabled' do
|
||||
let(:before_authenticate) { Setting.set('ui_ticket_priority_icons', true) }
|
||||
|
||||
it 'shows the ticket number in the dragged row' do
|
||||
within(:active_content, '.main .table') do
|
||||
element = page.find(:table_row, ticket_1.id).native
|
||||
click_and_hold(element)
|
||||
move_mouse_by(0, 5)
|
||||
move_mouse_by(0, 7)
|
||||
end
|
||||
|
||||
expect(page).to have_css('.batch-dragger', text: ticket_1.number)
|
||||
ensure
|
||||
release_mouse
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a row on a non-ticket tab is dragged' do
|
||||
let(:customer) { create(:customer, firstname: 'Testing') }
|
||||
let(:before_authenticate) { customer }
|
||||
|
||||
it 'does not show the batch actions' do
|
||||
find('[data-tab-content=User]').click
|
||||
|
||||
within(:active_content, '.main .table') do
|
||||
element = page.find(:table_row, customer.id).native
|
||||
click_and_hold(element)
|
||||
move_mouse_by(0, 5)
|
||||
move_mouse_by(0, 7)
|
||||
end
|
||||
|
||||
expect(page).to have_no_css('.batch-dragger', visible: :all)
|
||||
ensure
|
||||
release_mouse
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user