Streamline of attribute selection for overviews.
This commit is contained in:
parent
a83d0bc819
commit
da2ce8e1b4
4 changed files with 72 additions and 118 deletions
|
@ -0,0 +1,32 @@
|
|||
# coffeelint: disable=camel_case_classes
|
||||
class App.UiElement.checkboxTicketAttributes extends App.UiElement.ApplicationUiElement
|
||||
@render: (attribute, params) ->
|
||||
|
||||
configureAttributes = App.Ticket.configure_attributes
|
||||
for row, localAttribute of App.Ticket.attributesGet()
|
||||
configureAttributes.push localAttribute
|
||||
attributeOptionsArray = []
|
||||
attributeOptions = {}
|
||||
for row in configureAttributes
|
||||
|
||||
# ignore passwords
|
||||
if row.type isnt 'password' && row.type isnt 'tag' && row.name isnt 'tags'
|
||||
nameTmp = row.name
|
||||
|
||||
# get correct data name
|
||||
if row.name.substr(row.name.length-4,4) is '_ids'
|
||||
nameTmp = row.name.substr(0, row.name.length-4)
|
||||
else if row.name.substr(row.name.length-3,3) is '_id'
|
||||
nameTmp = row.name.substr(0, row.name.length-3)
|
||||
|
||||
if !attributeOptions[ nameTmp ]
|
||||
attributeOptions[ nameTmp ] = row.display
|
||||
attributeOptionsArray.push(
|
||||
{
|
||||
value: nameTmp
|
||||
name: row.display
|
||||
}
|
||||
)
|
||||
attribute.item_class = 'checkbox'
|
||||
attribute.options = attributeOptions
|
||||
App.UiElement.checkbox.render(attribute, params)
|
|
@ -0,0 +1,31 @@
|
|||
# coffeelint: disable=camel_case_classes
|
||||
class App.UiElement.selectTicketAttributes extends App.UiElement.ApplicationUiElement
|
||||
@render: (attribute, params) ->
|
||||
|
||||
configureAttributes = App.Ticket.configure_attributes
|
||||
for row, localAttribute of App.Ticket.attributesGet()
|
||||
configureAttributes.push localAttribute
|
||||
attributeOptionsArray = []
|
||||
attributeOptions = {}
|
||||
for row in configureAttributes
|
||||
|
||||
# ignore passwords
|
||||
if row.type isnt 'password' && row.type isnt 'tag' && row.name isnt 'tags'
|
||||
nameTmp = row.name
|
||||
|
||||
# get correct data name
|
||||
if row.name.substr(row.name.length-4,4) is '_ids'
|
||||
nameTmp = row.name.substr(0, row.name.length-4)
|
||||
else if row.name.substr(row.name.length-3,3) is '_id'
|
||||
nameTmp = row.name.substr(0, row.name.length-3)
|
||||
|
||||
if !attributeOptions[ nameTmp ]
|
||||
attributeOptions[ nameTmp ] = row.display
|
||||
attributeOptionsArray.push(
|
||||
{
|
||||
value: nameTmp
|
||||
name: row.display
|
||||
}
|
||||
)
|
||||
attribute.options = attributeOptions
|
||||
App.UiElement.select.render(attribute, params)
|
|
@ -764,50 +764,24 @@ class App.OverviewSettings extends App.ControllerModal
|
|||
25: '25'
|
||||
},
|
||||
})
|
||||
attributeOptions = {}
|
||||
attributeOptionsArray = []
|
||||
configure_attributes = App.Ticket.configure_attributes
|
||||
for row, attribute of App.Ticket.attributesGet()
|
||||
configure_attributes.push attribute
|
||||
for row in configure_attributes
|
||||
|
||||
# ignore passwords
|
||||
if row.type isnt 'password'
|
||||
name = row.name
|
||||
|
||||
# get correct data name
|
||||
if row.name.substr(row.name.length-4,4) is '_ids'
|
||||
name = row.name.substr(0, row.name.length-4)
|
||||
else if row.name.substr(row.name.length-3,3) is '_id'
|
||||
name = row.name.substr(0, row.name.length-3)
|
||||
|
||||
if !attributeOptions[ name ]
|
||||
attributeOptions[ name ] = row.display
|
||||
attributeOptionsArray.push(
|
||||
{
|
||||
value: name
|
||||
name: row.display
|
||||
}
|
||||
)
|
||||
@configure_attributes_article.push({
|
||||
name: "view::#{@view_mode}"
|
||||
display: 'Attributes'
|
||||
tag: 'checkbox'
|
||||
tag: 'checkboxTicketAttributes'
|
||||
default: @overview.view[@view_mode]
|
||||
null: false
|
||||
translate: true
|
||||
sortBy: null
|
||||
options: attributeOptionsArray
|
||||
},
|
||||
{
|
||||
name: 'order::by'
|
||||
display: 'Order'
|
||||
tag: 'select'
|
||||
tag: 'selectTicketAttributes'
|
||||
default: @overview.order.by
|
||||
null: false
|
||||
translate: true
|
||||
sortBy: null
|
||||
options: attributeOptionsArray
|
||||
},
|
||||
{
|
||||
name: 'order::direction'
|
||||
|
|
|
@ -13,99 +13,18 @@ class App.Overview extends App.Model
|
|||
{
|
||||
name: 'view::s'
|
||||
display: 'Attributes'
|
||||
tag: 'checkbox'
|
||||
tag: 'checkboxTicketAttributes'
|
||||
default: ['number', 'title', 'state', 'created_at']
|
||||
null: false
|
||||
translate: true
|
||||
options: [
|
||||
{
|
||||
value: 'number'
|
||||
name: 'Number'
|
||||
},
|
||||
{
|
||||
value: 'title'
|
||||
name: 'Title'
|
||||
},
|
||||
{
|
||||
value: 'customer'
|
||||
name: 'Customer'
|
||||
},
|
||||
{
|
||||
value: 'state'
|
||||
name: 'State'
|
||||
},
|
||||
{
|
||||
value: 'priority'
|
||||
name: 'Priority'
|
||||
},
|
||||
{
|
||||
value: 'group'
|
||||
name: 'Group'
|
||||
},
|
||||
{
|
||||
value: 'owner'
|
||||
name: 'Owner'
|
||||
},
|
||||
{
|
||||
value: 'last_contact_at'
|
||||
name: 'Last contact'
|
||||
},
|
||||
{
|
||||
value: 'last_contact_agent_at'
|
||||
name: 'Last contact (Agent)'
|
||||
},
|
||||
{
|
||||
value: 'last_contact_customer_at'
|
||||
name: 'Last contact (Customer)'
|
||||
},
|
||||
{
|
||||
value: 'first_response_at'
|
||||
name: 'First Response'
|
||||
},
|
||||
{
|
||||
value: 'close_at'
|
||||
name: 'Close time'
|
||||
},
|
||||
{
|
||||
value: 'article_count'
|
||||
name: 'Article Count'
|
||||
},
|
||||
{
|
||||
value: 'updated_at'
|
||||
name: 'Updated at'
|
||||
},
|
||||
{
|
||||
value: 'created_at'
|
||||
name: 'Created at'
|
||||
},
|
||||
]
|
||||
class: 'medium'
|
||||
},
|
||||
|
||||
{
|
||||
name: 'order::by',
|
||||
display: 'Order',
|
||||
tag: 'select'
|
||||
tag: 'selectTicketAttributes'
|
||||
default: 'created_at'
|
||||
null: false
|
||||
translate: true
|
||||
options:
|
||||
number: 'Number'
|
||||
title: 'Title'
|
||||
customer: 'Customer'
|
||||
state: 'State'
|
||||
priority: 'Priority'
|
||||
group: 'Group'
|
||||
owner: 'Owner'
|
||||
last_contact_at: 'Last contact'
|
||||
last_contact_agent_at: 'Last contact (Agent)'
|
||||
last_contact_customer_at: 'Last contact (Customer)'
|
||||
first_response_at: 'First Response'
|
||||
close_at: 'Close time'
|
||||
article_count: 'Article Count'
|
||||
updated_at: 'Updated at'
|
||||
created_at: 'Created at'
|
||||
class: 'span4'
|
||||
},
|
||||
{
|
||||
name: 'order::direction'
|
||||
|
@ -117,7 +36,6 @@ class App.Overview extends App.Model
|
|||
options:
|
||||
ASC: 'up'
|
||||
DESC: 'down'
|
||||
class: 'span4'
|
||||
},
|
||||
{
|
||||
name: 'group_by'
|
||||
|
@ -133,7 +51,6 @@ class App.Overview extends App.Model
|
|||
priority: 'Priority'
|
||||
group: 'Group'
|
||||
owner: 'Owner'
|
||||
class: 'span4'
|
||||
},
|
||||
{ name: 'active', display: 'Active', tag: 'active', default: true },
|
||||
{ name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 },
|
||||
|
|
Loading…
Reference in a new issue