Renamed tickets.ticket_priority to tickets.priority, tickets.ticket_state to ticket.state, ticket_articles.ticket_article_sender to ticket_articles.sender and ticket_articles.ticket_article_type to ticket_articles.type.

This commit is contained in:
Martin Edenhofer 2014-06-09 00:21:36 +02:00
parent 065fbb2bba
commit 3c139a5810
20 changed files with 159 additions and 160 deletions

View file

@ -146,8 +146,8 @@ class App.Controller extends Spine.Controller
{ name: 'number', type: 'link', title: 'title', dataType: 'edit' },
{ name: 'title', type: 'link', title: 'title', dataType: 'edit' },
{ name: 'customer', class: 'user-popover', data: { id: true } },
{ name: 'ticket_state', translate: true, title: true },
{ name: 'ticket_priority', translate: true, title: true },
{ name: 'state', translate: true, title: true },
{ name: 'priority', translate: true, title: true },
{ name: 'group', title: 'group' },
{ name: 'owner', class: 'user-popover', data: { id: true } },
{ name: 'created_at', callback: @frontendTime },

View file

@ -90,13 +90,13 @@ class App.ControllerForm extends App.Controller
# colection as relation
attribute_config = {
name: 'ticket_priority_id'
name: 'priority_id'
display: 'Priority'
tag: 'select'
multiple: false
null: false
relation: 'TicketPriority'
default: defaults['ticket_priority_id']
default: defaults['priority_id']
translate: true
class: 'medium'
}
@ -104,7 +104,7 @@ class App.ControllerForm extends App.Controller
# colection as options
attribute_config = {
name: 'ticket_priority_id'
name: 'priority_id'
display: 'Priority'
tag: 'select'
multiple: false
@ -476,12 +476,12 @@ class App.ControllerForm extends App.Controller
# select shown attributes
loopData = [
{
value: 'x-zammad-ticket-ticket_priority_id'
value: 'x-zammad-ticket-priority_id'
name: 'Ticket Priority'
relation: 'TicketPriority'
},
{
value: 'x-zammad-ticket-ticket_state_id'
value: 'x-zammad-ticket-state_id'
name: 'Ticket State'
relation: 'TicketState'
},
@ -509,12 +509,12 @@ class App.ControllerForm extends App.Controller
options: { true: 'Yes', false: 'No'}
},
{
value: 'x-zammad-article-ticket_article_type_id'
value: 'x-zammad-article-type_id'
name: 'Article Type'
relation: 'TicketArticleType'
},
{
value: 'x-zammad-article-ticket_article_sender_id'
value: 'x-zammad-article-sender_id'
name: 'Article Sender'
relation: 'TicketArticleSender'
},
@ -866,9 +866,9 @@ class App.ControllerForm extends App.Controller
} )
all
}
else if key is 'tickets.ticket_state_id'
else if key is 'tickets.state_id'
attribute_config = {
name: attribute.name + '::tickets.ticket_state_id'
name: attribute.name + '::tickets.state_id'
display: 'State'
tag: 'select'
multiple: true
@ -880,9 +880,9 @@ class App.ControllerForm extends App.Controller
class: 'medium'
remove: true
}
else if key is 'tickets.ticket_priority_id'
else if key is 'tickets.priority_id'
attribute_config = {
name: attribute.name + '::tickets.ticket_priority_id'
name: attribute.name + '::tickets.priority_id'
display: 'Priority'
tag: 'select'
multiple: true
@ -1033,13 +1033,13 @@ class App.ControllerForm extends App.Controller
disable: false
},
{
value: 'tickets.ticket_state_id'
value: 'tickets.state_id'
name: 'State'
selected: false
disable: false
},
{
value: 'tickets.ticket_priority_id'
value: 'tickets.priority_id'
name: 'Priority'
selected: true
disable: false

View file

@ -23,8 +23,8 @@ class App.ControllerTable extends App.Controller
{ name: 'number', link: true }
{ name: 'title', link: true }
{ name: 'customer', class: 'user-popover', data: { id: true } }
{ name: 'ticket_state', translate: true }
{ name: 'ticket_priority', translate: true }
{ name: 'state', translate: true }
{ name: 'priority', translate: true }
{ name: 'group' },
{ name: 'owner', class: 'user-popover', data: { id: true } }
{ name: 'created_at', callback: @frontendTime }

View file

@ -145,7 +145,7 @@ class Settings extends App.ControllerModal
@configure_attributes_article = [
# { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', },
# { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
# { name: 'type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
# { name: 'internal', display: 'Visibility', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
{
name: 'per_page',
@ -174,8 +174,8 @@ class Settings extends App.ControllerModal
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'
@ -201,8 +201,8 @@ class Settings extends App.ControllerModal
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'

View file

@ -145,8 +145,8 @@ class App.TicketCreate extends App.Controller
# set defaults
defaults =
ticket_state_id: App.TicketState.findByAttribute( 'name', 'open' ).id
ticket_priority_id: App.TicketPriority.findByAttribute( 'name', '2 normal' ).id
state_id: App.TicketState.findByAttribute( 'name', 'open' ).id
priority_id: App.TicketPriority.findByAttribute( 'name', '2 normal' ).id
# generate form
configure_attributes = [
@ -156,8 +156,8 @@ class App.TicketCreate extends App.Controller
{ name: 'tags', display: 'Tags', tag: 'tag', type: 'text', null: true, default: defaults['tags'], class: 'span7', },
{ name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 200, null: false, default: defaults['subject'], class: 'span7', },
{ name: 'body', display: 'Text', tag: 'textarea', rows: 8, null: false, default: defaults['body'], class: 'span7', upload: true },
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketState', default: defaults['ticket_state_id'], translate: true, class: 'medium' },
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketPriority', default: defaults['ticket_priority_id'], translate: true, class: 'medium' },
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketState', default: defaults['state_id'], translate: true, class: 'medium' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketPriority', default: defaults['priority_id'], translate: true, class: 'medium' },
]
@html App.view('agent_ticket_create')(
head: 'New Ticket'
@ -250,8 +250,8 @@ class App.TicketCreate extends App.Controller
from: params.customer_id_autocompletion
subject: params.subject
body: params.body
ticket_article_type_id: type.id
ticket_article_sender_id: sender.id
type_id: type.id
sender_id: sender.id
form_id: @form_id
}
else
@ -260,8 +260,8 @@ class App.TicketCreate extends App.Controller
to: params.customer_id_autocompletion
subject: params.subject
body: params.body
ticket_article_type_id: type.id
ticket_article_sender_id: sender.id
type_id: type.id
sender_id: sender.id
form_id: @form_id
}

View file

@ -37,8 +37,8 @@ class App.TicketMerge extends App.ControllerModal
{ name: 'number', link: true },
{ name: 'title', link: true },
# { name: 'customer', class: 'user-popover', data: { id: true } },
{ name: 'ticket_state', translate: true },
# { name: 'ticket_priority', translate: true },
{ name: 'state', translate: true },
# { name: 'priority', translate: true },
{ name: 'group' },
# { name: 'owner', class: 'user-popover', data: { id: true } },
{ name: 'created_at', callback: @humanTime },
@ -64,8 +64,8 @@ class App.TicketMerge extends App.ControllerModal
{ name: 'number', link: true },
{ name: 'title', link: true },
# { name: 'customer', class: 'user-popover', data: { id: true } },
{ name: 'ticket_state', translate: true },
# { name: 'ticket_priority', translate: true },
{ name: 'state', translate: true },
# { name: 'priority', translate: true },
{ name: 'group' },
# { name: 'owner', class: 'user-popover', data: { id: true } },
{ name: 'created_at', callback: @humanTime },

View file

@ -57,10 +57,10 @@ class Index extends App.ControllerContent
# set defaults
defaults = template['options'] || {}
if !( 'ticket_state_id' of defaults )
defaults['ticket_state_id'] = App.TicketState.findByAttribute( 'name', 'new' )
if !( 'ticket_priority_id' of defaults )
defaults['ticket_priority_id'] = App.TicketPriority.findByAttribute( 'name', '2 normal' )
if !( 'state_id' of defaults )
defaults['state_id'] = App.TicketState.findByAttribute( 'name', 'new' )
if !( 'priority_id' of defaults )
defaults['priority_id'] = App.TicketPriority.findByAttribute( 'name', '2 normal' )
groupFilter = (collection, type) =>
@ -93,8 +93,8 @@ class Index extends App.ControllerContent
# { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, filter: @edit_form, nulloption: true, relation: 'User', default: defaults['owner_id'], class: 'span7', },
{ name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: false, default: defaults['subject'], class: 'span7', },
{ name: 'body', display: 'Text', tag: 'textarea', rows: 10, null: false, default: defaults['body'], class: 'span7', upload: true },
# { name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketState', default: defaults['ticket_state_id'], translate: true, class: 'medium' },
# { name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketPriority', default: defaults['ticket_priority_id'], translate: true, class: 'medium' },
# { name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketState', default: defaults['state_id'], translate: true, class: 'medium' },
# { name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketPriority', default: defaults['priority_id'], translate: true, class: 'medium' },
]
@html App.view('customer_ticket_create')( head: 'New Ticket' )
@ -129,11 +129,11 @@ class Index extends App.ControllerContent
# set prio
priority = App.TicketPriority.findByAttribute( 'name', '2 normal' )
params.ticket_priority_id = priority.id
params.priority_id = priority.id
# set state
state = App.TicketState.findByAttribute( 'name', 'new' )
params.ticket_state_id = state.id
params.state_id = state.id
# fillup params
if !params.title
@ -155,8 +155,8 @@ class Index extends App.ControllerContent
to: (group && group.name) || ''
subject: params.subject
body: params.body
ticket_article_type_id: type.id
ticket_article_sender_id: sender.id
type_id: type.id
sender_id: sender.id
form_id: @form_id
}

