From 19d4cb45593bf1cdd1f9b82742a24056bb89cd73 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 30 Sep 2015 11:47:06 +0200 Subject: [PATCH] Show icon / state title on every ticket and task overview. Also added meta info about "escalated" or "reminder reached" to icon title. --- .../app/controllers/ticket_overview.coffee | 2 +- .../app/controllers/ticket_zoom.coffee | 1 + .../app/controllers/widget/ticket_list.coffee | 2 +- app/assets/javascripts/app/models/ticket.coffee | 16 ++++++++++++++-- .../javascripts/app/views/popover/ticket.jst.eco | 2 +- .../app/views/popover/user_ticket_list.jst.eco | 2 +- .../app/views/task_widget_tasks.jst.eco | 2 +- .../app/views/widget/ticket_stats_list.jst.eco | 2 +- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index dcd2d3b47..203325128 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -290,7 +290,7 @@ class Table extends App.Controller value = ' ' attribute.class = object.iconClass() attribute.link = '' - attribute.title = App.i18n.translateInline( object.iconTitle() ) + attribute.title = object.iconTitle() value new App.ControllerTable( diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index 940e956dc..def756f91 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -82,6 +82,7 @@ class App.TicketZoom extends App.Controller meta.title = '#' + @ticket.number + ' - ' + @ticket.title meta.class = "task-state-#{ @ticket.getState() }" meta.type = 'task' + meta.iconTitle = @ticket.iconTitle() meta.iconClass = @ticket.iconClass() meta diff --git a/app/assets/javascripts/app/controllers/widget/ticket_list.coffee b/app/assets/javascripts/app/controllers/widget/ticket_list.coffee index 1e8dd5e2f..616f4b978 100644 --- a/app/assets/javascripts/app/controllers/widget/ticket_list.coffee +++ b/app/assets/javascripts/app/controllers/widget/ticket_list.coffee @@ -33,7 +33,7 @@ class App.TicketList extends App.Controller value = ' ' attribute.class = object.iconClass() attribute.link = '' - attribute.title = App.i18n.translateInline( object.iconTitle() ) + attribute.title = object.iconTitle() value list = [] diff --git a/app/assets/javascripts/app/models/ticket.coffee b/app/assets/javascripts/app/models/ticket.coffee index 03dbfc6b5..f7381b11e 100644 --- a/app/assets/javascripts/app/models/ticket.coffee +++ b/app/assets/javascripts/app/models/ticket.coffee @@ -38,7 +38,13 @@ class App.Ticket extends App.Model # if ticket is escalated, overwrite state if @escalation_time && new Date( Date.parse( @escalation_time ) ) < new Date state = 'escalating' - else if stateType.name is 'pending reminder' || stateType.name is 'pending action' + else if stateType.name is 'pending reminder' + state = 'pending' + + # if ticket pending_time is reached, overwrite state + if @pending_time && new Date( Date.parse( @pending_time ) ) < new Date + state = 'open' + else if stateType.name is 'pending action' state = 'pending' state @@ -49,7 +55,13 @@ class App.Ticket extends App.Model @getState() iconTitle: -> - App.TicketState.find( @state_id ).displayName() + type = App.TicketState.find( @state_id ) + stateType = App.TicketStateType.find( type.state_type_id ) + if stateType.name is 'pending reminder' && @pending_time && new Date( Date.parse( @pending_time ) ) < new Date + return "#{App.i18n.translateInline(type.displayName())} - #{App.i18n.translateInline('reached')}" + if @escalation_time && new Date( Date.parse( @escalation_time ) ) < new Date + return "#{App.i18n.translateInline(type.displayName())} - #{App.i18n.translateInline('escalated')}" + App.i18n.translateInline(type.displayName()) iconTextClass: -> "task-state-#{ @getState() }-color" diff --git a/app/assets/javascripts/app/views/popover/ticket.jst.eco b/app/assets/javascripts/app/views/popover/ticket.jst.eco index 1f4f6803f..23a0cdc10 100644 --- a/app/assets/javascripts/app/views/popover/ticket.jst.eco +++ b/app/assets/javascripts/app/views/popover/ticket.jst.eco @@ -1,5 +1,5 @@
- <%- @Icon(@ticket.icon(), @ticket.iconClass()) %> <%- @T(@ticket.iconTitle()) %> + <%- @Icon(@ticket.icon(), @ticket.iconClass()) %> <%- @ticket.iconTitle() %>

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 0993fe285..9216f53d1 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,7 +1,7 @@
    <% for ticket in @tickets: %>
  1. -
    +
    <%- @Icon('task-state', ticket.iconClass()) %>
  2. -
    +
    <%- @Icon('task-state', ticket.iconClass()) %>