diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index 0ac61050b..d641dfe31 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -206,14 +206,18 @@ class App.Controller extends Spine.Controller update = => ui = @ $('.humanTimeFromNow').each( -> + item = $(this) # console.log('rewrite frontendTimeUpdate', this, $(this).hasClass('escalation')) - timestamp = $(this).data('time') - time = ui.humanTime( timestamp, $(this).hasClass('escalation') ) - $(this).attr( 'data-tooltip', App.i18n.translateTimestamp(timestamp) ) - $(this).html( time ) + ui.frontendTimeUpdateItem(item) ) App.Interval.set( update, 30000, 'frontendTimeUpdate', 'ui' ) + frontendTimeUpdateItem: (item) => + timestamp = item.data('time') + time = @humanTime( timestamp, item.hasClass('escalation') ) + item.attr( 'data-tooltip', App.i18n.translateTimestamp(timestamp) ) + item.html( time ) + ticketPopups: (position = 'right') -> # open ticket in new task if curent user agent @@ -241,12 +245,17 @@ class App.Controller extends Spine.Controller ticket = App.Ticket.fullLocal( ticket_id ) App.Utils.htmlEscape( ticket.title ) content: -> - ticket_id = $(@).data('id') - ticket = App.Ticket.fullLocal( ticket_id ) - ticket.humanTime = ui.humanTime(ticket.created_at) - App.view('popover/ticket')( + ticket_id = $(@).data('id') + ticket = App.Ticket.fullLocal( ticket_id ) + html = App.view('popover/ticket')( ticket: ticket ) + html = $( html ) + html.find('.humanTimeFromNow').each( -> + item = $(this) + ui.frontendTimeUpdateItem(item) + ) + html ) ticketPopupsDestroy: => @@ -369,7 +378,7 @@ class App.Controller extends Spine.Controller userTicketPopups: (params) -> - show = (data, tickets) => + show = (data, ticket_list) => if !data.position data.position = 'left' @@ -377,7 +386,7 @@ class App.Controller extends Spine.Controller @userTicketPopupsDestroy() # show user popup - controller = @ + ui = @ @userTicketPopupsList = @el.find(data.selector).popover( trigger: 'hover' container: 'body' @@ -390,16 +399,21 @@ 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, + html = App.view('popover/user_ticket_list')( + tickets: tickets ) + html = $( html ) + html.find('.humanTimeFromNow').each( -> + item = $(this) + ui.frontendTimeUpdateItem(item) + ) + html ) fetch = (params) => @@ -411,14 +425,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) @@ -556,10 +574,10 @@ class App.ControllerModal extends App.Controller @el.addClass('modal--local') @el.modal - keyboard: @keyboard - show: true - backdrop: @backdrop - container: @container + keyboard: @keyboard + show: true + backdrop: @backdrop + container: @container .on 'show.bs.modal': @onShow 'shown.bs.modal': @onShown diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index 0f6752308..3b2e08282 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -175,7 +175,7 @@ class App.ControllerForm extends App.Controller ### formGenItem: (attribute_config, classname, form, attribute_count ) -> - attribute = clone( attribute_config ) + attribute = clone( attribute_config, true ) # create item id attribute.id = classname + '_' + attribute.name @@ -260,8 +260,8 @@ class App.ControllerForm extends App.Controller # build options list if _.isEmpty(attribute.options) attribute.options = [ - { name: 'active', value: true } - { name: 'inactive', value: false } + { name: 'yes', value: true } + { name: 'no', value: false } ] # set data type @@ -276,6 +276,29 @@ class App.ControllerForm extends App.Controller # return item item = $( App.view('generic/select')( attribute: attribute ) ) + else if attribute.tag is 'active' + + # active attribute is always required + attribute.null = false + + # build options list + attribute.options = [ + { name: 'active', value: true } + { name: 'inactive', value: false } + ] + + # set data type + if attribute.name + attribute.name = '{boolean}' + attribute.name + + # finde selected item of list + for record in attribute.options + if record.value is attribute.value + record.selected = 'selected' + + # return item + item = $( App.view('generic/select')( attribute: attribute ) ) + # select else if attribute.tag is 'select' item = $( App.view('generic/select')( attribute: attribute ) ) @@ -320,12 +343,13 @@ class App.ControllerForm extends App.Controller number if !reset && (year isnt '' && month isnt '' && day isnt '') time = new Date( Date.parse( "#{year}-#{format(month)}-#{format(day)}T00:00:00Z" ) ) + time.setMinutes( time.getMinutes() + diff + time.getTimezoneOffset() ) else time = new Date() - #time.setMinutes( time.getMinutes() + diff + time.getTimezoneOffset() ) - item.closest('.form-group').find("[name=\"{date}#{name}___day\"]").val( time.getUTCDate() ) - item.closest('.form-group').find("[name=\"{date}#{name}___month\"]").val( time.getUTCMonth()+1 ) - item.closest('.form-group').find("[name=\"{date}#{name}___year\"]").val( time.getUTCFullYear() ) + time.setMinutes( time.getMinutes() + diff ) + item.closest('.form-group').find("[name=\"{date}#{name}___day\"]").val( time.getDate() ) + item.closest('.form-group').find("[name=\"{date}#{name}___month\"]").val( time.getMonth()+1 ) + item.closest('.form-group').find("[name=\"{date}#{name}___year\"]").val( time.getFullYear() ) item.find('.js-today').bind('click', (e) -> e.preventDefault() @@ -462,9 +486,10 @@ class App.ControllerForm extends App.Controller number if !reset && (year isnt '' && month isnt '' && day isnt '' && hour isnt '' && day isnt '') time = new Date( Date.parse( "#{year}-#{format(month)}-#{format(day)}T#{format(hour)}:#{format(minute)}:00Z" ) ) + time.setMinutes( time.getMinutes() + diff + time.getTimezoneOffset() ) else time = new Date() - time.setMinutes( time.getMinutes() + diff + time.getTimezoneOffset() ) + time.setMinutes( time.getMinutes() + diff ) #console.log('T', time, time.getHours(), time.getMinutes()) item.closest('.form-group').find("[name=\"{datetime}#{name}___day\"]").val( time.getDate() ) item.closest('.form-group').find("[name=\"{datetime}#{name}___month\"]").val( time.getMonth()+1 ) diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee index c49f3897b..68c88ac33 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -2,15 +2,15 @@ class App.ControllerGenericNew extends App.ControllerModal constructor: (params) -> super - @head = App.i18n.translateContent( 'New' ) + ': ' + App.i18n.translateContent( @pageData.object ) + @head = App.i18n.translateContent( 'New' ) + ': ' + App.i18n.translateContent( @pageData.object ) @cancel = true @button = true controller = new App.ControllerForm( - model: App[ @genericObject ] - params: @item - screen: @screen || 'edit' - autofocus: true + model: App[ @genericObject ] + params: @item + screen: @screen || 'edit' + autofocus: true ) @content = controller.form @@ -98,8 +98,8 @@ class App.ControllerGenericEdit extends App.ControllerModal class App.ControllerGenericIndex extends App.Controller events: - 'click [data-type=edit]': 'edit' - 'click [data-type=new]': 'new' + 'click [data-type = edit]': 'edit' + 'click [data-type = new]': 'new' constructor: -> super @@ -160,6 +160,7 @@ class App.ControllerGenericIndex extends App.Controller bindRow: events: 'click': @edit + container: @container }, @pageData.tableExtend ) @@ -177,6 +178,7 @@ class App.ControllerGenericIndex extends App.Controller id: item.id pageData: @pageData genericObject: @genericObject + container: @container ) new: (e) -> @@ -184,6 +186,7 @@ class App.ControllerGenericIndex extends App.Controller new App.ControllerGenericNew( pageData: @pageData genericObject: @genericObject + container: @container ) class App.ControllerGenericDestroyConfirm extends App.ControllerModal 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 5f7b632d9..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' }, @@ -235,13 +235,14 @@ class App.ControllerTable extends App.Controller # bind on delete dialog if data.model && destroy - table.delegate('[data-type="destroy"]', 'click', (e) -> + table.delegate('[data-type="destroy"]', 'click', (e) => e.stopPropagation() e.preventDefault() itemId = $(e.target).parents('tr').data('id') item = data.model.find(itemId) new App.ControllerGenericDestroyConfirm( - item: item + item: item + container: @container ) ) diff --git a/app/assets/javascripts/app/controllers/_channel/email.js.coffee b/app/assets/javascripts/app/controllers/_channel/email.js.coffee index 4cd598dbc..b2c9e7c53 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.js.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.js.coffee @@ -64,11 +64,16 @@ class App.ChannelEmailFilter extends App.Controller new: (e) => e.preventDefault() - new App.ChannelEmailFilterEdit( {} ) + new App.ChannelEmailFilterEdit( + container: @el.closest('.content') + ) edit: (id, e) => e.preventDefault() - new App.ChannelEmailFilterEdit( object: App.PostmasterFilter.find(id) ) + new App.ChannelEmailFilterEdit( + object: App.PostmasterFilter.find(id) + container: @el.closest('.content') + ) class App.ChannelEmailFilterEdit extends App.ControllerModal constructor: -> @@ -152,12 +157,17 @@ class App.ChannelEmailAddress extends App.Controller new: (e) => e.preventDefault() - new App.ChannelEmailAddressEdit( {} ) + new App.ChannelEmailAddressEdit( + container: @el.closest('.content') + ) edit: (id, e) => e.preventDefault() item = App.EmailAddress.find(id) - new App.ChannelEmailAddressEdit( object: item ) + new App.ChannelEmailAddressEdit( + object: item + container: @el.closest('.content') + ) class App.ChannelEmailAddressEdit extends App.ControllerModal constructor: -> @@ -238,12 +248,17 @@ class App.ChannelEmailSignature extends App.Controller new: (e) => e.preventDefault() - new App.ChannelEmailSignatureEdit( {} ) + new App.ChannelEmailSignatureEdit( + container: @el.closest('.content') + ) edit: (id, e) => e.preventDefault() item = App.Signature.find(id) - new App.ChannelEmailSignatureEdit( object: item ) + new App.ChannelEmailSignatureEdit( + object: item + container: @el.closest('.content') + ) class App.ChannelEmailSignatureEdit extends App.ControllerModal constructor: -> @@ -324,12 +339,17 @@ class App.ChannelEmailInbound extends App.Controller new: (e) => e.preventDefault() - new App.ChannelEmailInboundEdit( {} ) + new App.ChannelEmailInboundEdit( + container: @el.closest('.content') + ) edit: (id, e) => e.preventDefault() item = App.Channel.find(id) - new App.ChannelEmailInboundEdit( object: item ) + new App.ChannelEmailInboundEdit( + object: item + container: @el.closest('.content') + ) class App.ChannelEmailInboundEdit extends App.ControllerModal diff --git a/app/assets/javascripts/app/controllers/_default_navbar.js.coffee b/app/assets/javascripts/app/controllers/_default_navbar.js.coffee index 592d07938..54e43a773 100644 --- a/app/assets/javascripts/app/controllers/_default_navbar.js.coffee +++ b/app/assets/javascripts/app/controllers/_default_navbar.js.coffee @@ -2,9 +2,8 @@ App.Config.set( 'User', { prio: 1000, parent: '', callback: -> - item = {} - item['name'] = App.Session.get( 'login' ) - item['image'] = App.Session.get( 'imageUrl' ) + item = {} + item['name'] = App.Session.get( 'login' ) if App.Session.get() item['avatar'] = App.Session.get().avatar() return item diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee index 387657240..4f88bc5f1 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee @@ -473,8 +473,8 @@ class Sidebar extends App.Controller ) new App.WidgetUser( - el: el - user_id: user.id + el: el + user_id: user.id ) editCustomer = (e, el) => @@ -483,9 +483,10 @@ class Sidebar extends App.Controller genericObject: 'User' screen: 'edit' pageData: - title: 'Users' - object: 'User' + title: 'Users' + object: 'User' objects: 'Users' + container: @el.closest('.content') ) items.push { head: 'Customer' @@ -493,9 +494,9 @@ class Sidebar extends App.Controller icon: 'person' actions: [ { - title: 'Edit Customer' - name: 'Edit Customer' - class: 'glyphicon glyphicon-edit' + title: 'Edit Customer' + name: 'Edit Customer' + class: 'glyphicon glyphicon-edit' callback: editCustomer }, ] @@ -508,14 +509,15 @@ class Sidebar extends App.Controller id: user.organization_id genericObject: 'Organization' pageData: - title: 'Organizations' - object: 'Organization' + title: 'Organizations' + object: 'Organization' objects: 'Organizations' + container: @el.closest('.content') ) showOrganization = (el) => new App.WidgetOrganization( - el: el - organization_id: user.organization_id + el: el + organization_id: user.organization_id ) items.push { head: 'Organization' @@ -523,6 +525,7 @@ class Sidebar extends App.Controller icon: 'group' actions: [ { + title: 'Edit Organization' name: 'Edit Organization' class: 'glyphicon glyphicon-edit' callback: editOrganization diff --git a/app/assets/javascripts/app/controllers/groups.js.coffee b/app/assets/javascripts/app/controllers/groups.js.coffee index 4bf2ad3e8..c3fd370ec 100644 --- a/app/assets/javascripts/app/controllers/groups.js.coffee +++ b/app/assets/javascripts/app/controllers/groups.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Group', - pageData: { - title: 'Groups', - home: 'groups', - object: 'Group', - objects: 'Groups', - navupdate: '#groups', - notes: [ + el: @el + id: @id + genericObject: 'Group' + pageData: + title: 'Groups' + home: 'groups' + object: 'Group' + objects: 'Groups' + navupdate: '#groups' + notes: [ 'Groups are ...' - ], + ] buttons: [ { name: 'New Group', 'data-type': 'new', class: 'btn--success' }, - ], - }, + ] + container: @el.closest('.content') ) App.Config.set( 'Group', { prio: 1500, name: 'Groups', parent: '#manage', target: '#manage/groups', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/maintenance.js.coffee b/app/assets/javascripts/app/controllers/maintenance.js.coffee index 4dcedcfd8..f5804b1c2 100644 --- a/app/assets/javascripts/app/controllers/maintenance.js.coffee +++ b/app/assets/javascripts/app/controllers/maintenance.js.coffee @@ -15,11 +15,11 @@ class Index extends App.ControllerContent e.preventDefault() params = @formParam(e.target) App.Event.trigger( - 'ws:send' - action: 'broadcast' - event: 'session:maintenance' - spool: false - data: params + 'ws:send' + action: 'broadcast' + event: 'session:maintenance' + spool: false + data: params ) @notify type: 'success' 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/controllers/object_manager.js.coffee b/app/assets/javascripts/app/controllers/object_manager.js.coffee index 496ab320c..3d5f9c74f 100644 --- a/app/assets/javascripts/app/controllers/object_manager.js.coffee +++ b/app/assets/javascripts/app/controllers/object_manager.js.coffee @@ -7,10 +7,10 @@ class Index extends App.ControllerTabs # get data @ajax( - id: 'object_manager_attributes_list', - type: 'GET', - url: @apiPath + '/object_manager_attributes_list', - processData: true, + id: 'object_manager_attributes_list' + type: 'GET' + url: @apiPath + '/object_manager_attributes_list' + processData: true success: (data, status, xhr) => @build(data.objects) ) @@ -19,9 +19,9 @@ class Index extends App.ControllerTabs @tabs = [] for object in objects item = - name: object, - target: "c-#{object}", - controller: Items, + name: object + target: "c-#{object}" + controller: Items params: object: object @tabs.push item @@ -120,18 +120,19 @@ class Items extends App.ControllerContent objects: 'ObjectManagerAttributes' navupdate: '#object_manager' genericObject: 'ObjectManagerAttribute' + container: @el.closest('.content') ) edit: (e) => e.preventDefault() id = $( e.target ).closest('tr').data('id') new Edit( - pageData: { + pageData: object: 'ObjectManagerAttribute' - }, genericObject: 'ObjectManagerAttribute' - callback: @render + callback: @render id: id + container: @el.closest('.content') ) destroy: (e) -> @@ -158,7 +159,6 @@ class Edit extends App.ControllerModal items: [] ) ) - item = App.ObjectManagerAttribute.find(@id) options = @@ -249,9 +249,8 @@ class Edit extends App.ControllerModal @content.find('[name=data_type]').trigger('change') - configureAttributesBottom = [ - { name: 'active', display: 'Active', tag: 'boolean', 'default': true, 'null': false }, + { name: 'active', display: 'Active', tag: 'active', default: true }, ] controller = new App.ControllerForm( model: { configure_attributes: configureAttributesBottom, className: '' }, @@ -263,8 +262,6 @@ class Edit extends App.ControllerModal #@content = controller.form - - #@show(content) @show() diff --git a/app/assets/javascripts/app/controllers/organization_history.js.coffee b/app/assets/javascripts/app/controllers/organization_history.js.coffee index a88953a15..96770b540 100644 --- a/app/assets/javascripts/app/controllers/organization_history.js.coffee +++ b/app/assets/javascripts/app/controllers/organization_history.js.coffee @@ -7,9 +7,9 @@ class App.OrganizationHistory extends App.GenericHistory # get data @ajax( - id: 'organization_history', - type: 'GET', - url: @apiPath + '/organizations/history/' + @organization_id, + id: 'organization_history' + type: 'GET' + url: @apiPath + '/organizations/history/' + @organization_id success: (data, status, xhr) => # load assets diff --git a/app/assets/javascripts/app/controllers/organization_profile.js.coffee b/app/assets/javascripts/app/controllers/organization_profile.js.coffee index 53a45b807..f455e21ba 100644 --- a/app/assets/javascripts/app/controllers/organization_profile.js.coffee +++ b/app/assets/javascripts/app/controllers/organization_profile.js.coffee @@ -1,7 +1,4 @@ class App.OrganizationProfile extends App.Controller - events: - 'focusout [contenteditable]': 'update' - constructor: (params) -> super @@ -12,11 +9,8 @@ class App.OrganizationProfile extends App.Controller @navupdate '#' - # subscribe and reload data / fetch new data if triggered - @subscribeId = App.Organization.full( @organization_id, @render, false, true ) - - release: => - App.Organization.unsubscribe(@subscribeId) + # fetch new data if needed + App.Organization.full( @organization_id, @render ) meta: => meta = @@ -48,6 +42,39 @@ class App.OrganizationProfile extends App.Controller @doNotLog = 1 @recentView( 'Organization', @organization_id ) + @html App.view('organization_profile/index')( + organization: organization + ) + + new Object( + el: @$('.js-object-container') + organization: organization + ) + + new App.TicketStats( + el: @$('.js-ticket-stats') + organization: organization + ) + + new App.UpdateTastbar( + genericObject: organization + ) + +class Object extends App.Controller + events: + 'focusout [contenteditable]': 'update' + + constructor: (params) -> + super + + # subscribe and reload data / fetch new data if triggered + @subscribeId = App.Organization.full( @organization.id, @render, false, true ) + + release: => + App.Organization.unsubscribe(@subscribeId) + + render: (organization) => + # get display data organizationData = [] for attributeName, attributeConfig of App.Organization.attributesGet('view') @@ -65,7 +92,7 @@ class App.OrganizationProfile extends App.Controller if name isnt 'name' organizationData.push attributeConfig - @html App.view('organization_profile')( + @html App.view('organization_profile/object')( organization: organization organizationData: organizationData ) @@ -76,15 +103,6 @@ class App.OrganizationProfile extends App.Controller maxlength: 250 }) - new App.TicketStats( - el: @$('.js-ticket-stats') - organization: organization - ) - - new App.UpdateTastbar( - genericObject: organization - ) - # start action controller showHistory = => new App.OrganizationHistory( organization_id: organization.id ) @@ -97,6 +115,7 @@ class App.OrganizationProfile extends App.Controller title: 'Organizations' object: 'Organization' objects: 'Organizations' + container: @el.closest('.content') ) actions = [ @@ -120,13 +139,14 @@ class App.OrganizationProfile extends App.Controller update: (e) => name = $(e.target).attr('data-name') value = $(e.target).html() - org = App.Organization.find( @organization_id ) + org = App.Organization.find( @organization.id ) if org[name] isnt value data = {} data[name] = value org.updateAttributes( data ) @log 'notice', 'update', name, value, org + class Router extends App.ControllerPermanent constructor: (params) -> super diff --git a/app/assets/javascripts/app/controllers/organizations.js.coffee b/app/assets/javascripts/app/controllers/organizations.js.coffee index 11648b712..81975f653 100644 --- a/app/assets/javascripts/app/controllers/organizations.js.coffee +++ b/app/assets/javascripts/app/controllers/organizations.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Organization', - pageData: { - title: 'Organizations', - home: 'organizations', - object: 'Organization', - objects: 'Organizations', - navupdate: '#organizations', + el: @el + id: @id + genericObject: 'Organization' + pageData: + title: 'Organizations' + home: 'organizations' + object: 'Organization' + objects: 'Organizations' + navupdate: '#organizations' notes: [ 'Organizations are for any person in the system. Agents (Owners, Resposbiles, ...) and Customers.' - ], + ] buttons: [ - { name: 'New Organization', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New Organization', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Organization', { prio: 2000, name: 'Organizations', parent: '#manage', target: '#manage/organizations', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/overview.js.coffee b/app/assets/javascripts/app/controllers/overview.js.coffee index a4af2d849..f65589a26 100644 --- a/app/assets/javascripts/app/controllers/overview.js.coffee +++ b/app/assets/javascripts/app/controllers/overview.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Overview', - pageData: { - title: 'Overviews', - home: 'overviews', - object: 'Overview', - objects: 'Overviews', - navupdate: '#overviews', + el: @el + id: @id + genericObject: 'Overview' + pageData: + title: 'Overviews' + home: 'overviews' + object: 'Overview' + objects: 'Overviews' + navupdate: '#overviews' notes: [ 'Overview are ...' - ], + ] buttons: [ - { name: 'New Overview', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New Overview', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Overview', { prio: 2300, name: 'Overviews', parent: '#manage', target: '#manage/overviews', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/scheduler.js.coffee b/app/assets/javascripts/app/controllers/scheduler.js.coffee index 4b378f314..8ec53f30d 100644 --- a/app/assets/javascripts/app/controllers/scheduler.js.coffee +++ b/app/assets/javascripts/app/controllers/scheduler.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Job', - pageData: { - title: 'Schedulers', - home: 'schedulers', - object: 'Scheduler', - objects: 'Schedulers', - navupdate: '#schedulers', + el: @el + id: @id + genericObject: 'Job' + pageData: + title: 'Schedulers' + home: 'schedulers' + object: 'Scheduler' + objects: 'Schedulers' + navupdate: '#schedulers' notes: [ 'Scheduler are ...' - ], + ] buttons: [ - { name: 'New Scheduler', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New Scheduler', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Scheduler', { prio: 3000, name: 'Schedulers', parent: '#manage', target: '#manage/schedulers', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/sla.js.coffee b/app/assets/javascripts/app/controllers/sla.js.coffee index 8567b6e49..ca0ea6ba5 100644 --- a/app/assets/javascripts/app/controllers/sla.js.coffee +++ b/app/assets/javascripts/app/controllers/sla.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'Sla', - pageData: { - title: 'SLA', - home: 'slas', - object: 'SLA', - objects: 'SLAs', - navupdate: '#slas', + el: @el + id: @id + genericObject: 'Sla' + pageData: + title: 'SLA' + home: 'slas' + object: 'SLA' + objects: 'SLAs' + navupdate: '#slas' notes: [ # 'SLA are ...' - ], + ] buttons: [ - { name: 'New SLA', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New SLA', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'Sla', { prio: 2900, name: 'SLAs', parent: '#manage', target: '#manage/slas', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/text_module.js.coffee b/app/assets/javascripts/app/controllers/text_module.js.coffee index 687d8b4ac..22e37abb1 100644 --- a/app/assets/javascripts/app/controllers/text_module.js.coffee +++ b/app/assets/javascripts/app/controllers/text_module.js.coffee @@ -6,22 +6,22 @@ class Index extends App.ControllerContent return if !@authenticate() new App.ControllerGenericIndex( - el: @el, - id: @id, - genericObject: 'TextModule', - pageData: { - title: 'TextModules', - home: 'text_modules', - object: 'TextModule', - objects: 'TextModules', - navupdate: '#text_modules', + el: @el + id: @id + genericObject: 'TextModule' + pageData: + title: 'TextModules' + home: 'text_modules' + object: 'TextModule' + objects: 'TextModules' + navupdate: '#text_modules' notes: [ 'TextModules are ...' - ], + ] buttons: [ - { name: 'New TextModule', 'data-type': 'new', class: 'btn--success' }, - ], - }, + { name: 'New TextModule', 'data-type': 'new', class: 'btn--success' } + ] + container: @el.closest('.content') ) App.Config.set( 'TextModule', { prio: 2300, name: 'TextModules', parent: '#manage', target: '#manage/text_modules', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index 68247f680..32c7a256d 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -482,7 +482,7 @@ class Table extends App.ControllerContent new App.OverviewSettings( overview_id: @overview.id view_mode: @view_mode - container: @el + container: @el.closest('.content') ) class App.OverviewSettings extends App.ControllerModal diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index 5b9871a43..7e65572d6 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -124,17 +124,27 @@ class App.TicketZoom extends App.Controller @doNotLog = 1 @recentView( 'Ticket', ticket_id ) - error: (xhr, status, error) => + error: (xhr) => + statusText = xhr.statusText + status = xhr.status + detail = xhr.responseText + #console.log('error', status, statusText) - # do not close window if request is aborted - return if status is 'abort' + # ignore if request is aborted + if statusText is 'abort' + return + + # if ticket is already loaded, ignore status "0" - network issues e. g. temp. not connection + if @ticketUpdatedAtLastCall && status is 0 + console.log('network issues e. g. temp. not connection', status, statusText, detail) + return # show error message - if xhr.status is 401 || error is 'Unauthorized' + if status is 401 || statusText is 'Unauthorized' @taskHead = '» ' + App.i18n.translateInline('Unauthorized') + ' «' @taskIconClass = 'error' @html App.view('generic/error/unauthorized')( objectName: 'Ticket' ) - else if xhr.status is 404 || error is 'Not Found' + else if status is 404 || statusText is 'Not Found' @taskHead = '» ' + App.i18n.translateInline('Not Found') + ' «' @taskIconClass = 'error' @html App.view('generic/error/not_found')( objectName: 'Ticket' ) @@ -142,9 +152,7 @@ class App.TicketZoom extends App.Controller @taskHead = '» ' + App.i18n.translateInline('Error') + ' «' @taskIconClass = 'error' - status = xhr.status - detail = xhr.responseText - if !status && !detail + if !detail detail = 'General communication error, maybe internet is not available!' @html App.view('generic/error/generic')( status: status @@ -321,21 +329,26 @@ class App.TicketZoom extends App.Controller ) showTicketHistory = => - new App.TicketHistory( ticket_id: @ticket.id ) + new App.TicketHistory( + ticket_id: @ticket.id + container: @el.closest('.content') + ) showTicketMerge = => - new App.TicketMerge - ticket: @ticket - task_key: @task_key - container: @el + new App.TicketMerge( + ticket: @ticket + task_key: @task_key + container: @el.closest('.content') + ) changeCustomer = (e, el) => new App.TicketCustomer( - ticket: @ticket + ticket: @ticket + container: @el.closest('.content') ) items = [ { - head: 'Ticket' - name: 'ticket' - icon: 'message' + head: 'Ticket' + name: 'ticket' + icon: 'message' callback: editTicket } ] @@ -367,6 +380,7 @@ class App.TicketZoom extends App.Controller title: 'Users' object: 'User' objects: 'Users' + container: @el.closest('.content') ) showCustomer = (el) => new App.WidgetUser( @@ -374,9 +388,9 @@ class App.TicketZoom extends App.Controller user_id: @ticket.customer_id ) items.push { - head: 'Customer' - name: 'customer' - icon: 'person' + head: 'Customer' + name: 'customer' + icon: 'person' actions: [ { title: 'Change Customer' @@ -400,6 +414,7 @@ class App.TicketZoom extends App.Controller title: 'Organizations' object: 'Organization' objects: 'Organizations' + container: @el.closest('.content') ) showOrganization = (el) => new App.WidgetOrganization( @@ -421,8 +436,8 @@ class App.TicketZoom extends App.Controller } new App.Sidebar( - el: @el.find('.tabsSidebar') - items: items + el: @el.find('.tabsSidebar') + items: items ) # show article diff --git a/app/assets/javascripts/app/controllers/user_profile.js.coffee b/app/assets/javascripts/app/controllers/user_profile.js.coffee index 28b1898b3..3db91782a 100644 --- a/app/assets/javascripts/app/controllers/user_profile.js.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.js.coffee @@ -1,7 +1,4 @@ class App.UserProfile extends App.Controller - events: - 'focusout [contenteditable]': 'update' - constructor: (params) -> super @@ -12,8 +9,8 @@ class App.UserProfile extends App.Controller @navupdate '#' - # subscribe and reload data / fetch new data if triggered - @subscribeId = App.User.full( @user_id, @render, false, true ) + # fetch new data if needed + @subscribeId = App.User.full( @user_id, @render ) release: => App.User.unsubscribe(@subscribeId) @@ -47,6 +44,40 @@ class App.UserProfile extends App.Controller @doNotLog = 1 @recentView( 'User', @user_id ) + @html App.view('user_profile/index')( + user: user + ) + + new Object( + el: @$('.js-object-container') + user: user + ) + + new App.TicketStats( + el: @$('.js-ticket-stats') + user: user + ) + + new App.UpdateTastbar( + genericObject: user + ) + + +class Object extends App.Controller + events: + 'focusout [contenteditable]': 'update' + + constructor: (params) -> + super + + # subscribe and reload data / fetch new data if triggered + @subscribeId = App.User.full( @user.id, @render, false, true ) + + release: => + App.User.unsubscribe(@subscribeId) + + render: (user) => + # get display data userData = [] for attributeName, attributeConfig of App.User.attributesGet('view') @@ -64,7 +95,7 @@ class App.UserProfile extends App.Controller if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization' userData.push attributeConfig - @html App.view('user_profile')( + @html App.view('user_profile/object')( user: user userData: userData ) @@ -75,15 +106,6 @@ class App.UserProfile extends App.Controller maxlength: 250 }) - new App.TicketStats( - el: @$('.js-ticket-stats') - user: user - ) - - new App.UpdateTastbar( - genericObject: user - ) - # start action controller showHistory = => new App.UserHistory( user_id: user.id ) @@ -97,6 +119,7 @@ class App.UserProfile extends App.Controller title: 'Users' object: 'User' objects: 'Users' + container: @el.closest('.content') ) actions = [ @@ -120,7 +143,7 @@ class App.UserProfile extends App.Controller update: (e) => name = $(e.target).attr('data-name') value = $(e.target).html() - user = App.User.find( @user_id ) + user = App.User.find( @user.id ) if user[name] isnt value data = {} data[name] = value diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index f628c4e61..5cb31e6a4 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -10,29 +10,117 @@ #= 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 + isHtmlEscape = false + if attribute_config.tag is 'textarea' + isHtmlEscape = true + result = App.Utils.text2html( result ) + + # remember, html snippets are already escaped + else if attribute_config.tag is 'richtext' + isHtmlEscape = true + + # fillup options + if !_.isEmpty(attribute_config.options) + if attribute_config.options[result] + result = attribute_config.options[result] + + # translate content + if attribute_config.translate || ( isObject && item.translate && item.translate() ) + isHtmlEscape = true + result = App.i18n.translateContent( result ) + + # transform date + if attribute_config.tag is 'date' + isHtmlEscape = true + result = App.i18n.translateDate(result) + + # use pretty time for datetime + else if attribute_config.tag is 'datetime' + isHtmlEscape = true + result = "?" + #result = App.i18n.translateTimestamp(result) + + if !isHtmlEscape && 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/lib/app_post/browser.coffee b/app/assets/javascripts/app/lib/app_post/browser.coffee index 1afa1b2c2..d9dc3304b 100644 --- a/app/assets/javascripts/app/lib/app_post/browser.coffee +++ b/app/assets/javascripts/app/lib/app_post/browser.coffee @@ -30,7 +30,7 @@ class App.Browser # define min. required browser version map = Chrome2: 37 - Firefox: 28 + Firefox: 31 Explorer: 10 Safari: 6 Opera: 22 diff --git a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee index a5c9a98b7..4c13dc901 100644 --- a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee @@ -276,7 +276,8 @@ class App.UserOrganizationAutocompletion extends App.Controller if e e.preventDefault() new UserNew( - parent: @ + parent: @ + container: @el.closest('.content') ) class UserNew extends App.ControllerModal diff --git a/app/assets/javascripts/app/models/email_address.js.coffee b/app/assets/javascripts/app/models/email_address.js.coffee index 0a85fa3d0..3da7514b5 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: 'active', default: true }, ] @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..b7dee1d74 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: 'active', default: true }, ] @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..a2842637b 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: 'active', default: true }, { 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..17140fdb9 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: 'active', default: true }, ] 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..048808183 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: '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: '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: 'active', default: true }, + { 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..14c7b3a2b 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: 'active', default: true, 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..7e699df40 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: 'active', default: true }, + { 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..36a88110b 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: 'active', default: true }, + { 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..a78a6c103 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: 'active', default: true }, + { 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..88023f79e 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: 'active', default: true }, + { 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..edd3de234 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: 'active', default: true }, + { 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..e43e68315 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 }, + { name: 'keywords', display: 'Keywords', tag: 'input', type: 'text', limit: 100, null: true }, + { name: 'content', display: 'Content', tag: 'textarea', limit: 250, null: false }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, + { name: 'active', display: 'Active', tag: 'active', default: true }, ] @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..413cd55b9 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: 'active', default: true }, + { 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..5e3ab39fb 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: 'active', default: true }, + { 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 dc5911e21..16b0fa3a0 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: 'active', default: true }, + { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, ] @configure_overview = [ # 'login', 'firstname', 'lastname', 'email', 'updated_at', @@ -52,21 +52,21 @@ class App.User extends App.Model else return '??' - avatar: (size = 40, placement = '', cssClass = '') -> - cssClass += " size-#{ size }" + avatar: (size = 40, placement = '', cssClass = '', unique = false, avatar) -> + cssClass += " size-#{size}" if placement placement = "data-placement=\"#{placement}\"" - if !@image || @image is 'none' - return @uniqueAvatar(size, placement, cssClass) + if !@image || @image is 'none' || unique + return @uniqueAvatar(size, placement, cssClass, avatar) else - "" - - uniqueAvatar: (size = 40, placement = '', cssClass = '', avatar) -> - if size - cssClass += " size-#{ size }" + if @vip + cssClass += " vip" + image = @imageUrl() + "" + uniqueAvatar: (size, placement = '', cssClass = '', avatar) -> width = 300 height = 226 size = parseInt(size, 10) @@ -76,12 +76,21 @@ class App.User extends App.Model y = rng() * (height - size) if !avatar - cssClass += "#{cssClass} user-popover" + cssClass += " user-popover" data = "data-id=\"#{@id}\"" else data = "data-avatar-id=\"#{avatar.id}\"" + + if @vip + cssClass += " vip" "#{ @initials() }" + imageUrl: -> + return if !@image + # set image url + @constructor.apiPath + '/users/image/' + @image + + @_fillUp: (data) -> # set socal media links @@ -92,9 +101,6 @@ class App.User extends App.Model if account == 'facebook' data['accounts'][account]['link'] = 'https://www.facebook.com/profile.php?id=' + data['accounts'][account]['uid'] - # set image url - data.imageUrl = @apiPath + '/users/image/' + data.image - if data.organization_id data.organization = App.Organization.find(data.organization_id) 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..7130d2afa 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 @@ -11,30 +11,30 @@ - +

<%= 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/layout_ref/communication_overview.jst.eco b/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco index 4428daa32..6e06ac127 100644 --- a/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco @@ -243,6 +243,10 @@ Oliver
something with very long line which is slonger as the container arount it if you can see it I wish you a very happy day.txt
17.1 kb
+
+
something-withverylonglinewhichisslongerasthecontainerarountitifyoucanseeitIwishyouaveryhappyday.txt
+
17.1 kb
+
diff --git a/app/assets/javascripts/app/views/organization_profile.jst.eco b/app/assets/javascripts/app/views/organization_profile.jst.eco deleted file mode 100644 index bec092e1b..000000000 --- a/app/assets/javascripts/app/views/organization_profile.jst.eco +++ /dev/null @@ -1,50 +0,0 @@ -
- -
-
-
-
-
-
-

<%= @organization.displayName() %>

-
-
-
- <% for row in @organizationData: %> - <% if @organization[row.name]: %> - <% if row.tag is 'richtext': %> -
- -
<%- @organization[row.name] %>
-
- <% else: %> -
- - <%- @L( @P( @organization[row.name] ) ) %> -
- <% end %> - <% end %> - <% end %> -
-
- - <% if @organization.members: %> -
- -
- - <% for user in @organization.members: %> -
- <%- user.avatar("40") %> - <%= user.displayName() %> -
- <% end %> - -
-
- <% end %> - -
- -
-
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/organization_profile/index.jst.eco b/app/assets/javascripts/app/views/organization_profile/index.jst.eco new file mode 100644 index 000000000..97263221b --- /dev/null +++ b/app/assets/javascripts/app/views/organization_profile/index.jst.eco @@ -0,0 +1,6 @@ +
+
+
+
+
+
\ 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 new file mode 100644 index 000000000..738410c25 --- /dev/null +++ b/app/assets/javascripts/app/views/organization_profile/object.jst.eco @@ -0,0 +1,39 @@ +
+
+
+
+
+

<%= @organization.displayName() %>

+
+
+
+ <% for row in @organizationData: %> + <% if row.tag is 'richtext': %> +
+ +
<%- @organization[row.name] %>
+
+ <% else: %> + <% if @organization[row.name]: %> +
+ + <%- @P( @organization, row.name ) %> +
+ <% end %> + <% end %> + <% end %> +
+
+<% if @organization.members: %> +
+ +
+ <% for user in @organization.members: %> +
+ <%- user.avatar("40") %> + <%= user.displayName() %> +
+ <% end %> +
+
+<% end %> \ No newline at end of file diff --git a/app/assets/javascripts/app/views/popover/organization.jst.eco b/app/assets/javascripts/app/views/popover/organization.jst.eco index 6301dc391..1a25b08b5 100644 --- a/app/assets/javascripts/app/views/popover/organization.jst.eco +++ b/app/assets/javascripts/app/views/popover/organization.jst.eco @@ -1,24 +1,19 @@
-
<% for row in @organizationData: %> <% 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 %>
<% if @organization.members: %>
-

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

- <% for user in @organization.members: %> -
- <%= user.displayName() %> +
+ + <% for user in @organization.members: %> +
<%= user.displayName() %>
+ <% end %>
- <% 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..0e5d3aea2 100644 --- a/app/assets/javascripts/app/views/popover/ticket.jst.eco +++ b/app/assets/javascripts/app/views/popover/ticket.jst.eco @@ -2,36 +2,40 @@ <%- @ticket.iconTitle() %>

-

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

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

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

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

-

#

-
<%- @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..565648c1e 100644 --- a/app/assets/javascripts/app/views/popover/user.jst.eco +++ b/app/assets/javascripts/app/views/popover/user.jst.eco @@ -5,19 +5,15 @@
<% for row in @userData: %> <% 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 %> <% if !_.isEmpty(@user['accounts']): %> -
-

<%- @T( 'Linked Accounts' ) %>

+
+ <% for account of @user['accounts']: %> <%= account %> <% end %> @@ -25,8 +21,8 @@ <% end %> <% if !_.isEmpty( @user['links'] ): %> <% for link in @user['links']: %> -
-

<%- @T( link['title'] ) %>

+
+ <% for item in link['items']: %> <% if item['url']: %> target="_blank"<% 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..0d7388eeb 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,8 @@ +
    <% for ticket in @tickets: %> -
    T:<%= ticket.number %> <%= ticket.humanTime %>
    <%= ticket.title %>
    +
  • + T:<%= ticket.number %> <%- @P( ticket, 'title') %>
    + <%- @T('Created') %> <%- @P( ticket, 'created_at') %> +
  • <% end %> +
      \ No newline at end of file diff --git a/app/assets/javascripts/app/views/profile/avatar.jst.eco b/app/assets/javascripts/app/views/profile/avatar.jst.eco index 3f7637e20..cb060495f 100644 --- a/app/assets/javascripts/app/views/profile/avatar.jst.eco +++ b/app/assets/javascripts/app/views/profile/avatar.jst.eco @@ -17,7 +17,7 @@ <% if avatar.default: %> <% cssClass = 'is-active' %> <% end %> - <%- App.Session.get().uniqueAvatar('50', '', cssClass, avatar) %> + <%- App.Session.get().avatar('50', '', cssClass, true, avatar) %> <% else: %> <% if avatar.deletable: %> diff --git a/app/assets/javascripts/app/views/ticket_zoom/title.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/title.jst.eco index a99521406..d28ebe8fa 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/title.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/title.jst.eco @@ -1 +1 @@ -

      <%= @P( @ticket.title ) %>

      \ No newline at end of file +
      <%= @ticket.title %>
      \ No newline at end of file diff --git a/app/assets/javascripts/app/views/user_profile.jst.eco b/app/assets/javascripts/app/views/user_profile.jst.eco deleted file mode 100644 index 839f1622d..000000000 --- a/app/assets/javascripts/app/views/user_profile.jst.eco +++ /dev/null @@ -1,37 +0,0 @@ -
      - -
      -
      -
      - <%- @user.avatar("80") %> -

      <%= @user.displayName() %>

      - <% if @user.organization: %> - - <% end %> -
      - -
      -
      - <% for row in @userData: %> - <% if @user[row.name]: %> - <% if row.tag is 'richtext': %> -
      - -
      <%- @user[row.name] %>
      -
      - <% else: %> -
      - - <%- @L( @P( @user[row.name] ) ) %> -
      - <% end %> - <% end %> - <% end %> -
      -
      - -
      - -
      - -
      \ No newline at end of file diff --git a/app/assets/javascripts/app/views/user_profile/index.jst.eco b/app/assets/javascripts/app/views/user_profile/index.jst.eco new file mode 100644 index 000000000..97263221b --- /dev/null +++ b/app/assets/javascripts/app/views/user_profile/index.jst.eco @@ -0,0 +1,6 @@ +
      +
      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/assets/javascripts/app/views/user_profile/object.jst.eco b/app/assets/javascripts/app/views/user_profile/object.jst.eco new file mode 100644 index 000000000..11dd720bd --- /dev/null +++ b/app/assets/javascripts/app/views/user_profile/object.jst.eco @@ -0,0 +1,27 @@ +
      +
      + <%- @user.avatar("80") %> +

      <%= @user.displayName() %>

      + <% if @user.organization: %> + + <% end %> +
      +
      +
      + <% for row in @userData: %> + <% if row.tag is 'richtext': %> +
      + +
      <%- @user[row.name] %>
      +
      + <% else: %> + <% if @user[row.name]: %> +
      + + <%- @P( @user, row.name ) %> +
      + <% end %> + <% end %> + <% end %> +
      +
      \ No newline at end of file diff --git a/app/assets/javascripts/app/views/widget/organization.jst.eco b/app/assets/javascripts/app/views/widget/organization.jst.eco index 073832c20..4093af271 100644 --- a/app/assets/javascripts/app/views/widget/organization.jst.eco +++ b/app/assets/javascripts/app/views/widget/organization.jst.eco @@ -1,7 +1,8 @@ <% for row in @organizationData: %> @@ -9,7 +10,7 @@