diff --git a/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee index 8c6aafb9e..9f3c12835 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee @@ -49,10 +49,11 @@ class App.DashboardActivityStream extends App.Controller # lookup real data if App[item.object] - object = App[item.object].find( item.o_id ) - item.link = object.uiUrl() - item.title = object.displayName() - item.object_name = object.objectDisplayName() + object = App[item.object].find( item.o_id ) + item.link = object.uiUrl() + item.title = object.displayName() + item.object_name = object.objectDisplayName() + item.cssIcon = object.iconActivity( @Session.all() ) item.created_by = App.User.retrieve( item.created_by_id ) diff --git a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee index d91fb5691..049d119f1 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee @@ -112,22 +112,20 @@ class App.DashboardTicket extends App.Controller attribute.data = id: refObject.id value - callbackPriorityIconHeader = (header) -> + callbackIconHeader = (header) -> attribute = - name: 'priority_icon' + name: 'icon' display: '' translation: false style: 'width: 28px' header.unshift(0) header[0] = attribute header - callbackPriorityIcon = (value, object, attribute, header, refObject) -> + callbackIcon = (value, object, attribute, header, refObject) -> value = ' ' - attribute.class = 'priority icon' - if object && object.priority_id - attribute.class += " level-#{object.priority_id}" + attribute.class = object.icon() attribute.link = '' - attribute.title = App.i18n.translateInline( object.priority.displayName() ) + attribute.title = App.i18n.translateInline( object.iconTitle() ) value new App.ControllerTable( @@ -137,13 +135,13 @@ class App.DashboardTicket extends App.Controller objects: @tickets_in_table, checkbox: false groupBy: @overview.group_by - callbackHeader: callbackPriorityIconHeader + callbackHeader: callbackIconHeader bindRow: events: 'click': openTicket callbackAttributes: - priority_icon: - [ callbackPriorityIcon ] + icon: + [ callbackIcon ] customer_id: [ callbackResetLink, callbackUserPopover ] owner_id: diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index a6c5b620d..6704c498e 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -203,22 +203,20 @@ class Table extends App.ControllerContent @el.find('.bulk-action').addClass('hide') else @el.find('.bulk-action').removeClass('hide') - callbackPriorityIconHeader = (header) -> + callbackIconHeader = (header) -> attribute = - name: 'priority_icon' + name: 'icon' display: '' translation: false style: 'width: 28px' header.unshift(0) header[0] = attribute header - callbackPriorityIcon = (value, object, attribute, header, refObject) -> + callbackIcon = (value, object, attribute, header, refObject) -> value = ' ' - attribute.class = 'priority icon' - if object && object.priority_id - attribute.class += " level-#{object.priority_id}" + attribute.class = object.icon() attribute.link = '' - attribute.title = App.i18n.translateInline( object.priority.displayName() ) + attribute.title = App.i18n.translateInline( object.iconTitle() ) value new App.ControllerTable( @@ -235,10 +233,10 @@ class Table extends App.ControllerContent # customer_id: # events: # 'mouseover': popOver - callbackHeader: callbackPriorityIconHeader + callbackHeader: callbackIconHeader callbackAttributes: - priority_icon: - [ callbackPriorityIcon ] + icon: + [ callbackIcon ] customer_id: [ callbackUserPopover ] owner_id: diff --git a/app/assets/javascripts/app/models/_application_model.js.coffee b/app/assets/javascripts/app/models/_application_model.js.coffee index 89ea69074..15b6db98b 100644 --- a/app/assets/javascripts/app/models/_application_model.js.coffee +++ b/app/assets/javascripts/app/models/_application_model.js.coffee @@ -59,6 +59,15 @@ class App.Model extends Spine.Model return name return '???' + icon: (user) -> + '' + + iconTitle: (user) -> + '' + + iconActivity: (user) -> + '' + @validate: ( data = {} ) -> return if !data['model'].configure_attributes diff --git a/app/assets/javascripts/app/models/ticket.js.coffee b/app/assets/javascripts/app/models/ticket.js.coffee index ff3d9d030..8d18e8f37 100644 --- a/app/assets/javascripts/app/models/ticket.js.coffee +++ b/app/assets/javascripts/app/models/ticket.js.coffee @@ -26,3 +26,14 @@ class App.Ticket extends App.Model uiUrl: -> '#ticket/zoom/' + @id + + icon: (user) -> + "priority icon level-#{ @priority_id }" + + iconTitle: (user) -> + App.TicketPriority.find( @priority_id ).displayName() + + iconActivity: (user) -> + if @owner_id == user.id + return 'user' + 'group' \ No newline at end of file diff --git a/app/assets/javascripts/app/models/ticket_article.js.coffee b/app/assets/javascripts/app/models/ticket_article.js.coffee index 01a7e7621..c4dd6a50a 100644 --- a/app/assets/javascripts/app/models/ticket_article.js.coffee +++ b/app/assets/javascripts/app/models/ticket_article.js.coffee @@ -31,4 +31,10 @@ class App.TicketArticle extends App.Model ticket = App.Ticket.find( @ticket_id ) if ticket return ticket.title - '???' \ No newline at end of file + '???' + + iconActivity: (user) -> + ticket = App.Ticket.find(@ticket_id) + if ticket.owner_id == user.id + return 'user' + 'group' \ No newline at end of file diff --git a/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco b/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco index 56283d4c6..f2039f69a 100644 --- a/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco +++ b/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco @@ -1,6 +1,6 @@