Just show related article types for reply.

This commit is contained in:
Martin Edenhofer 2016-01-14 11:19:54 +01:00
parent 92c0cb9da8
commit 9415ad3a92

View file

@ -28,49 +28,71 @@ class App.TicketZoomArticleNew extends App.Controller
constructor: -> constructor: ->
super super
# set possble article types
possibleArticleType =
note: true
phone: true
if @ticket && @ticket.create_article_type_id
articleTypeCreate = App.TicketArticleType.find(@ticket.create_article_type_id).name
if articleTypeCreate is 'twitter status'
possibleArticleType['twitter status'] = true
else if articleTypeCreate is 'twitter direct-message'
possibleArticleType['twitter direct-message'] = true
else if articleTypeCreate is 'email'
possibleArticleType['email'] = true
if @ticket && @ticket.customer_id
customer = App.User.find(@ticket.customer_id)
if customer.email
possibleArticleType['email'] = true
# gets referenced in @setArticleType # gets referenced in @setArticleType
@type = @defaults['type'] || 'note' @type = @defaults['type'] || 'note'
@articleTypes = [ @articleTypes = []
{ if possibleArticleType.note
@articleTypes.push {
name: 'note' name: 'note'
icon: 'note' icon: 'note'
attributes: [] attributes: []
features: ['attachment'] features: ['attachment']
}, }
{ if possibleArticleType.email
@articleTypes.push {
name: 'email' name: 'email'
icon: 'email' icon: 'email'
attributes: ['to', 'cc'] attributes: ['to', 'cc']
features: ['attachment'] features: ['attachment']
}, }
{ if possibleArticleType.facebook
@articleTypes.push {
name: 'facebook' name: 'facebook'
icon: 'facebook' icon: 'facebook'
attributes: [] attributes: []
}, }
{ if possibleArticleType['twitter status']
@articleTypes.push {
name: 'twitter status' name: 'twitter status'
icon: 'twitter' icon: 'twitter'
attributes: [] attributes: []
features: ['body:limit'] features: ['body:limit']
maxTextLength: 140 maxTextLength: 140
warningTextLength: 30 warningTextLength: 30
}, }
{ if possibleArticleType['twitter direct-message']
@articleTypes.push {
name: 'twitter direct-message' name: 'twitter direct-message'
icon: 'twitter' icon: 'twitter'
attributes: ['to'] attributes: ['to']
features: ['body:limit'] features: ['body:limit']
maxTextLength: 10000 maxTextLength: 10000
warningTextLength: 500 warningTextLength: 500
}, }
{ if possibleArticleType.phone
@articleTypes.push {
name: 'phone' name: 'phone'
icon: 'phone' icon: 'phone'
attributes: [] attributes: []
features: ['attachment'] features: ['attachment']
}, }
]
if @isRole('Customer') if @isRole('Customer')
@type = 'note' @type = 'note'
@ -249,8 +271,8 @@ class App.TicketZoomArticleNew extends App.Controller
params.sender_id = sender.id params.sender_id = sender.id
else else
sender = App.TicketArticleSender.findByAttribute('name', 'Agent') sender = App.TicketArticleSender.findByAttribute('name', 'Agent')
params.sender_id = sender.id
type = App.TicketArticleType.findByAttribute('name', params['type']) type = App.TicketArticleType.findByAttribute('name', params['type'])
params.sender_id = sender.id
params.type_id = type.id params.type_id = type.id
if params.type is 'twitter status' if params.type is 'twitter status'