View file

@ -253,8 +253,8 @@ class Table extends App.ControllerContent
bulk_form: =>
@configure_attributes_ticket = [
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'pull-left' },
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'pull-left' },
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'pull-left' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @bulk, translate: true, nulloption: true, default: '', class: 'span2', item_class: 'pull-left' },
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @bulk, nulloption: true, class: 'span2', item_class: 'pull-left' },
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @bulk, nulloption: true, class: 'span2', item_class: 'pull-left' },
]
@ -361,7 +361,7 @@ class Settings extends App.ControllerModal
@configure_attributes_article = [
# { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', },
# { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
# { name: 'type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
# { name: 'internal', display: 'Visibility', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
{
name: 'per_page'
@ -392,8 +392,8 @@ class Settings extends App.ControllerModal
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'
@ -417,8 +417,8 @@ class Settings extends App.ControllerModal
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'
@ -453,8 +453,8 @@ class Settings extends App.ControllerModal
translate: true
options:
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
class: 'medium'

View file

@ -336,19 +336,19 @@ class Edit extends App.Controller
)
@configure_attributes_ticket = [
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @edit_form, class: 'span2', item_class: 'pull-left' },
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @edit_form, nulloption: true, class: 'span2', item_class: 'pull-left' },
]
if @isRole('Customer')
@configure_attributes_ticket = [
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @edit_form, translate: true, class: 'span2', item_class: 'pull-left' },
]
@configure_attributes_article = [
{ name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', filter: @edit_form, default: '9', translate: true, class: 'medium' },
{ name: 'type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', filter: @edit_form, default: '9', translate: true, class: 'medium' },
{ name: 'internal', display: 'Visibility', tag: 'select', null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
{ name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },
{ name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },
@ -390,7 +390,7 @@ class Edit extends App.Controller
dependency: [
{
bind: {
name: 'ticket_article_type_id'
name: 'type_id'
relation: 'TicketArticleType'
value: ['email']
},
@ -401,7 +401,7 @@ class Edit extends App.Controller
},
{
bind: {
name: 'ticket_article_type_id'
name: 'type_id'
relation: 'TicketArticleType'
value: ['note', 'twitter status', 'twitter direct-message']
},
@ -452,12 +452,12 @@ class Edit extends App.Controller
if @isRole('Customer')
sender = App.TicketArticleSender.findByAttribute( 'name', 'Customer' )
article_type = App.TicketArticleType.findByAttribute( 'name', 'web' )
params.ticket_article_type_id = article_type.id
params.ticket_article_sender_id = sender.id
params.type_id = article_type.id
params.sender_id = sender.id
else
sender = App.TicketArticleSender.findByAttribute( 'name', 'Agent' )
article_type = App.TicketArticleType.find( params['ticket_article_type_id'] )
params.ticket_article_sender_id = sender.id
article_type = App.TicketArticleType.find( params['type_id'] )
params.sender_id = sender.id
# update ticket
ticket_update = {}
@ -641,16 +641,16 @@ class ArticleView extends App.Controller
e.preventDefault()
article_id = $(e.target).parents('[data-id]').data('id')
article = App.TicketArticle.find( article_id )
article_type = App.TicketArticleType.find( article.ticket_article_type_id )
article_type = App.TicketArticleType.find( article.type_id )
customer = App.User.find( article.created_by_id )
# update form
@checkIfSignatureIsNeeded(article_type)
# preselect article type
@ui.el.find('[name="ticket_article_type_id"]').find('option:selected').removeAttr('selected')
@ui.el.find('[name="ticket_article_type_id"]').find('[value="' + article_type.id + '"]').attr('selected',true)
@ui.el.find('[name="ticket_article_type_id"]').trigger('change')
@ui.el.find('[name="type_id"]').find('option:selected').removeAttr('selected')
@ui.el.find('[name="type_id"]').find('[value="' + article_type.id + '"]').attr('selected',true)
@ui.el.find('[name="type_id"]').trigger('change')
# empty form
#@ui.el.find('[name="to"]').val('')

View file

@ -41,7 +41,7 @@ class App.WidgetLink extends App.ControllerDrox
if item['link_object'] is 'Ticket'
ticket = App.Ticket.retrieve( item['link_object_value'] )
if ticket.ticket_state.name is 'merged'
if ticket.state.name is 'merged'
ticket.css = 'merged'
list[ item['link_type'] ].push ticket

View file

@ -15,15 +15,15 @@ class App.Overview extends App.Model
name: 'view::s'
display: 'Attributes'
tag: 'checkbox'
default: ['number', 'title', 'ticket_state', 'created_at']
default: ['number', 'title', 'state', 'created_at']
null: false
translate: true
options:
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'
@ -47,8 +47,8 @@ class App.Overview extends App.Model
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'
@ -82,8 +82,8 @@ class App.Overview extends App.Model
translate: true
options:
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
class: 'span4'

View file

@ -26,8 +26,8 @@ class App.Sla extends App.Model
translate: true
options:
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
class: 'span4'

View file

@ -1,5 +1,5 @@
class App.Ticket extends App.Model
@configure 'Ticket', 'number', 'title', 'group_id', 'owner_id', 'customer_id', 'ticket_state_id', 'ticket_priority_id', 'article', 'tags', 'updated_at'
@configure 'Ticket', 'number', 'title', 'group_id', 'owner_id', 'customer_id', 'state_id', 'priority_id', 'article', 'tags', 'updated_at'
@extend Spine.Model.Ajax
@url: @apiPath + '/tickets'
@configure_attributes = [
@ -8,8 +8,8 @@ class App.Ticket extends App.Model
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, class: 'span8', relation: 'Group', style: 'width: 10%' },
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, class: 'span8', relation: 'User', style: 'width: 12%' },
{ name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8' },
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', class: 'medium', style: 'width: 12%' },
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', class: 'medium', style: 'width: 12%' },
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', class: 'medium', style: 'width: 12%' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', class: 'medium', style: 'width: 12%' },
{ name: 'created_at', display: 'Created', tag: 'time', style: 'width: 12%' },
{ name: 'last_contact', display: 'Last contact', tag: 'time', null: true, style: 'width: 12%' },
{ name: 'last_contact_agent', display: 'Last contact (Agent)', tag: 'time', null: true, style: 'width: 12%' },
@ -26,10 +26,10 @@ class App.Ticket extends App.Model
@_fillUp: (data) ->
# priority
data.ticket_priority = App.TicketPriority.find( data.ticket_priority_id )
data.priority = App.TicketPriority.find( data.priority_id )
# state
data.ticket_state = App.TicketState.find( data.ticket_state_id )
data.state = App.TicketState.find( data.state_id )
# group
data.group = App.Group.find( data.group_id )

View file

@ -1,5 +1,5 @@
class App.TicketArticle extends App.Model
@configure 'TicketArticle', 'from', 'to', 'cc', 'subject', 'body', 'ticket_id', 'ticket_article_type_id', 'ticket_article_sender_id', 'internal', 'in_reply_to', 'form_id', 'updated_at'
@configure 'TicketArticle', 'from', 'to', 'cc', 'subject', 'body', 'ticket_id', 'type_id', 'sender_id', 'internal', 'in_reply_to', 'form_id', 'updated_at'
@extend Spine.Model.Ajax
@url: @apiPath + '/ticket_articles'
@configure_attributes = [
@ -9,8 +9,8 @@ class App.TicketArticle extends App.Model
{ name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true, class: 'span8', },
{ name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: true, class: 'span8', },
{ name: 'body', display: 'Text', tag: 'textarea', rows: 5, limit: 100, null: false, class: 'span8', },
{ name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: false, relation: 'TicketArticleType', default: '', class: 'medium' },
{ name: 'ticket_article_sender_id', display: 'Sender', tag: 'select', multiple: false, null: false, relation: 'TicketArticleSender', default: '', class: 'medium' },
{ name: 'type_id', display: 'Type', tag: 'select', multiple: false, null: false, relation: 'TicketArticleType', default: '', class: 'medium' },
{ name: 'sender_id', display: 'Sender', tag: 'select', multiple: false, null: false, relation: 'TicketArticleSender', default: '', class: 'medium' },
{ name: 'internal', display: 'Visibility', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium' },
]
@ -29,12 +29,11 @@ class App.TicketArticle extends App.Model
data.updated_by = App.User.retrieve( data.updated_by_id )
# add relations
data.article_type = App.TicketArticleType.find( data.ticket_article_type_id )
data.article_sender = App.TicketArticleSender.find( data.ticket_article_sender_id )
data.type = App.TicketArticleType.find( data.type_id )
data.sender = App.TicketArticleSender.find( data.sender_id )
data
displayName: ->
if @subject
return @subject

View file

@ -17,7 +17,7 @@
<h3><a href="#" data-type="edit"><%= ticket.title %></a> <small><%= ticket.number %> <span class="humanTimeFromNow" data-time="<%= ticket.created_at %>">?</span></small></h3>
<div class="row">
<div class="span2">
<b><%- @T( 'State' ) %></b> <%- @T( ticket.ticket_state.name ) %>
<b><%- @T( 'State' ) %></b> <%- @T( ticket.state.name ) %>
</div>
<div class="span2">
<b><%- @T( 'Group' ) %></b> <%= ticket.group.name %>
@ -28,7 +28,7 @@
</div>
<div class="row">
<div class="span2">
<b><%- @T( 'Priority' ) %></b> <%- @T( ticket.ticket_priority.name ) %>
<b><%- @T( 'Priority' ) %></b> <%- @T( ticket.priority.name ) %>
</div>
<div class="span2">
<b><%- @T( 'Owner' ) %></b> <%= ticket.owner.displayName() %>

View file

@ -5,10 +5,10 @@
</tr>
<tr>
<td><%- @P( @ticket.group ) %></td>
<td><%- @T( @ticket.ticket_state.name ) %></td>
<td><%- @T( @ticket.state.name ) %></td>
</tr>
<tr>
<td><%- @T( @ticket.ticket_priority.name ) %></td>
<td><%- @T( @ticket.priority.name ) %></td>
<td></td>
</tr>
<tr>

View file

@ -3,10 +3,10 @@
<td><%- @T('Group') %></td><td><%= @ticket.group.name %></td>
</tr>
<tr>
<td><%- @T('State') %></td><td><%- @T( @ticket.ticket_state.name ) %></td>
<td><%- @T('State') %></td><td><%- @T( @ticket.state.name ) %></td>
</tr>
<tr>
<td><%- @T('Priority') %></td><td><%- @T( @ticket.ticket_priority.name ) %></td>
<td><%- @T('Priority') %></td><td><%- @T( @ticket.priority.name ) %></td>
</tr>
<tr>
<td><%- @T('Age') %></td><td><span class="humanTimeFromNow" data-time="<%- @ticket.created_at %>">?</span></td>

View file

@ -39,7 +39,7 @@ class AgentTicketActionLevel1Test < TestCase
# update ticket
{
:execute => 'select',
:css => '.active select[name="ticket_article_type_id"]',
:css => '.active select[name="type_id"]',
:value => 'note',
},
{
@ -94,7 +94,7 @@ class AgentTicketActionLevel1Test < TestCase
# update ticket
{
:execute => 'select',
:css => '.content_permanent.active select[name="ticket_article_type_id"]',
:css => '.content_permanent.active select[name="type_id"]',
:value => 'note',
},
{

View file

@ -197,7 +197,7 @@ class AgentTicketActionsLevel2Test < TestCase
{
:where => :instance1,
:execute => 'select',
:css => '.active .ticket-answer select[name="ticket_article_type_id"]',
:css => '.active .ticket-answer select[name="type_id"]',
:value => 'note',
},
{