From 64794c37672329bf88b0953167ce6b74e96be967 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 7 Feb 2015 23:43:27 +0100 Subject: [PATCH] Introduced new @P() to print values in templates based on attribute definition. --- .../_application_controller.js.coffee | 27 ++-- .../_application_controller_table.js.coffee | 2 +- .../app/controllers/navigation.js.coffee | 3 - app/assets/javascripts/app/index.js.coffee | 120 +++++++++++++++--- .../app/models/email_address.js.coffee | 10 +- .../javascripts/app/models/group.js.coffee | 18 +-- .../javascripts/app/models/job.js.coffee | 10 +- .../javascripts/app/models/network.js.coffee | 8 +- .../models/object_manager_attribute.js.coffee | 10 +- .../app/models/organization.js.coffee | 10 +- .../javascripts/app/models/overview.js.coffee | 10 +- .../app/models/postmaster_filter.js.coffee | 14 +- .../javascripts/app/models/role.js.coffee | 14 +- .../app/models/signature.js.coffee | 16 +-- .../javascripts/app/models/sla.js.coffee | 10 +- .../app/models/text_module.js.coffee | 10 +- .../javascripts/app/models/ticket.js.coffee | 20 +-- .../app/models/ticket_article.js.coffee | 26 ++-- .../app/models/ticket_priority.js.coffee | 8 +- .../app/models/ticket_state.js.coffee | 8 +- .../javascripts/app/models/user.js.coffee | 38 +++--- .../views/agent_ticket_view/detail.jst.eco | 12 +- .../app/views/generic/table.jst.eco | 60 +++------ .../views/organization_profile/object.jst.eco | 2 +- .../app/views/popover/organization.jst.eco | 8 +- .../app/views/popover/ticket.jst.eco | 16 +-- .../app/views/popover/user.jst.eco | 6 +- .../views/popover/user_ticket_list.jst.eco | 4 +- .../app/views/ticket_zoom/title.jst.eco | 2 +- .../app/views/user_profile/object.jst.eco | 2 +- .../app/views/widget/organization.jst.eco | 2 +- .../javascripts/app/views/widget/user.jst.eco | 2 +- app/assets/stylesheets/zammad.css.scss | 16 ++- app/controllers/tickets_controller.rb | 4 +- app/models/ticket/screen_options.rb | 21 ++- config/routes/test.rb | 1 + public/assets/tests/model-ui.js | 79 ++++++++++++ public/assets/tests/table.js | 5 +- test/browser/aab_unit_test.rb | 22 ++++ 39 files changed, 409 insertions(+), 247 deletions(-) create mode 100644 public/assets/tests/model-ui.js diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index feae627ef..0bef0a08c 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -369,7 +369,7 @@ class App.Controller extends Spine.Controller userTicketPopups: (params) -> - show = (data, tickets) => + show = (data, ticket_list) => if !data.position data.position = 'left' @@ -390,15 +390,14 @@ class App.Controller extends Spine.Controller content: -> type = $(@).filter('[data-type]').data('type') - data = tickets[type] || [] - - # set human time - for ticket in data - ticket.humanTime = controller.humanTime(ticket.created_at) + tickets = [] + if ticket_list[type] + for ticket_id in ticket_list[type] + tickets.push App.Ticket.fullLocal( ticket_id ) # insert data App.view('popover/user_ticket_list')( - tickets: data, + tickets: tickets, ) ) @@ -411,14 +410,18 @@ class App.Controller extends Spine.Controller } processData: true, success: (data, status, xhr) => - App.Store.write( "user-ticket-popover::#{params.user_id}", data.tickets ) - show( params, data.tickets ) + App.Store.write( "user-ticket-popover::#{params.user_id}", data ) + + # load assets + App.Collection.loadAssets( data.assets ) + + show( params, { open: data.ticket_ids_open, closed: data.ticket_ids_closed } ) ) # get data - tickets = App.Store.get( "user-ticket-popover::#{params.user_id}" ) - if tickets - show( params, tickets ) + data = App.Store.get( "user-ticket-popover::#{params.user_id}" ) + if data + show( params, { open: data.ticket_ids_open, closed: data.ticket_ids_closed } ) @delay( => fetch(params) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee index a218b4a7c..460e0fcf5 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee @@ -82,7 +82,7 @@ class App.ControllerTable extends App.Controller el: element overview: ['time', 'area', 'level', 'browser', 'location', 'data'] attributes: [ - { name: 'time', display: 'Time', type: 'time' }, + { name: 'time', display: 'Time', tag: 'datetime' }, { name: 'area', display: 'Area', type: 'text' }, { name: 'level', display: 'Level', type: 'text' }, { name: 'browser', display: 'Browser', type: 'text' }, diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index 53ede62f5..58cb9c5f2 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -156,11 +156,8 @@ class App.Navigation extends App.Controller area.result = [] for id in area.ids ticket = App.Ticket.find( id ) - ticket.humanTime = @humanTime(ticket.created_at) data = display: "##{ticket.number} - #{ticket.title}" - createt_at: "#{ticket.created_at}" - humanTime: "#{ticket.humanTime}" id: ticket.id class: "task level-1 ticket-popover" url: ticket.uiUrl() diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index f628c4e61..3e9458097 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -10,29 +10,111 @@ #= require_tree ./lib/app_post class App extends Spine.Controller + @viewPrint: (object, attribute_name) -> + attributes = {} + if object.constructor.attributesGet + attributes = object.constructor.attributesGet() + attribute_config = attributes[attribute_name] + value = object[attribute_name] + valueRef = undefined + + # check if relation is requested + if !attribute_config + attribute_name_new = "#{attribute_name}_id" + attribute_config = attributes[attribute_name_new] + if attribute_config + attribute_name = attribute_name_new + if object[attribute_name] + valueRef = value + value = object[attribute_name] + + # in case of :: key, get the sub value + if !value + parts = attribute_name.split('::') + if parts[0] && parts[1] && object[ parts[0] ] + value = object[ parts[0] ][ parts[1] ] + + #console.log('Pa', attribute_name, object, attribute_config, object[attribute_name], valueRef, value) + + # if we have no config, get output this way + if !attribute_config + return @viewPrintItem( value ) + + # check if valueRef already exists, no lookup needed later + if !valueRef + attribute_name_without_ref = attribute_name.substr(attribute_name.length-3, attribute_name.length) + if attribute_name_without_ref is '_id' + attribute_name_without_ref = attribute_name.substr(0, attribute_name.length-3) + if object[attribute_name_without_ref] + valueRef = object[attribute_name_without_ref] + + return @viewPrintItem( value, attribute_config, valueRef ) + + # define print name helper + @viewPrintItem: ( item, attribute_config = {}, valueRef ) -> + return '-' if item is undefined + return '-' if item is '' + return item if !item + result = item + + # lookup relation + if attribute_config.relation || valueRef + if valueRef + item = valueRef + else + item = App[attribute_config.relation].find(item) + + # if date is a object, get name of the object + isObject = false + if typeof item is 'object' + isObject = true + if item.displayNameLong + result = item.displayNameLong() + else if item.displayName + result = item.displayName() + else + result = item.name + + # execute callback on content + if attribute_config.callback + result = attribute_config.callback( result, attribute_config ) + + # text2html in textarea view + if attribute_config.tag is 'textarea' + result = App.Utils.text2html( result ) + + # fillup options + if !_.isEmpty(attribute_config.options) + if attribute_config.options[result] + result = attribute_config.options[result] + + # translate content + isTranslated = false + if attribute_config.translate || ( isObject && item.translate && item.translate() ) + isTranslated = true + result = App.i18n.translateContent( result ) + + # transform date + if attribute_config.tag is 'date' + result = App.i18n.translateDate(result) + + # use pretty time for datetime + else if attribute_config.tag is 'datetime' + result = "?" + #result = App.i18n.translateTimestamp(result) + + else if !isTranslated + if typeof result is 'string' + result = App.Utils.htmlEscape(result) + + result + @view: (name) -> template = ( params = {} ) => # define print name helper - params.P = ( item, row = {} ) -> - return '-' if item is undefined - return '-' if item is '' - return item if !item - - # if date is a object, get name of the object - if typeof item is 'object' - if item.displayNameLong - return item.displayNameLong() - else if item.displayName - return item.displayName() - return item.name - - # execute callback on content - if row.callback - return row.callback( item, row ) - - # return raw data - item + params.P = ( object, attribute_name ) -> + App.viewPrint( object, attribute_name ) # define date format helper params.date = ( time ) -> diff --git a/app/assets/javascripts/app/models/email_address.js.coffee b/app/assets/javascripts/app/models/email_address.js.coffee index 0a85fa3d0..a2d045240 100644 --- a/app/assets/javascripts/app/models/email_address.js.coffee +++ b/app/assets/javascripts/app/models/email_address.js.coffee @@ -4,11 +4,11 @@ class App.EmailAddress extends App.Model @url: @apiPath + '/email_addresses' @configure_attributes = [ - { name: 'realname', display: 'Realname', tag: 'input', type: 'text', limit: 250, 'null': false, 'class': 'span4' }, - { name: 'email', display: 'Email', tag: 'input', type: 'text', limit: 250, 'null': false, 'class': 'span4' }, - { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, 'class': 'span4' }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, + { name: 'realname', display: 'Realname', tag: 'input', type: 'text', limit: 250, null: false }, + { name: 'email', display: 'Email', tag: 'input', type: 'text', limit: 250, null: false }, + { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', default: true, null: false }, ] @configure_overview = [ 'realname', 'email' diff --git a/app/assets/javascripts/app/models/group.js.coffee b/app/assets/javascripts/app/models/group.js.coffee index b07a43791..85f6716e2 100644 --- a/app/assets/javascripts/app/models/group.js.coffee +++ b/app/assets/javascripts/app/models/group.js.coffee @@ -4,15 +4,15 @@ class App.Group extends App.Model @url: @apiPath + '/groups' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, - { name: 'assignment_timeout', display: 'Assignment Timeout', tag: 'input', note: 'Assignment timeout 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 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' }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, + { name: 'assignment_timeout', display: 'Assignment Timeout', tag: 'input', note: 'Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', type: 'text', limit: 100, null: true }, + { 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.' }, + { 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.' }, + { name: 'email_address_id', display: 'Email', tag: 'select', multiple: false, null: true, relation: 'EmailAddress', nulloption: true }, + { name: 'signature_id', display: 'Signature', tag: 'select', multiple: false, null: true, relation: 'Signature', nulloption: true }, + { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', default: true, null: false }, ] @configure_overview = [ 'name', diff --git a/app/assets/javascripts/app/models/job.js.coffee b/app/assets/javascripts/app/models/job.js.coffee index 95b2e1b0f..d73984319 100644 --- a/app/assets/javascripts/app/models/job.js.coffee +++ b/app/assets/javascripts/app/models/job.js.coffee @@ -8,15 +8,15 @@ class App.Job extends App.Model { name: 'condition', display: 'Conditions for matching objects.', tag: 'ticket_attribute_selection', null: true }, { name: 'execute', display: 'Execute changes on objects.', tag: 'ticket_attribute_set', null: true }, { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, - { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, null: false }, + { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', default: true, null: false }, { name: 'matching', display: 'Matching', readonly: 1 }, - { name: 'processed', display: 'Processed', readonly: 1 }, - { name: 'last_run_at', display: 'Last run', type: 'time', readonly: 1 }, + { name: 'processed', display: 'Processed', readonly: 1 }, + { name: 'last_run_at', display: 'Last run', tag: 'datetime', readonly: 1 }, { name: 'running', display: 'Running', tag: 'boolean', readonly: 1 }, { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_delete = true @configure_overview = [ diff --git a/app/assets/javascripts/app/models/network.js.coffee b/app/assets/javascripts/app/models/network.js.coffee index d33c60e15..f5871cd59 100644 --- a/app/assets/javascripts/app/models/network.js.coffee +++ b/app/assets/javascripts/app/models/network.js.coffee @@ -2,8 +2,8 @@ class App.Network extends App.Model @configure 'Network', 'name', 'note', 'active', 'updated_at' @extend Spine.Model.Ajax @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'xlarge' }, - { name: 'note', display: 'Note', note: 'Notes are visible to agents only, never to customers.', tag: 'textarea', limit: 250, 'null': true, 'class': 'xlarge' }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false, 'class': 'xlarge' }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, + { name: 'note', display: 'Note', note: 'Notes are visible to agents only, never to customers.', tag: 'textarea', limit: 250, null: true }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', default: true, null: false }, ] diff --git a/app/assets/javascripts/app/models/object_manager_attribute.js.coffee b/app/assets/javascripts/app/models/object_manager_attribute.js.coffee index 0611d8c67..bddd641fa 100644 --- a/app/assets/javascripts/app/models/object_manager_attribute.js.coffee +++ b/app/assets/javascripts/app/models/object_manager_attribute.js.coffee @@ -3,13 +3,13 @@ class App.ObjectManagerAttribute extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/object_manager_attributes' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false }, - { name: 'display', display: 'Anzeige', tag: 'input', type: 'text', limit: 100, 'null': false }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, + { name: 'display', display: 'Anzeige', tag: 'input', type: 'text', limit: 100, null: false }, { name: 'object', display: 'Object', tag: 'input', readonly: 1 }, { name: 'position', display: 'Position', tag: 'input', readonly: 1 }, - { name: 'active', display: 'Active', tag: 'boolean', 'default': true, 'null': false }, - { name: 'data_type', display: 'Format', tag: 'input', type: 'text', limit: 100, 'null': false }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', default: true, null: false }, + { name: 'data_type', display: 'Format', tag: 'input', type: 'text', limit: 100, null: false }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_overview = [ #'name', diff --git a/app/assets/javascripts/app/models/organization.js.coffee b/app/assets/javascripts/app/models/organization.js.coffee index 9b6761673..fac2fb4b4 100644 --- a/app/assets/javascripts/app/models/organization.js.coffee +++ b/app/assets/javascripts/app/models/organization.js.coffee @@ -3,11 +3,11 @@ class App.Organization extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/organizations' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, info: true }, - { name: 'shared', display: 'Shared organization', tag: 'boolean', note: 'Customers in the organization can view each other items.', type: 'boolean', 'default': true, 'null': false, info: false }, - { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, info: true }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1, info: false }, - { name: 'active', display: 'Active', tag: 'boolean', 'default': true, 'null': false, info: false }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false, info: true }, + { name: 'shared', display: 'Shared organization', tag: 'boolean', note: 'Customers in the organization can view each other items.', type: 'boolean', default: true, null: false, info: false }, + { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true, info: true }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1, info: false }, + { name: 'active', display: 'Active', tag: 'boolean', default: true, null: false, info: false }, ] @configure_overview = [ 'name', diff --git a/app/assets/javascripts/app/models/overview.js.coffee b/app/assets/javascripts/app/models/overview.js.coffee index c82c09646..8a344b63a 100644 --- a/app/assets/javascripts/app/models/overview.js.coffee +++ b/app/assets/javascripts/app/models/overview.js.coffee @@ -131,11 +131,11 @@ class App.Overview extends App.Model owner: 'Owner' class: 'span4' }, - { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, - { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, - { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', default: true, null: false }, + { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, + { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_delete = true @configure_overview = [ diff --git a/app/assets/javascripts/app/models/postmaster_filter.js.coffee b/app/assets/javascripts/app/models/postmaster_filter.js.coffee index eea1540e7..d5439fbc2 100644 --- a/app/assets/javascripts/app/models/postmaster_filter.js.coffee +++ b/app/assets/javascripts/app/models/postmaster_filter.js.coffee @@ -8,13 +8,13 @@ class App.PostmasterFilter extends App.Model { name: 'channel', display: 'Channel', type: 'input', readonly: 1 }, { name: 'match', display: 'Match all of the following', tag: 'postmaster_match' }, { name: 'perform', display: 'Perform action of the following', tag: 'postmaster_set' }, - { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false }, - { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, - { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', default: true, null: false }, + { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, + { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_delete = true @configure_overview = [ diff --git a/app/assets/javascripts/app/models/role.js.coffee b/app/assets/javascripts/app/models/role.js.coffee index fa733bb4e..660dce149 100644 --- a/app/assets/javascripts/app/models/role.js.coffee +++ b/app/assets/javascripts/app/models/role.js.coffee @@ -3,13 +3,13 @@ class App.Role extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/roles' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, - { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, null: false }, - { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, - { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, + { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, null: false }, + { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, + { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_overview = [ 'name', diff --git a/app/assets/javascripts/app/models/signature.js.coffee b/app/assets/javascripts/app/models/signature.js.coffee index 582608372..68af43b08 100644 --- a/app/assets/javascripts/app/models/signature.js.coffee +++ b/app/assets/javascripts/app/models/signature.js.coffee @@ -4,14 +4,14 @@ class App.Signature extends App.Model @url: @apiPath + '/signatures' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, - { name: 'body', display: 'Text', tag: 'textarea', limit: 250, 'null': true, 'class': 'span4', rows: 10 }, - { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, 'class': 'span4' }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, - { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, - { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false }, + { name: 'body', display: 'Text', tag: 'textarea', limit: 250, 'null': true, rows: 10 }, + { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false }, + { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, + { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_overview = [ 'name', diff --git a/app/assets/javascripts/app/models/sla.js.coffee b/app/assets/javascripts/app/models/sla.js.coffee index e85682eaf..a89a31e52 100644 --- a/app/assets/javascripts/app/models/sla.js.coffee +++ b/app/assets/javascripts/app/models/sla.js.coffee @@ -31,11 +31,11 @@ class App.Sla extends App.Model group: 'Group' owner: 'Owner' }, - { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false }, - { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, - { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', default: true, null: false }, + { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, + { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_delete = true @configure_overview = [ diff --git a/app/assets/javascripts/app/models/text_module.js.coffee b/app/assets/javascripts/app/models/text_module.js.coffee index b35c9cfee..8d9425129 100644 --- a/app/assets/javascripts/app/models/text_module.js.coffee +++ b/app/assets/javascripts/app/models/text_module.js.coffee @@ -3,11 +3,11 @@ class App.TextModule extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/text_modules' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, - { name: 'keywords', display: 'Keywords', tag: 'input', type: 'text', limit: 100, 'null': true, 'class': 'span4' }, - { name: 'content', display: 'Content', tag: 'textarea', limit: 250, 'null': false, '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: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' }, + { name: 'keywords', display: 'Keywords', tag: 'input', type: 'text', limit: 100, 'null': true, 'class': 'span4' }, + { name: 'content', display: 'Content', tag: 'textarea', limit: 250, 'null': false, 'class': 'span4' }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' }, ] @configure_delete = true @configure_overview = [ diff --git a/app/assets/javascripts/app/models/ticket.js.coffee b/app/assets/javascripts/app/models/ticket.js.coffee index 25fcc3f81..8b28ee53c 100644 --- a/app/assets/javascripts/app/models/ticket.js.coffee +++ b/app/assets/javascripts/app/models/ticket.js.coffee @@ -11,18 +11,18 @@ class App.Ticket extends App.Model { name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false, parentClass: 'noTruncate' }, { name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', style: 'width: 12%', edit: true, customer: true, }, { name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', style: 'width: 12%', edit: true, customer: true, }, - { name: 'last_contact', display: 'Last contact', type: 'time', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, - { name: 'last_contact_agent', display: 'Last contact (Agent)', type: 'time', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, - { name: 'last_contact_customer', display: 'Last contact (Customer)', type: 'time', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, - { name: 'first_response', display: 'First response', type: 'time', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, - { name: 'close_time', display: 'Close time', type: 'time', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, - { name: 'pending_time', display: 'Pending Time', type: 'time', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, - { name: 'escalation_time', display: 'Escalation', type: 'time', null: true, style: 'width: 12%', class: 'escalation', parentClass: 'noTruncate' }, - { name: 'article_count', display: 'Article#', style: 'width: 12%' }, + { name: 'last_contact', display: 'Last contact', tag: 'datetime', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, + { name: 'last_contact_agent', display: 'Last contact (Agent)', tag: 'datetime', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, + { name: 'last_contact_customer', display: 'Last contact (Customer)', tag: 'datetime', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, + { name: 'first_response', display: 'First response', tag: 'datetime', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, + { name: 'close_time', display: 'Close time', tag: 'datetime', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, + { name: 'pending_time', display: 'Pending Time', tag: 'datetime', null: true, style: 'width: 12%', parentClass: 'noTruncate' }, + { name: 'escalation_time', display: 'Escalation', tag: 'datetime', null: true, style: 'width: 12%', class: 'escalation', parentClass: 'noTruncate' }, + { name: 'article_count', display: 'Article#', style: 'width: 12%' }, { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', style: 'width: 120px', readonly: 1, parentClass: 'noTruncate' }, + { name: 'created_at', display: 'Created', tag: 'datetime', style: 'width: 120px', readonly: 1, parentClass: 'noTruncate' }, { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', style: 'width: 120px', readonly: 1, parentClass: 'noTruncate' }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', style: 'width: 120px', readonly: 1, parentClass: 'noTruncate' }, ] uiUrl: -> diff --git a/app/assets/javascripts/app/models/ticket_article.js.coffee b/app/assets/javascripts/app/models/ticket_article.js.coffee index 496d9a265..67a42cc76 100644 --- a/app/assets/javascripts/app/models/ticket_article.js.coffee +++ b/app/assets/javascripts/app/models/ticket_article.js.coffee @@ -3,19 +3,19 @@ class App.TicketArticle extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/ticket_articles' @configure_attributes = [ - { name: 'ticket_id', display: 'TicketID', null: false, readonly: 1, }, - { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, }, - { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, }, - { name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true, }, - { name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: true, }, - { name: 'body', display: 'Text', tag: 'textarea', rows: 5, limit: 100, null: false, }, - { 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' }, - { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, - { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'ticket_id', display: 'TicketID', null: false, readonly: 1, }, + { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false }, + { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true }, + { name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true }, + { name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: true }, + { name: 'body', display: 'Text', tag: 'textarea', rows: 5, limit: 100, null: false }, + { name: 'type_id', display: 'Type', tag: 'select', multiple: false, null: false, relation: 'TicketArticleType', default: '' }, + { name: 'sender_id', display: 'Sender', tag: 'select', multiple: false, null: false, relation: 'TicketArticleSender', default: '' }, + { name: 'internal', display: 'Visibility', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' } }, + { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, + { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] uiUrl: -> diff --git a/app/assets/javascripts/app/models/ticket_priority.js.coffee b/app/assets/javascripts/app/models/ticket_priority.js.coffee index 6139d808d..2051f025e 100644 --- a/app/assets/javascripts/app/models/ticket_priority.js.coffee +++ b/app/assets/javascripts/app/models/ticket_priority.js.coffee @@ -3,10 +3,10 @@ class App.TicketPriority extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/ticket_priorities' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, translate: true }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false, translate: true }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', default: true, null: false }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, ] @configure_translate = true @configure_overview = [ diff --git a/app/assets/javascripts/app/models/ticket_state.js.coffee b/app/assets/javascripts/app/models/ticket_state.js.coffee index c54cfb8c2..649e6dcdc 100644 --- a/app/assets/javascripts/app/models/ticket_state.js.coffee +++ b/app/assets/javascripts/app/models/ticket_state.js.coffee @@ -3,10 +3,10 @@ class App.TicketState extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/ticket_states' @configure_attributes = [ - { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, translate: true }, - { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, - { name: 'created_at', display: 'Created', type: 'time', readonly: 1 }, + { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false, translate: true }, + { name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', default: true, null: false }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'created_at', display: 'Created', tag: 'datetime', readonly: 1 }, ] @configure_translate = true @configure_overview = [ diff --git a/app/assets/javascripts/app/models/user.js.coffee b/app/assets/javascripts/app/models/user.js.coffee index ddea8b142..70a967f61 100644 --- a/app/assets/javascripts/app/models/user.js.coffee +++ b/app/assets/javascripts/app/models/user.js.coffee @@ -5,25 +5,25 @@ class App.User extends App.Model # @hasMany 'roles', 'App.Role' @configure_attributes = [ - { name: 'login', display: 'Login', tag: 'input', type: 'text', limit: 100, null: false, class: 'span4', autocapitalize: false, signup: false, quick: false }, - { name: 'firstname', display: 'Firstname', tag: 'input', type: 'text', limit: 100, null: false, class: 'span4', signup: true, info: true, invite_agent: true }, - { name: 'lastname', display: 'Lastname', tag: 'input', type: 'text', limit: 100, null: false, class: 'span4', signup: true, info: true, invite_agent: true }, - { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 100, null: false, class: 'span4', signup: true, info: true, invite_agent: true }, - { name: 'web', display: 'Web', tag: 'input', type: 'url', limit: 100, null: true, class: 'span4', signup: false, info: true }, - { name: 'phone', display: 'Phone', tag: 'input', type: 'phone', limit: 100, null: true, class: 'span4', signup: false, info: true }, - { name: 'mobile', display: 'Mobile', tag: 'input', type: 'phone', limit: 100, null: true, class: 'span4', signup: false, info: true }, - { name: 'fax', display: 'Fax', tag: 'input', type: 'phone', limit: 100, null: true, class: 'span4', signup: false, info: true }, - { name: 'organization_id', display: 'Organization', tag: 'select', multiple: false, nulloption: true, null: true, relation: 'Organization', class: 'span4', signup: false, info: true }, - { name: 'department', display: 'Department', tag: 'input', type: 'text', limit: 200, null: true, class: 'span4', signup: false, info: true }, - { name: 'street', display: 'Street', tag: 'input', type: 'text', limit: 100, null: true, class: 'span4', signup: false, info: true }, - { name: 'zip', display: 'Zip', tag: 'input', type: 'text', limit: 100, null: true, class: 'span4', signup: false, info: true }, - { name: 'city', display: 'City', tag: 'input', type: 'text', limit: 100, null: true, class: 'span4', signup: false, info: true }, - { name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 50, null: true, autocomplete: 'off', class: 'span4', signup: true, }, - { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true, class: 'span4', info: true }, - { name: 'role_ids', display: 'Roles', tag: 'checkbox', multiple: true, null: false, relation: 'Role', class: 'span4' }, - { name: 'group_ids', display: 'Groups', tag: 'checkbox', multiple: true, null: true, relation: 'Group', class: 'span4', invite_agent: true }, - { name: 'active', display: 'Active', tag: 'boolean', default: true, null: true, class: 'span4' }, - { name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 }, + { name: 'login', display: 'Login', tag: 'input', type: 'text', limit: 100, null: false, autocapitalize: false, signup: false, quick: false }, + { name: 'firstname', display: 'Firstname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true }, + { name: 'lastname', display: 'Lastname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true }, + { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 100, null: false, signup: true, info: true, invite_agent: true }, + { name: 'web', display: 'Web', tag: 'input', type: 'url', limit: 100, null: true, signup: false, info: true }, + { name: 'phone', display: 'Phone', tag: 'input', type: 'phone', limit: 100, null: true, signup: false, info: true }, + { name: 'mobile', display: 'Mobile', tag: 'input', type: 'phone', limit: 100, null: true, signup: false, info: true }, + { name: 'fax', display: 'Fax', tag: 'input', type: 'phone', limit: 100, null: true, signup: false, info: true }, + { name: 'organization_id', display: 'Organization', tag: 'select', multiple: false, nulloption: true, null: true, relation: 'Organization', signup: false, info: true }, + { name: 'department', display: 'Department', tag: 'input', type: 'text', limit: 200, null: true, signup: false, info: true }, + { name: 'street', display: 'Street', tag: 'input', type: 'text', limit: 100, null: true, signup: false, info: true }, + { name: 'zip', display: 'Zip', tag: 'input', type: 'text', limit: 100, null: true, signup: false, info: true }, + { name: 'city', display: 'City', tag: 'input', type: 'text', limit: 100, null: true, signup: false, info: true }, + { name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 50, null: true, autocomplete: 'off', signup: true, }, + { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true, info: true }, + { name: 'role_ids', display: 'Roles', tag: 'checkbox', multiple: true, null: false, relation: 'Role' }, + { name: 'group_ids', display: 'Groups', tag: 'checkbox', multiple: true, null: true, relation: 'Group', invite_agent: true }, + { name: 'active', display: 'Active', tag: 'boolean', default: true, null: true }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_overview = [ # 'login', 'firstname', 'lastname', 'email', 'updated_at', diff --git a/app/assets/javascripts/app/views/agent_ticket_view/detail.jst.eco b/app/assets/javascripts/app/views/agent_ticket_view/detail.jst.eco index b370be5f8..a32548e19 100644 --- a/app/assets/javascripts/app/views/agent_ticket_view/detail.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_view/detail.jst.eco @@ -17,24 +17,24 @@

