Added admin interface for overviews.

This commit is contained in:
Martin Edenhofer 2013-02-01 00:44:25 +01:00
parent 36d0220183
commit 8e91657fcd
13 changed files with 603 additions and 97 deletions

View file

@ -49,46 +49,74 @@ class App.ControllerForm extends App.Controller
# input text field with max. 100 size
attribute_config = {
name: 'subject',
display: 'Subject',
tag: 'input',
type: 'text',
limit: 100,
null: false,
default: defaults['subject'],
name: 'subject'
display: 'Subject'
tag: 'input'
type: 'text'
limit: 100
null: false
default: defaults['subject']
class: 'span7'
}
# colection as relation with auto completion
attribute_config = {
name: 'customer_id',
display: 'Customer',
tag: 'autocompletion',
name: 'customer_id'
display: 'Customer'
tag: 'autocompletion'
# auto completion params, endpoints, ui,...
type: 'text',
limit: 100,
null: false,
relation: 'User',
autocapitalize: false,
help: 'Select the customer of the Ticket or create one.',
link: '<a href="" class="customer_new">&raquo;</a>',
type: 'text'
limit: 100
null: false
relation: 'User'
autocapitalize: false
help: 'Select the customer of the Ticket or create one.'
link: '<a href="" class="customer_new">&raquo;</a>'
callback: @userInfo
class: 'span7',
class: 'span7'
}
# colection as relation
attribute_config = {
name: 'ticket_priority_id',
display: 'Priority',
tag: 'select',
multiple: false,
null: false,
relation: 'TicketPriority',
default: defaults['ticket_priority_id'],
translate: true,
name: 'ticket_priority_id'
display: 'Priority'
tag: 'select'
multiple: false
null: false
relation: 'TicketPriority'
default: defaults['ticket_priority_id']
translate: true
class: 'medium'
}
# colection as options
attribute_config = {
name: 'ticket_priority_id'
display: 'Priority'
tag: 'select'
multiple: false
null: false
options: [
{
value: 5
name: 'very hight'
selected: false
disable: false
},
{
value: 3
name: 'normal'
selected: true
disable: false
},
]
default: 3
translate: true
class: 'medium'
}
###
formGenItem: (attribute_config, classname, form ) ->
@ -127,8 +155,14 @@ class App.ControllerForm extends App.Controller
# set value
if @params
if attribute.name of @params
attribute.value = @params[attribute.name]
# check if we have a references
parts = attribute.name.split '::'
if parts[0] && parts[1]
if @params[ parts[0] ] && @params[ parts[0] ][ parts[1] ]
attribute.value = @params[ parts[0] ][ parts[1] ]
else
attribute.value = @params[ attribute.name ]
# set default value
else
@ -139,7 +173,6 @@ class App.ControllerForm extends App.Controller
App.Log.log 'ControllerForm', 'debug', 'formGenItem-before', attribute
# build options list based on config
@_getConfigOptionList( attribute )
@ -155,6 +188,9 @@ class App.ControllerForm extends App.Controller
# finde selected/checked item of list
@_selectedOptions( attribute )
# disable item of list
@_disabledOptions( attribute )
# filter attributes
@_filterOption( attribute )
@ -382,6 +418,343 @@ class App.ControllerForm extends App.Controller
)
@delay( a, 180 )
# ticket attribute selection
else if attribute.tag is 'ticket_attribute_selection'
# list of possible attributes
item = $(
App.view('generic/ticket_attribute_selection')(
attribute: attribute
)
)
addShownAttribute = ( key, value ) =>
console.log( 'addShownAttribute', key, value )
if key is 'number'
attribute_config = {
name: attribute.name + '::number'
display: 'Number'
tag: 'input'
type: 'text'
null: false
value: value
class: 'medium'
remove: true
}
else if key is 'title'
attribute_config = {
name: attribute.name + '::title'
display: 'Title'
tag: 'input'
type: 'text'
null: false
value: value
class: 'medium'
remove: true
}
else if key is 'group_id'
attribute_config = {
name: attribute.name + '::group_id'
display: 'Group'
tag: 'select'
multiple: true
null: false
nulloption: false
relation: 'Group'
value: value
class: 'medium'
remove: true
}
else if key is 'owner_id' || key is 'customer_id'
display = 'Owner'
name = 'owner_id'
if key is 'customer_id'
display = 'Customer'
name = 'customer_id'
attribute_config = {
name: attribute.name + '::' + name
display: display
tag: 'select'
multiple: true
null: false
nulloption: false
relation: 'User'
value: value || null
class: 'medium'
remove: true
filter: ( all, type ) ->
return all if type isnt 'collection'
all = _.filter( all, (item) ->
return if item.id is 1
return item
)
all.unshift( {
id: ''
name: '--'
} )
all.unshift( {
id: 1
name: '*** nobody ***'
} )
all.unshift( {
id: 'current_user.id'
name: '*** current user ***'
} )
all
}
else if key is 'organization_id'
attribute_config = {
name: attribute.name + '::organization_id'
display: 'Organization'
tag: 'select'
multiple: true
null: false
nulloption: false
relation: 'Organization'
value: value || null
class: 'medium'
remove: true
filter: ( all, type ) ->
return all if type isnt 'collection'
all.unshift( {
id: ''
name: '--'
} )
all.unshift( {
id: 'current_user.organization_id'
name: '*** organization of current user ***'
} )
all
}
else if key is 'ticket_state_id'
attribute_config = {
name: attribute.name + '::ticket_state_id'
display: 'State'
tag: 'select'
multiple: true
null: false
nulloption: false
relation: 'TicketState'
value: value
translate: true
class: 'medium'
remove: true
}
else if key is 'ticket_priority_id'
attribute_config = {
name: attribute.name + '::ticket_priority_id'
display: 'Priority'
tag: 'select'
multiple: true
null: false
nulloption: false
relation: 'TicketPriority'
value: value
translate: true
class: 'medium'
remove: true
}
else
attribute_config = {
name: attribute.name + '::' + key
display: 'FIXME!'
tag: 'input'
type: 'text'
value: value
class: 'medium'
remove: true
}
itemSub = @formGenItem( attribute_config )
itemSub.find('.icon-minus').bind('click', (e) ->
e.preventDefault()
$(@).parent().parent().parent().remove()
)
# itemSub.append('<a href=\"#\" class=\"icon-minus\"></a>')
item.find('.ticket_attribute_item').append( itemSub )
# list of shown attributes
show = []
if attribute.value
for key, value of attribute.value
addShownAttribute( key, value )
# list of existing attributes
attribute_config = {
name: 'ticket_attribute_list'
display: 'Add Attribute'
tag: 'select'
multiple: false
null: false
# nulloption: true
options: [
{
value: ''
name: '-- Ticket --'
selected: false
disable: true
},
{
value: 'number'
name: 'Number'
selected: true
disable: false
},
{
value: 'title'
name: 'Title'
selected: true
disable: false
},
{
value: 'group_id'
name: 'Group'
selected: false
disable: false
},
{
value: 'ticket_state_id'
name: 'State'
selected: false
disable: false
},
{
value: 'ticket_priority_id'
name: 'Priority'
selected: true
disable: false
},
{
value: 'owner_id'
name: 'Owner'
selected: true
disable: false
},
{
value: 'customer_id'
name: 'Customer'
selected: true
disable: false
},
{
value: 'organization_id'
name: 'Organization'
selected: true
disable: false
},
# {
# value: 'tag'
# name: 'Tag'
# selected: true
# disable: false
# },
# {
# value: 'created_before'
# name: 'Erstell vor'
# selected: true
# disable: false
# },
# {
# value: 'created_after'
# name: 'Erstell nach'
# selected: true
# disable: false
# },
# {
# value: 'created_between'
# name: 'Erstell zwischen'
# selected: true
# disable: false
# },
# {
# value: 'closed_before'
# name: 'Geschlossen vor'
# selected: true
# disable: false
# },
# {
# value: 'closed_after'
# name: 'Geschlossen nach'
# selected: true
# disable: false
# },
# {
# value: 'closed_between'
# name: 'Geschlossen zwischen'
# selected: true
# disable: false
# },
{
value: '-a'
name: '-- ' + App.i18n.translateInline('Article') + ' --'
selected: false
disable: true
},
{
value: 'from'
name: 'From'
selected: true
disable: false
},
{
value: 'to'
name: 'To'
selected: true
disable: false
},
{
value: 'cc'
name: 'Cc'
selected: true
disable: false
},
{
value: 'subject'
name: 'Subject'
selected: true
disable: false
},
{
value: 'body'
name: 'Text'
selected: true
disable: false
},
# {
# value: '-c'
# name: '-- ' + App.i18n.translateInline('Customer') + ' --'
# selected: false
# disable: true
# },
# {
# value: 'customer_user'
# name: 'Kunde'
# selected: true
# disable: false
# },
# {
# value: 'organization'
# name: 'Organization'
# selected: true
# disable: false
# },
]
default: ''
translate: true
class: 'medium'
add: true
}
list = @formGenItem( attribute_config )
list.find('.icon-plus').bind('click', (e) ->
e.preventDefault()
value = $(e.target).parents().find('[name=ticket_attribute_list]').val()
addShownAttribute( value, '' )
)
item.find('.ticket_attribute_list').prepend( list )
# input
else
item = $( App.view('generic/input')( attribute: attribute ) )
@ -407,14 +780,14 @@ class App.ControllerForm extends App.Controller
classname = @classname
attributes_clean = @attributes_clean
ui = @
$('#' + @attribute.id).bind('change', ->
$( '#' + @attribute.id ).bind('change', ->
ui.log 'change', @, attribute, change
ui.log change[0] + ' has changed - changing ' + change[1]
item = $( ui.formGenItem(attribute, classname, attributes_clean) )
ui.log item, classname
)
@delay(b, 100)
@delay( b, 100 )
# if attribute.onchange[]
ui = @
@ -452,10 +825,12 @@ class App.ControllerForm extends App.Controller
if !attribute.display
return item
else
a = $( App.view('generic/attribute')(
attribute: attribute,
item: '',
) )
a = $(
App.view('generic/attribute')(
attribute: attribute,
item: '',
)
)
a.find('.controls').prepend( item )
return a
@ -463,6 +838,7 @@ class App.ControllerForm extends App.Controller
_sortOptions: (attribute) ->
return if !attribute.options
return if _.isArray( attribute.options )
options_by_name = []
for i in attribute.options
@ -478,30 +854,32 @@ class App.ControllerForm extends App.Controller
options_new.push ii
attribute.options = options_new
_addNullOption: (attribute) ->
return if !attribute.options
return if !attribute.nulloption
attribute.options[''] = '-'
attribute.options.push {
name: '-',
value: '',
}
if _.isArray( attribute.options )
attribute.options.unshift( { name: '-', value: '' } )
else
attribute.options[''] = '-'
_getConfigOptionList: (attribute) ->
return if !attribute.options
selection = attribute.options
attribute.options = []
for key, value of selection
name_new = value
if attribute.translate
name_new = App.i18n.translateInline( name_new )
attribute.options.push {
name: name_new,
value: key,
}
if _.isArray( selection )
for row in selection
if attribute.translate
row.name = App.i18n.translateInline( row.name )
attribute.options.push row
else
for key, value of selection
name_new = value
if attribute.translate
name_new = App.i18n.translateInline( name_new )
attribute.options.push {
name: name_new
value: key
}
_getRelationOptionList: (attribute) ->
@ -519,7 +897,8 @@ class App.ControllerForm extends App.Controller
if typeof attribute.filter is 'function'
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-function'
all = App[attribute.relation].all()
all = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
list = attribute.filter( all, 'collection' )
# data based filter
@ -529,7 +908,7 @@ class App.ControllerForm extends App.Controller
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-data', filter
# check all records
for record in App[attribute.relation].all()
for record in App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
# check all filter attributes
for key in filter
@ -542,17 +921,16 @@ class App.ControllerForm extends App.Controller
# no data filter matched
else
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-data no filter matched'
list = App[attribute.relation].all()
list = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
else
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-no filter defined'
list = App[attribute.relation].all()
list = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList', attribute, list
# build options list
@_buildOptionList( list, attribute )
# build options list
_buildOptionList: (list, attribute) ->
@ -563,6 +941,8 @@ class App.ControllerForm extends App.Controller
name_new = '?'
if item.displayName
name_new = item.displayName()
else if item.name
name_new = item.name
if attribute.translate
name_new = App.i18n.translateInline(name_new)
attribute.options.push {
@ -586,21 +966,42 @@ class App.ControllerForm extends App.Controller
return if !attribute.options
for record in attribute.options
if typeof attribute.value is 'string' || typeof attribute.value is 'number' || typeof attribute.value is 'boolean'
check = (value, record) ->
if typeof value is 'string' || typeof value is 'number' || typeof value is 'boolean'
# if name or value is matching
if record.value.toString() is attribute.value.toString() || record.name.toString() is attribute.value.toString()
if record.value.toString() is value.toString() || record.name.toString() is value.toString()
record.selected = 'selected'
record.checked = 'checked'
# if record.name.toString() is attribute.value.toString()
# record.selected = 'selected'
# record.checked = 'checked'
else if ( attribute.value && record.value && _.include(attribute.value, record.value) ) || ( attribute.value && record.name && _.include(attribute.value, record.name) )
else if ( value && record.value && _.include( value, record.value ) ) || ( value && record.name && _.include( value, record.name ) )
record.selected = 'selected'
record.checked = 'checked'
for record in attribute.options
if _.isArray( attribute.value )
for value in attribute.value
check( value, record )
if typeof attribute.value is 'string' || typeof attribute.value is 'number' || typeof attribute.value is 'boolean'
check( attribute.value, record )
# set disabled attributes
_disabledOptions: (attribute) ->
return if !attribute.options
return if !_.isArray( attribute.options )
for record in attribute.options
if record.disable is true
record.disabled = 'disabled'
else
record.disabled = ''
validate: (params) ->
App.Model.validate(
model: @model,
@ -645,8 +1046,17 @@ class App.ControllerForm extends App.Controller
param[key.name] = key.value
# check {input_select}
# check :: fields
inputSelectObject = {}
for key of param
parts = key.split '::'
if parts[0] && parts[1]
if !inputSelectObject[ parts[0] ]
inputSelectObject[ parts[0] ] = {}
inputSelectObject[ parts[0] ][ parts[1] ] = param[ key ]
delete param[ key ]
# check {input_select}
for key of param
attributeType = key.split '::'
name = attributeType[1]

View file

@ -79,8 +79,8 @@ class App.DashboardTicket extends App.Controller
@overview = data.overview
@tickets_count = data.tickets_count
@ticket_list = data.ticket_list
pages_total = parseInt( ( @tickets_count / @overview.view.d.per_page ) + 0.99999 ) || 1
# FIXME 10
pages_total = parseInt( ( @tickets_count / 10 ) + 0.99999 ) || 1
html = App.view('dashboard/ticket')(
overview: @overview,
pages_total: pages_total,
@ -99,7 +99,7 @@ class App.DashboardTicket extends App.Controller
if @ticket_list[ i - 1 ]
@tickets_in_table.push App.Collection.find( 'Ticket', @ticket_list[ i - 1 ] )
shown_all_attributes = @ticketTableAttributes( App.Overview.find(@overview.id).view.d.overview )
shown_all_attributes = @ticketTableAttributes( App.Overview.find(@overview.id).view.d )
new App.ControllerTable(
el: html.find('.table-overview'),
overview_extended: shown_all_attributes,
@ -161,7 +161,7 @@ class Settings extends App.ControllerModal
tag: 'select',
multiple: false,
null: false,
default: @overview.view.d.per_page,
# default: @overview.view.d.per_page,
options: {
5: 5,
10: 10,
@ -175,7 +175,7 @@ class Settings extends App.ControllerModal
name: 'attributes',
display: 'Attributes',
tag: 'checkbox',
default: @overview.view.d.overview,
default: @overview.view.d,
null: false,
translate: true
options: {
@ -263,7 +263,7 @@ class Settings extends App.ControllerModal
@overview.order['direction'] = params['order_by_direction']
@reload_needed = 1
@overview.view['d']['overview'] = params['attributes']
@overview.view['d'] = params['attributes']
@overview.save(
success: =>

View file

@ -124,10 +124,7 @@ class Index extends App.Controller
@selected = @bulkGetSelected()
# set page title
@title @overview.meta.name
# get total pages
pages_total = parseInt( ( @tickets_count / @overview.view[@view_mode].per_page ) + 0.99999 ) || 1
@title @overview.name
# render init page
checkbox = true
@ -152,8 +149,6 @@ class Index extends App.Controller
html = App.view('agent_ticket_view')(
overview: @overview
view_modes: view_modes
pages_total: pages_total
start_page: @start_page
checkbox: checkbox
edit: edit
)
@ -179,7 +174,7 @@ class Index extends App.Controller
)
@el.find('.table-overview').append(table)
else
shown_all_attributes = @ticketTableAttributes( App.Overview.find( @overview.id ).view.s.overview )
shown_all_attributes = @ticketTableAttributes( App.Overview.find( @overview.id ).view.s )
groupBy = undefined
if @overview.group_by
group_by =
@ -366,7 +361,7 @@ class Settings extends App.ControllerModal
tag: 'select'
multiple: false
null: false
default: @overview.view[@view_mode].per_page
# default: @overview.view[@view_mode].per_page
options:
15: 15
20: 20
@ -380,7 +375,7 @@ class Settings extends App.ControllerModal
name: 'attributes'
display: 'Attributes'
tag: 'checkbox'
default: @overview.view[@view_mode].overview
default: @overview.view[@view_mode]
null: false
translate: true
options:
@ -481,10 +476,6 @@ class Settings extends App.ControllerModal
# check if refetch is needed
@reload_needed = 0
if @overview.view[@view_mode]['per_page'] isnt params['per_page']
@overview.view[@view_mode]['per_page'] = params['per_page']
@reload_needed = 1
if @overview.order['by'] isnt params['order_by']
@overview.order['by'] = params['order_by']
@reload_needed = 1
@ -497,7 +488,7 @@ class Settings extends App.ControllerModal
@overview['group_by'] = params['group_by']
@reload_needed = 1
@overview.view[@view_mode]['overview'] = params['attributes']
@overview.view[@view_mode] = params['attributes']
@overview.save(
success: =>

View file

@ -236,12 +236,12 @@ class App.Navigation extends App.Controller
# add new views
for item in data
NavBar['TicketOverview' + item.url] = {
NavBar['TicketOverview' + item.link] = {
prio: item.prio,
parent: '#ticket_view',
name: item.name,
count: item.count,
target: '#ticket_view/' + item.url,
target: '#ticket_view/' + item.link,
# role: ['Agent', 'Customer'],
}

View file

@ -6,8 +6,8 @@ class App.Group extends App.Model
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'assignment_timeout', display: 'Assignment Timout', tag: 'input', note: 'Assignment timout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', type: 'text', limit: 100, 'null': true, 'class': 'span4' },
{ name: 'follow_up_possible', display: 'Follow possible', tag: 'select', default: 'yes', options: { yes: 'yes', reject: 'reject follow up/do not reopen Ticket', 'new_ticket': 'do not reopen Ticket but create new Ticket' }, 'null': false, note: 'Follow up for closed ticket possible or not.', 'class': 'span4' },
{ name: 'follow_up_assignment', display: 'Assign Follow Ups', tag: 'select', default: 'yes', options: { yes: 'yes', no: 'no' }, 'null': false, note: 'Assign follow up to latest agent again.', 'class': 'span4' },
{ name: 'follow_up_possible', display: 'Follow up possible',tag: 'select', default: 'yes', options: { yes: 'yes', reject: 'reject follow up/do not reopen Ticket', 'new_ticket': 'do not reopen Ticket but create new Ticket' }, 'null': false, note: 'Follow up for closed ticket possible or not.', 'class': 'span4' },
{ name: 'follow_up_assignment', display: 'Assign Follow Ups', tag: 'select', default: 'yes', options: { true: 'yes', false: 'no' }, 'null': false, note: 'Assign follow up to latest agent again.', 'class': 'span4' },
{ name: 'email_address_id', display: 'Email', tag: 'select', multiple: false, null: true, relation: 'EmailAddress', nulloption: true, class: 'span4' },
{ name: 'signature_id', display: 'Signature', tag: 'select', multiple: false, null: true, relation: 'Signature', nulloption: true, class: 'span4' },
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, 'class': 'span4' },

View file

@ -1,17 +1,100 @@
class App.Overview extends Spine.Model
@configure 'Overview', 'name', 'meta', 'condition', 'order', 'group_by', 'view', 'user_id', 'group_ids'
@configure 'Overview', 'name', 'link', 'prio', 'condition', 'order', 'group_by', 'view', 'user_id', 'organization_shared', 'role_id', 'order', 'group_by'
@extend Spine.Model.Ajax
@url: 'api/overviews'
@configure_attributes = [
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'role_id', display: 'Role', tag: 'select', multiple: false, nulloption: true, null: false, relation: 'Role', class: 'span4' },
{ name: 'user_id', display: 'User', tag: 'select', multiple: false, nulloption: true, null: true, relation: 'User', class: 'span4' },
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'link', display: 'URL', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
{ name: 'role_id', display: 'Available for Role', tag: 'select', multiple: false, nulloption: true, null: false, relation: 'Role', translate: true, class: 'span4' },
{ name: 'user_id', display: 'Available for User', tag: 'select', multiple: true, nulloption: true, null: true, relation: 'User', sortBy: 'firstname', class: 'span4' },
{ name: 'organization_shared', display: 'Only available for Users with shared Organization', tag: 'select', options: { true: 'yes', false: 'no' }, default: false, null: true, 'class': 'span4' },
# { name: 'content', display: 'Content', tag: 'textarea', limit: 250, 'null': false, 'class': 'span4' },
{ name: 'condition', display: 'Conditions for shown Tickets', tag: 'ticket_attribute_selection', null: true, class: 'span4' },
{ name: 'prio', display: 'Prio', tag: 'input', type: 'text', limit: 10, 'null': false, 'class': 'span4' },
{
name: 'view::s'
display: 'Attributes'
tag: 'checkbox'
default: ['number', 'title', 'ticket_state', 'created_at']
null: false
translate: true
options:
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'
last_contact: 'Last Contact'
last_contact_agent: 'Last Contact Agent'
last_contact_customer: 'Last Contact Customer'
first_response: 'First Response'
close_time: 'Close Time'
article_count: 'Article Count'
class: 'medium'
},
{
name: 'order::by',
display: 'Order',
tag: 'select'
default: 'created_at'
null: false
translate: true
options:
number: 'Number'
title: 'Title'
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
group: 'Group'
owner: 'Owner'
created_at: 'Age'
last_contact: 'Last Contact'
last_contact_agent: 'Last Contact Agent'
last_contact_customer: 'Last Contact Customer'
first_response: 'First Response'
close_time: 'Close Time'
article_count: 'Article Count'
class: 'span4'
},
{
name: 'order::direction'
display: 'Direction'
tag: 'select'
default: 'down'
null: false
translate: true
options:
ASC: 'up'
DESC: 'down'
class: 'span4'
},
{
name: 'group_by'
display: 'Group by'
tag: 'select'
default: ''
null: true
nulloption: true
translate: true
options:
customer: 'Customer'
ticket_state: 'State'
ticket_priority: 'Priority'
group: 'Group'
owner: 'Owner'
class: 'span4'
},
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
]
@configure_overview = [
'name',
'link',
'role',
'prio',
'active',
]

View file

@ -1,7 +1,7 @@
<div class="page-header">
<div class="row">
<div class="span9">
<h1><%- @T( @overview.meta.name ) %> <% if @edit: %><small><a href="#" data-type="settings" class="icon-edit"></a></small><% end %></h1>
<h1><%- @T( @overview.name ) %> <% if @edit: %><small><a href="#" data-type="settings" class="icon-edit"></a></small><% end %></h1>
</div>
<div class="span3">
<div class="pagination pagination-small pagination-right">

View file

@ -2,7 +2,7 @@
<div class="span9">
<div class="row">
<div class="span6">
<h2 class="can-move"><%- @T( @overview.meta.name ) %> <small><a href="#" data-type="settings" class="icon-edit"></a></small></h2>
<h2 class="can-move"><%- @T( @overview.name ) %> <small><a href="#" data-type="settings" class="icon-edit"></a></small></h2>
</div>
<div class="span3">
<div class="pagination pagination-small pagination-right">

View file

@ -1,7 +1,7 @@
<form class="form-horizontal">
<div class="modal-header">
<a href="#" class="close">&times;</a>
<h2><%- @T( 'Edit' ) %>: <%- @T( @overview.meta.name ) %></h2>
<h2><%- @T( 'Edit' ) %>: <%- @T( @overview.name ) %></h2>
</div>
<div class="modal-body">
<div id="form-setting"></div>

View file

@ -1,7 +1,8 @@
class Overview < ApplicationModel
store :condition
store :order
store :meta
store :view
validates :name, :presence => true
validates :prio, :presence => true
validates :link, :presence => true
end

View file

@ -265,7 +265,7 @@ class Ticket < ApplicationModel
overviews.each { |overview|
# remember selected view
if data[:view] && data[:view] == overview.meta[:url]
if data[:view] && data[:view] == overview.link
overview_selected = overview
overview_selected_raw = Marshal.load( Marshal.dump(overview.attributes) )
end
@ -328,7 +328,11 @@ class Ticket < ApplicationModel
count = Ticket.where( :group_id => group_ids ).where( overview.condition ).count()
# get meta info
all = overview.meta
all = {
:name => overview.name,
:prio => overview.prio,
:link => overview.link,
}
# push to result data
result.push all.merge( { :count => count } )

View file

@ -167,7 +167,8 @@ class CreateTicket < ActiveRecord::Migration
t.references :user, :null => true
t.references :role, :null => false
t.column :name, :string, :limit => 250, :null => false
t.column :meta, :string, :limit => 1000, :null => false
t.column :url, :string, :limit => 250, :null => false
t.column :prio, :integer, :null => false
t.column :condition, :string, :limit => 2500, :null => false
t.column :order, :string, :limit => 2500, :null => false
t.column :group_by, :string, :limit => 250, :null => true

View file

@ -0,0 +1,16 @@
class OverviewUpdate < ActiveRecord::Migration
def up
add_column :overviews, :link, :string, :limit => 250, :null => false
add_column :overviews, :prio, :integer, :null => false
Overview.all.each {|overview|
overview.link = overview.meta[:url]
overview.name = overview.meta[:name]
overview.prio = overview.meta[:prio]
overview.save
}
remove_column :overviews, :meta
end
def down
end
end