Added support of signature.
This commit is contained in:
parent
abe409ad94
commit
c3e6c4028a
3 changed files with 66 additions and 37 deletions
|
@ -22,6 +22,8 @@ class Index extends App.Controller
|
||||||
@edit_form = undefined
|
@edit_form = undefined
|
||||||
@ticket_id = params.ticket_id
|
@ticket_id = params.ticket_id
|
||||||
@article_id = params.article_id
|
@article_id = params.article_id
|
||||||
|
@signature = undefined
|
||||||
|
@signature_used = undefined
|
||||||
|
|
||||||
@key = 'ticket::' + @ticket_id
|
@key = 'ticket::' + @ticket_id
|
||||||
cache = App.Store.get( @key )
|
cache = App.Store.get( @key )
|
||||||
|
@ -53,6 +55,9 @@ class Index extends App.Controller
|
||||||
# get edit form attributes
|
# get edit form attributes
|
||||||
@edit_form = data.edit_form
|
@edit_form = data.edit_form
|
||||||
|
|
||||||
|
# get signature
|
||||||
|
@signature = data.signature
|
||||||
|
|
||||||
# load user collection
|
# load user collection
|
||||||
App.Collection.load( type: 'User', data: data.users )
|
App.Collection.load( type: 'User', data: data.users )
|
||||||
|
|
||||||
|
@ -133,6 +138,9 @@ class Index extends App.Controller
|
||||||
model: {
|
model: {
|
||||||
configure_attributes: @configure_attributes_article,
|
configure_attributes: @configure_attributes_article,
|
||||||
},
|
},
|
||||||
|
# params: {
|
||||||
|
# body: @signature.body,
|
||||||
|
# }
|
||||||
form_data: @edit_form,
|
form_data: @edit_form,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -258,6 +266,16 @@ class Index extends App.Controller
|
||||||
@el.find('[name="cc"]').parents('.control-group').removeClass('hide')
|
@el.find('[name="cc"]').parents('.control-group').removeClass('hide')
|
||||||
# @el.find('[name="subject"]').parents('.control-group').removeClass('hide')
|
# @el.find('[name="subject"]').parents('.control-group').removeClass('hide')
|
||||||
|
|
||||||
|
# add signature
|
||||||
|
if !@signature_used && @signature && @signature.body
|
||||||
|
@signature_used = true
|
||||||
|
body = @el.find('[name="body"]').val() || ''
|
||||||
|
body = body + "\n" + @signature.body
|
||||||
|
@el.find('[name="body"]').val( body )
|
||||||
|
|
||||||
|
# update textarea size
|
||||||
|
@el.find('[name="body"]').trigger('change')
|
||||||
|
|
||||||
reply: (e) =>
|
reply: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
article_id = $(e.target).parents('[data-id]').data('id')
|
article_id = $(e.target).parents('[data-id]').data('id')
|
||||||
|
@ -306,7 +324,7 @@ class Index extends App.Controller
|
||||||
selection = window.Session['UISelection'].trim()
|
selection = window.Session['UISelection'].trim()
|
||||||
selection = selection.replace /^(.*)$/mg, (match) =>
|
selection = selection.replace /^(.*)$/mg, (match) =>
|
||||||
'> ' + match
|
'> ' + match
|
||||||
body = body + selection
|
body = selection + "\n" + body
|
||||||
@el.find('[name="body"]').val(body)
|
@el.find('[name="body"]').val(body)
|
||||||
|
|
||||||
# update textarea size
|
# update textarea size
|
||||||
|
|
|
@ -87,15 +87,13 @@ class TicketsController < ApplicationController
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# GET /ticket_customer
|
# GET /ticket_customer
|
||||||
# GET /tickets_customer
|
# GET /tickets_customer
|
||||||
def ticket_customer
|
def ticket_customer
|
||||||
|
|
||||||
# get closed/open states
|
# get closed/open states
|
||||||
ticket_state_list_open = Ticket::State.where(
|
ticket_state_list_open = Ticket::State.where(
|
||||||
:ticket_state_type_id => Ticket::StateType.where(:name => ['new','open', 'pending remidner', 'pending action'])
|
:ticket_state_type_id => Ticket::StateType.where( :name => ['new','open', 'pending reminder', 'pending action'] )
|
||||||
)
|
)
|
||||||
ticket_state_list_closed = Ticket::State.where(
|
ticket_state_list_closed = Ticket::State.where(
|
||||||
:ticket_state_type_id => Ticket::StateType.where( :name => ['closed'] )
|
:ticket_state_type_id => Ticket::StateType.where( :name => ['closed'] )
|
||||||
|
@ -269,6 +267,18 @@ class TicketsController < ApplicationController
|
||||||
# log object as viewed
|
# log object as viewed
|
||||||
log_view( ticket )
|
log_view( ticket )
|
||||||
|
|
||||||
|
# get signature
|
||||||
|
signature = ticket.group.signature.attributes
|
||||||
|
|
||||||
|
# replace tags
|
||||||
|
signature['body'] = NotificationFactory.build(
|
||||||
|
:string => signature['body'],
|
||||||
|
:objects => {
|
||||||
|
:ticket => ticket,
|
||||||
|
:user => current_user,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# get related articles
|
# get related articles
|
||||||
ticket = ticket.attributes
|
ticket = ticket.attributes
|
||||||
ticket[:article_ids] = []
|
ticket[:article_ids] = []
|
||||||
|
@ -322,6 +332,7 @@ class TicketsController < ApplicationController
|
||||||
render :json => {
|
render :json => {
|
||||||
:ticket => ticket,
|
:ticket => ticket,
|
||||||
:articles => articles_used,
|
:articles => articles_used,
|
||||||
|
:signature => signature,
|
||||||
:users => users,
|
:users => users,
|
||||||
:edit_form => {
|
:edit_form => {
|
||||||
:group_id__owner_id => groups_users,
|
:group_id__owner_id => groups_users,
|
||||||
|
|
Loading…
Reference in a new issue