Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
787553ea42
9 changed files with 109 additions and 72 deletions
|
@ -31,7 +31,7 @@ class App.TicketCreate extends App.Controller
|
||||||
|
|
||||||
@fetch(params)
|
@fetch(params)
|
||||||
|
|
||||||
# lisen if view need to be rerendert
|
# lisen if view need to be rerendered
|
||||||
@bind 'ticket_create_rerender', (defaults) =>
|
@bind 'ticket_create_rerender', (defaults) =>
|
||||||
@log 'notice', 'error', defaults
|
@log 'notice', 'error', defaults
|
||||||
@render(defaults)
|
@render(defaults)
|
||||||
|
@ -41,6 +41,10 @@ class App.TicketCreate extends App.Controller
|
||||||
return if !@authenticate(true)
|
return if !@authenticate(true)
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
|
# bind on new ticket_create_attributes updates
|
||||||
|
@bind 'ticket_create_attributes', (data) =>
|
||||||
|
App.SessionStorage.set('ticket_create_attributes', data)
|
||||||
|
|
||||||
changeFormType: (e) =>
|
changeFormType: (e) =>
|
||||||
type = $(e.target).data('type')
|
type = $(e.target).data('type')
|
||||||
if !type
|
if !type
|
||||||
|
|
|
@ -278,13 +278,12 @@ class Table extends App.Controller
|
||||||
)
|
)
|
||||||
table = $(table)
|
table = $(table)
|
||||||
table.delegate('[name="bulk_all"]', 'click', (e) ->
|
table.delegate('[name="bulk_all"]', 'click', (e) ->
|
||||||
console.log('OOOO', $(e.target).attr('checked') )
|
|
||||||
if $(e.target).attr('checked')
|
if $(e.target).attr('checked')
|
||||||
$(e.target).closest('table').find('[name="bulk"]').attr('checked', true)
|
$(e.target).closest('table').find('[name="bulk"]').attr('checked', true)
|
||||||
else
|
else
|
||||||
$(e.target).closest('table').find('[name="bulk"]').attr('checked', false)
|
$(e.target).closest('table').find('[name="bulk"]').attr('checked', false)
|
||||||
)
|
)
|
||||||
@el.find('.table-overview').append(table)
|
@$('.table-overview').append(table)
|
||||||
else
|
else
|
||||||
openTicket = (id,e) =>
|
openTicket = (id,e) =>
|
||||||
|
|
||||||
|
@ -316,7 +315,7 @@ class Table extends App.Controller
|
||||||
id: refObject.id
|
id: refObject.id
|
||||||
value
|
value
|
||||||
callbackCheckbox = (id, checked, e) =>
|
callbackCheckbox = (id, checked, e) =>
|
||||||
if @el.find('table').find('input[name="bulk"]:checked').length == 0
|
if @$('table').find('input[name="bulk"]:checked').length == 0
|
||||||
@bulkForm.hide()
|
@bulkForm.hide()
|
||||||
else
|
else
|
||||||
@bulkForm.show()
|
@bulkForm.show()
|
||||||
|
@ -385,43 +384,38 @@ class Table extends App.Controller
|
||||||
|
|
||||||
@bulkForm = new BulkForm
|
@bulkForm = new BulkForm
|
||||||
holder: @el
|
holder: @el
|
||||||
|
view: @view
|
||||||
|
|
||||||
# start bulk action observ
|
# start bulk action observ
|
||||||
@el.append( @bulkForm.el )
|
@el.append( @bulkForm.el )
|
||||||
if @el.find('.table-overview').find('input[name="bulk"]:checked').length isnt 0
|
if @$('.table-overview').find('input[name="bulk"]:checked').length isnt 0
|
||||||
@bulkForm.show()
|
@bulkForm.show()
|
||||||
|
|
||||||
# show/hide bulk action
|
# show/hide bulk action
|
||||||
@el.find('.table-overview').delegate('input[name="bulk"], input[name="bulk_all"]', 'click', (e) =>
|
@$('.table-overview').delegate('input[name="bulk"], input[name="bulk_all"]', 'click', (e) =>
|
||||||
console.log('YES')
|
if @$('.table-overview').find('input[name="bulk"]:checked').length == 0
|
||||||
if @el.find('.table-overview').find('input[name="bulk"]:checked').length == 0
|
|
||||||
|
|
||||||
# hide
|
|
||||||
@bulkForm.hide()
|
@bulkForm.hide()
|
||||||
|
|
||||||
@bulkForm.reset()
|
@bulkForm.reset()
|
||||||
else
|
else
|
||||||
|
|
||||||
# show
|
|
||||||
@bulkForm.show()
|
@bulkForm.show()
|
||||||
)
|
)
|
||||||
|
|
||||||
# deselect bulk_all if one item is uncheck observ
|
# deselect bulk_all if one item is uncheck observ
|
||||||
@el.find('.table-overview').delegate('[name="bulk"]', 'click', (e) ->
|
@$('.table-overview').delegate('[name="bulk"]', 'click', (e) ->
|
||||||
if !$(e.target).attr('checked')
|
if !$(e.target).attr('checked')
|
||||||
$(e.target).parents().find('[name="bulk_all"]').attr('checked', false)
|
$(e.target).parents().find('[name="bulk_all"]').attr('checked', false)
|
||||||
)
|
)
|
||||||
|
|
||||||
getSelected: ->
|
getSelected: ->
|
||||||
@ticketIDs = []
|
@ticketIDs = []
|
||||||
@el.find('.table-overview').find('[name="bulk"]:checked').each( (index, element) =>
|
@$('.table-overview').find('[name="bulk"]:checked').each( (index, element) =>
|
||||||
ticket_id = $(element).val()
|
ticket_id = $(element).val()
|
||||||
@ticketIDs.push ticket_id
|
@ticketIDs.push ticket_id
|
||||||
)
|
)
|
||||||
@ticketIDs
|
@ticketIDs
|
||||||
|
|
||||||
setSelected: (ticketIDs) ->
|
setSelected: (ticketIDs) ->
|
||||||
@el.find('.table-overview').find('[name="bulk"]').each( (index, element) ->
|
@$('.table-overview').find('[name="bulk"]').each( (index, element) ->
|
||||||
ticket_id = $(element).val()
|
ticket_id = $(element).val()
|
||||||
for ticket_id_selected in ticketIDs
|
for ticket_id_selected in ticketIDs
|
||||||
if ticket_id_selected is ticket_id
|
if ticket_id_selected is ticket_id
|
||||||
|
@ -448,6 +442,7 @@ class BulkForm extends App.Controller
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'submit form': 'submit'
|
'submit form': 'submit'
|
||||||
|
'click .js-submit': 'submit'
|
||||||
'click .js-confirm': 'confirm'
|
'click .js-confirm': 'confirm'
|
||||||
'click .js-cancel': 'reset'
|
'click .js-cancel': 'reset'
|
||||||
|
|
||||||
|
@ -472,7 +467,7 @@ class BulkForm extends App.Controller
|
||||||
@html App.view('agent_ticket_view/bulk')()
|
@html App.view('agent_ticket_view/bulk')()
|
||||||
|
|
||||||
new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
el: @el.find('#form-ticket-bulk')
|
el: @$('#form-ticket-bulk')
|
||||||
model:
|
model:
|
||||||
configure_attributes: @configure_attributes_ticket
|
configure_attributes: @configure_attributes_ticket
|
||||||
className: 'create'
|
className: 'create'
|
||||||
|
@ -482,7 +477,7 @@ class BulkForm extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
el: @el.find('#form-ticket-bulk-comment')
|
el: @$('#form-ticket-bulk-comment')
|
||||||
model:
|
model:
|
||||||
configure_attributes: [{ name: 'body', display: 'Comment', tag: 'textarea', rows: 4, null: true, upload: false, item_class: 'flex' }]
|
configure_attributes: [{ name: 'body', display: 'Comment', tag: 'textarea', rows: 4, null: true, upload: false, item_class: 'flex' }]
|
||||||
className: 'create'
|
className: 'create'
|
||||||
|
@ -497,7 +492,7 @@ class BulkForm extends App.Controller
|
||||||
]
|
]
|
||||||
|
|
||||||
new App.ControllerForm(
|
new App.ControllerForm(
|
||||||
el: @el.find('#form-ticket-bulk-typeVisibility')
|
el: @$('#form-ticket-bulk-typeVisibility')
|
||||||
model:
|
model:
|
||||||
configure_attributes: @confirm_attributes
|
configure_attributes: @confirm_attributes
|
||||||
className: 'create'
|
className: 'create'
|
||||||
|
@ -554,9 +549,9 @@ class BulkForm extends App.Controller
|
||||||
submit: (e) =>
|
submit: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
@bulk_count = @el.find('.table-overview').find('[name="bulk"]:checked').length
|
@bulk_count = @holder.find('.table-overview').find('[name="bulk"]:checked').length
|
||||||
@bulk_count_index = 0
|
@bulk_count_index = 0
|
||||||
@el.find('.table-overview').find('[name="bulk"]:checked').each( (index, element) =>
|
@holder.find('.table-overview').find('[name="bulk"]:checked').each( (index, element) =>
|
||||||
@log 'notice', '@bulk_count_index', @bulk_count, @bulk_count_index
|
@log 'notice', '@bulk_count_index', @bulk_count, @bulk_count_index
|
||||||
ticket_id = $(element).val()
|
ticket_id = $(element).val()
|
||||||
ticket = App.Ticket.find(ticket_id)
|
ticket = App.Ticket.find(ticket_id)
|
||||||
|
@ -568,8 +563,6 @@ class BulkForm extends App.Controller
|
||||||
if params[item] != ''
|
if params[item] != ''
|
||||||
ticket_update[item] = params[item]
|
ticket_update[item] = params[item]
|
||||||
|
|
||||||
# @log 'notice', 'update', params, ticket_update, ticket
|
|
||||||
|
|
||||||
# validate article
|
# validate article
|
||||||
if params['body']
|
if params['body']
|
||||||
article = new App.TicketArticle
|
article = new App.TicketArticle
|
||||||
|
@ -606,13 +599,14 @@ class BulkForm extends App.Controller
|
||||||
|
|
||||||
# refresh view after all tickets are proceeded
|
# refresh view after all tickets are proceeded
|
||||||
if @bulk_count_index == @bulk_count
|
if @bulk_count_index == @bulk_count
|
||||||
|
@hide()
|
||||||
|
|
||||||
# fetch overview data again
|
# fetch overview data again
|
||||||
App.OverviewIndexCollection.fetch()
|
App.OverviewIndexCollection.fetch()
|
||||||
App.OverviewCollection.fetch(@view)
|
App.OverviewCollection.fetch(@view)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@el.find('.table-overview').find('[name="bulk"]:checked').prop('checked', false)
|
@holder.find('.table-overview').find('[name="bulk"]:checked').prop('checked', false)
|
||||||
App.Event.trigger 'notify', {
|
App.Event.trigger 'notify', {
|
||||||
type: 'success'
|
type: 'success'
|
||||||
msg: App.i18n.translateContent('Bulk-Action executed!')
|
msg: App.i18n.translateContent('Bulk-Action executed!')
|
||||||
|
|
|
@ -329,10 +329,12 @@ class App.TicketZoom extends App.Controller
|
||||||
|
|
||||||
new App.TicketZoomArticleNew(
|
new App.TicketZoomArticleNew(
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
|
ticket_id: @ticket.id
|
||||||
el: @$('.article-new')
|
el: @$('.article-new')
|
||||||
form_meta: @form_meta
|
form_meta: @form_meta
|
||||||
form_id: @form_id
|
form_id: @form_id
|
||||||
defaults: @taskGet('article')
|
defaults: @taskGet('article')
|
||||||
|
task_key: @task_key
|
||||||
ui: @
|
ui: @
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
@bind(
|
@bind(
|
||||||
'ui::ticket::setArticleType'
|
'ui::ticket::setArticleType'
|
||||||
(data) =>
|
(data) =>
|
||||||
return if data.ticket.id isnt @ticket.id
|
return if data.ticket.id isnt @ticket_id
|
||||||
#@setArticleType(data.type.name)
|
#@setArticleType(data.type.name)
|
||||||
|
|
||||||
@openTextarea(null, true)
|
@openTextarea(null, true)
|
||||||
|
@ -113,7 +113,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
@bind(
|
@bind(
|
||||||
'ui::ticket::taskReset'
|
'ui::ticket::taskReset'
|
||||||
(data) =>
|
(data) =>
|
||||||
return if data.ticket_id isnt @ticket.id
|
return if data.ticket_id isnt @ticket_id
|
||||||
@type = 'note'
|
@type = 'note'
|
||||||
@defaults = {}
|
@defaults = {}
|
||||||
@render()
|
@render()
|
||||||
|
@ -131,7 +131,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
|
|
||||||
ticket = App.Ticket.fullLocal( @ticket.id )
|
ticket = App.Ticket.fullLocal( @ticket_id )
|
||||||
|
|
||||||
@html App.view('ticket_zoom/article_new')(
|
@html App.view('ticket_zoom/article_new')(
|
||||||
ticket: ticket
|
ticket: ticket
|
||||||
|
@ -343,15 +343,30 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
for name in articleType.attributes
|
for name in articleType.attributes
|
||||||
@$("[name=#{name}]").closest('.form-group').removeClass('hide')
|
@$("[name=#{name}]").closest('.form-group').removeClass('hide')
|
||||||
|
|
||||||
# check if signature need to be added
|
# detect current signature (use current group_id, if not set, use ticket.group_id)
|
||||||
body = @$('[data-name=body]').html() || ''
|
ticketCurrent = App.Ticket.find(@ticket_id)
|
||||||
|
group_id = ticketCurrent.group_id
|
||||||
|
task = App.TaskManager.get(@task_key)
|
||||||
|
if task && task.state && task.state.ticket && task.state.ticket.group_id
|
||||||
|
group_id = task.state.ticket.group_id
|
||||||
|
group = App.Group.find(group_id)
|
||||||
signature = undefined
|
signature = undefined
|
||||||
if @ticket.group.signature_id
|
if group && group.signature_id
|
||||||
signature = App.Signature.find( @ticket.group.signature_id )
|
signature = App.Signature.find(group.signature_id)
|
||||||
|
|
||||||
|
# add/replace signature
|
||||||
if signature && signature.body && @type is 'email'
|
if signature && signature.body && @type is 'email'
|
||||||
|
|
||||||
|
# if signature has changed, remove it
|
||||||
|
signature_id = @$('[data-signature=true]').data('signature-id')
|
||||||
|
if signature_id && signature_id.toString() isnt signature.id.toString()
|
||||||
|
@$('[data-name=body] [data-signature="true"]').remove()
|
||||||
|
|
||||||
|
# apply new signature
|
||||||
signatureFinished = App.Utils.text2html(
|
signatureFinished = App.Utils.text2html(
|
||||||
App.Utils.replaceTags( signature.body, { user: App.Session.get(), ticket: @ticket } )
|
App.Utils.replaceTags( signature.body, { user: App.Session.get(), ticket: ticketCurrent } )
|
||||||
)
|
)
|
||||||
|
body = @$('[data-name=body]').html() || ''
|
||||||
if App.Utils.signatureCheck(body, signatureFinished)
|
if App.Utils.signatureCheck(body, signatureFinished)
|
||||||
if !App.Utils.lastLineEmpty(body)
|
if !App.Utils.lastLineEmpty(body)
|
||||||
body = body + '<br>'
|
body = body + '<br>'
|
||||||
|
@ -360,7 +375,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
|
|
||||||
# remove old signature
|
# remove old signature
|
||||||
else
|
else
|
||||||
@$('[data-name=body]').find('[data-signature=true]').remove()
|
@$('[data-name=body] [data-signature=true]').remove()
|
||||||
|
|
||||||
detectEmptyTextarea: =>
|
detectEmptyTextarea: =>
|
||||||
if !@textarea.text().trim()
|
if !@textarea.text().trim()
|
||||||
|
|
12
db/migrate/20151115000003_update_history.rb
Normal file
12
db/migrate/20151115000003_update_history.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
class UpdateHistory < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
remove_index :histories, [:value_from]
|
||||||
|
remove_index :histories, [:value_to]
|
||||||
|
change_table(:histories) do |t|
|
||||||
|
t.change :value_from, :text, limit: 500, null: true
|
||||||
|
t.change :value_to, :text, limit: 500, null: true
|
||||||
|
end
|
||||||
|
add_index :histories, [:value_from], length: 255
|
||||||
|
add_index :histories, [:value_to], length: 255
|
||||||
|
end
|
||||||
|
end
|
|
@ -53,14 +53,14 @@ class Sessions::Backend::TicketCreate
|
||||||
|
|
||||||
if !@client
|
if !@client
|
||||||
return {
|
return {
|
||||||
collection: 'ticket_create_attributes',
|
event: 'ticket_create_attributes',
|
||||||
data: data,
|
data: data,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@client.log "push ticket_create for user #{@user.id}"
|
@client.log "push ticket_create for user #{@user.id}"
|
||||||
@client.send(
|
@client.send(
|
||||||
collection: 'ticket_create_attributes',
|
event: 'ticket_create_attributes',
|
||||||
data: data,
|
data: data,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -258,25 +258,30 @@ class AgentTicketActionLevel5Test < TestCase
|
||||||
no_quote: true,
|
no_quote: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
=begin
|
|
||||||
# update group2
|
# update group2
|
||||||
select(
|
select(
|
||||||
:css => '.active [name="group_id"]',
|
css: '.active [name="group_id"]',
|
||||||
:value => group_name2,
|
value: group_name2,
|
||||||
|
)
|
||||||
|
|
||||||
|
# execute reply
|
||||||
|
click_catcher_remove
|
||||||
|
sleep 5 # time to recognice form changes
|
||||||
|
click(
|
||||||
|
css: '.active [data-type="reply"]',
|
||||||
)
|
)
|
||||||
|
|
||||||
# check if signature exists
|
# check if signature exists
|
||||||
match_not(
|
match_not(
|
||||||
:css => '.active [data-name="body"]',
|
css: '.active [data-name="body"]',
|
||||||
:value => signature_body1,
|
value: signature_body1,
|
||||||
:no_quote => true,
|
no_quote: true,
|
||||||
)
|
)
|
||||||
match(
|
match(
|
||||||
:css => '.active [data-name="body"]',
|
css: '.active [data-name="body"]',
|
||||||
:value => signature_body2,
|
value: signature_body2,
|
||||||
:no_quote => true,
|
no_quote: true,
|
||||||
)
|
)
|
||||||
=end
|
|
||||||
|
|
||||||
# discard changes
|
# discard changes
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -807,6 +807,20 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
=begin
|
||||||
|
|
||||||
|
click_catcher_remove(
|
||||||
|
:browser => browser1,
|
||||||
|
)
|
||||||
|
|
||||||
|
=end
|
||||||
|
|
||||||
|
def click_catcher_remove(params = {})
|
||||||
|
instance = params[:browser] || @browser
|
||||||
|
return if !instance.find_elements( { css: '.clickCatcher' } )[0]
|
||||||
|
click( browser: instance, css: '.clickCatcher')
|
||||||
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
watch_for(
|
watch_for(
|
||||||
|
@ -1276,7 +1290,6 @@ wait untill text in selector disabppears
|
||||||
|
|
||||||
# it's not working stable via selenium, use js
|
# it's not working stable via selenium, use js
|
||||||
value = instance.find_elements( { css: '.content.active div[data-name=body]' } )[0].text
|
value = instance.find_elements( { css: '.content.active div[data-name=body]' } )[0].text
|
||||||
puts "V #{value.inspect}"
|
|
||||||
if value != data[:body]
|
if value != data[:body]
|
||||||
body_quoted = quote( data[:body] )
|
body_quoted = quote( data[:body] )
|
||||||
instance.execute_script( "$('.content.active div[data-name=body]').html('#{body_quoted}').trigger('focusout')" )
|
instance.execute_script( "$('.content.active div[data-name=body]').html('#{body_quoted}').trigger('focusout')" )
|
||||||
|
@ -1284,9 +1297,7 @@ wait untill text in selector disabppears
|
||||||
|
|
||||||
# click on click catcher
|
# click on click catcher
|
||||||
if params[:do_not_submit]
|
if params[:do_not_submit]
|
||||||
if instance.find_elements( { css: '.clickCatcher' } )[0]
|
click_catcher_remove(browser: instance)
|
||||||
click( browser: instance, css: '.clickCatcher')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,6 @@ class ChatTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
chat_topic = Chat::Topic.create(
|
|
||||||
chat_id: chat.id,
|
|
||||||
name: 'default',
|
|
||||||
updated_by_id: 1,
|
|
||||||
created_by_id: 1,
|
|
||||||
)
|
|
||||||
|
|
||||||
# check if feature is disabled
|
# check if feature is disabled
|
||||||
assert_equal('chat_disabled', chat.customer_state[:state])
|
assert_equal('chat_disabled', chat.customer_state[:state])
|
||||||
|
|
Loading…
Reference in a new issue