<%= ticket.title %> <%= ticket.number %> ?

- <%- @T( 'State' ) %> <%- @T( ticket.state.name ) %> + <%- @T( 'State' ) %> <%- @P( ticket, 'state' ) %>
- <%- @T( 'Group' ) %> <%= ticket.group.name %> + <%- @T( 'Group' ) %> <%- @P( ticket, 'group' ) %>
- <%- @T( 'Customer' ) %> <%= ticket.customer.displayName() %> + <%- @T( 'Customer' ) %> <%- @P( ticket, 'customer' ) %>
- <%- @T( 'Priority' ) %> <%- @T( ticket.priority.name ) %> + <%- @T( 'Priority' ) %> <%- @P( ticket, 'priority' ) %>
- <%- @T( 'Owner' ) %> <%= ticket.owner.displayName() %> + <%- @T( 'Owner' ) %> <%- @P( ticket, 'owner' ) %>
- <%- @T( 'Organization' ) %> <%= @P( ticket.customer.organization ) %> + <%- @T( 'Organization' ) %> <%- @P( ticket, 'organization' ) %>
diff --git a/app/assets/javascripts/app/views/generic/table.jst.eco b/app/assets/javascripts/app/views/generic/table.jst.eco index 1a324f996..003c2318f 100644 --- a/app/assets/javascripts/app/views/generic/table.jst.eco +++ b/app/assets/javascripts/app/views/generic/table.jst.eco @@ -29,16 +29,9 @@ <% groupLast = '' %> <% for object in @objects: %> <% if @groupBy: %> - <% if object[@groupBy] && object[@groupBy].displayName: %> - <% groupByName = object[@groupBy].displayName() %> - <% if object[@groupBy].translate(): %> - <% groupByName = @T(groupByName) %> - <% end %> - <% else: %> - <% groupByName = object[@groupBy] || '-' %> - <% end %> + <% groupByName = @P( object, @groupBy ) %> <% if groupLast isnt groupByName: %> - <%- @P( groupByName ) %> + <%= groupByName %> <% groupLast = groupByName %> <% end %> <% end %> @@ -56,47 +49,26 @@ <% end %> <% for item in @header: %> - <% translation = false %> - <% value = object[item.name] %> - <% item_id = item.name.substr(item.name.length-3, item.name.length) %> - <% if item_id is '_id' && object[ item.name.substr(0, item.name.length-3) ]: %> - <% value = object[ item.name.substr(0, item.name.length-3) ] %> - <% refObject = object[ item.name.substr(0, item.name.length-3) ] %> - <% end %> - <% if !value: %> - <% parts = item.name.split '::' %> - <% if parts[0] && parts[1] && object[ parts[0] ]: %> - <% value = object[ parts[0] ][ parts[1] ] %> - <% end %> - <% end %> - <% if value && value.displayNameLong : %> - <% translation = true %> - <% value = value.displayNameLong() %> - <% else if value && value.displayName : %> - <% translation = true %> - <% value = value.displayName() %> - <% end %> - <% item_clone = item %> + <% value = @P( object, item.name ) %> <% if @callbacks: %> + <% if item.name.substr(item.name.length-3, item.name.length) is '_id' && object[ item.name.substr(0, item.name.length-3) ]: %> + <% refObject = object[ item.name.substr(0, item.name.length-3) ] %> + <% end %> <% for attribute, callbacksAll of @callbacks: %> - <% if attribute is item.name || attribute is item_id: %> + <% if attribute is item.name: %> <% for callback in callbacksAll: %> - <% value = callback( value, object, item_clone, @header, refObject ) %> + <% value = callback( value, object, item, @header, refObject ) %> <% end %> <% end %> <% end %> <% end %> - <% #console.log('HH', item_clone.name, item_clone.type, item_clone.translate, item_clone, object.translate(), refObject, translation) %> - class="<%= item_clone.parentClass %>"<% end %>> - <% if item_clone.link: %>target="<%= item_clone.target %>"<% end %>><% end %> - <% if item_clone.translate || ( translation && !refObject && object.translate && object.translate() ) || ( translation && refObject && refObject.translate && refObject.translate() ) : %> - class="<%= item_clone.class %>"<% end %>><%- @T( @P( value, item_clone ) ) %> - <% else if item_clone.type is 'time': %> - ? - <% else: %> - class="<%= item_clone.class %>"<% end %> <% if item_clone.title: %>title="<%= item_clone.title %>"<% end %> <% if item_clone.data: %><% for data_key, data_item of item_clone.data: %>data-<%- data_key %>="<%= data_item %>" <% end %><% end %>><%= @P(value) %> - <% end %> - <% if item_clone.link: %><% end %> + + class="<%= item.parentClass %>"<% end %>> + + <% if item.link: %>target="<%= item.target %>"<% end %>><% end %> + class="<%= item.class %>"<% end %> <% if item.title: %>title="<%= item.title %>"<% end %> <% if item.data: %><% for data_key, data_item of item.data: %>data-<%- data_key %>="<%= data_item %>" <% end %><% end %>><%- value %> + <% if item.link: %><% end %> + <% end %> <% if @destroy: %> @@ -105,4 +77,4 @@ <% end %> - + \ No newline at end of file diff --git a/app/assets/javascripts/app/views/organization_profile/object.jst.eco b/app/assets/javascripts/app/views/organization_profile/object.jst.eco index c8eded5a5..738410c25 100644 --- a/app/assets/javascripts/app/views/organization_profile/object.jst.eco +++ b/app/assets/javascripts/app/views/organization_profile/object.jst.eco @@ -17,7 +17,7 @@ <% if @organization[row.name]: %>
- <%- @L( @P( @organization[row.name] ) ) %> + <%- @P( @organization, row.name ) %>
<% end %> <% end %> diff --git a/app/assets/javascripts/app/views/popover/organization.jst.eco b/app/assets/javascripts/app/views/popover/organization.jst.eco index 6301dc391..c0a1f0fdc 100644 --- a/app/assets/javascripts/app/views/popover/organization.jst.eco +++ b/app/assets/javascripts/app/views/popover/organization.jst.eco @@ -4,11 +4,7 @@ <% if @organization[row.name]: %>

<%- @T( row.display ) %>

- <% if row.tag is 'richtext': %> -
<%- @organization[row.name] %>
- <% else: %> -
<%- @L( @P( @organization[row.name] ) ) %>
- <% end %> +
<%- @P( @organization, row.name ) %>
<% end %> <% end %> @@ -18,7 +14,7 @@

<%- @T('Members') %>

<% for user in @organization.members: %>
- <%= user.displayName() %> + <%= user.displayName() %>
<% end %> <% end %> \ No newline at end of file diff --git a/app/assets/javascripts/app/views/popover/ticket.jst.eco b/app/assets/javascripts/app/views/popover/ticket.jst.eco index e7a5808b3..7d78a0677 100644 --- a/app/assets/javascripts/app/views/popover/ticket.jst.eco +++ b/app/assets/javascripts/app/views/popover/ticket.jst.eco @@ -2,17 +2,17 @@ <%- @ticket.iconTitle() %>
-

<%- @P('Agent') %>

+

<%- @T('Agent') %>

<%= @ticket.owner.displayName() %> - <% if @ticket.owner.organization_id: %> + <% if @ticket.owner.organization: %> <%= @ticket.owner.organization.displayName() %> <% end %>
-

<%- @P('Customer') %>

+

<%- @T('Customer') %>

<%= @ticket.customer.displayName() %> - <% if @ticket.customer.organization_id: %> + <% if @ticket.customer.organization: %> <%= @ticket.customer.organization.displayName() %> <% end %>
@@ -20,18 +20,18 @@

#

-
<%- @P( @ticket.number ) %>
+
<%- @P( @ticket, 'number' ) %>

<%- @T( 'Priority' ) %>

-
<%- @T( @ticket.priority.name ) %>
+
<%- @P( @ticket, 'priority' ) %>

<%- @T( 'Created' ) %>

-
<%- @P( @ticket.humanTime ) %>
+
<%- @P( @ticket, 'created_at' ) %>

<%- @T( 'Group' ) %>

-
<%- @P( @ticket.group ) %>
+
<%- @P( @ticket, 'group' ) %>
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/popover/user.jst.eco b/app/assets/javascripts/app/views/popover/user.jst.eco index 48ba7d8b6..ef11cbba0 100644 --- a/app/assets/javascripts/app/views/popover/user.jst.eco +++ b/app/assets/javascripts/app/views/popover/user.jst.eco @@ -7,11 +7,7 @@ <% if @user[row.name]: %>

<%- @T( row.display ) %>

- <% if row.tag is 'richtext': %> -
<%- @user[row.name] %>
- <% else: %> -
<%- @L( @P( @user[row.name] ) ) %>
- <% end %> +
<%- @P( @user, row.name ) %>
<% end %> <% end %> diff --git a/app/assets/javascripts/app/views/popover/user_ticket_list.jst.eco b/app/assets/javascripts/app/views/popover/user_ticket_list.jst.eco index 2fdbba9d9..90e8e2938 100644 --- a/app/assets/javascripts/app/views/popover/user_ticket_list.jst.eco +++ b/app/assets/javascripts/app/views/popover/user_ticket_list.jst.eco @@ -1,3 +1,5 @@ +