diff --git a/app/assets/javascripts/app/controllers/_application_controller/_base.coffee b/app/assets/javascripts/app/controllers/_application_controller/_base.coffee index 153830caa..39c58dc92 100644 --- a/app/assets/javascripts/app/controllers/_application_controller/_base.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller/_base.coffee @@ -309,7 +309,8 @@ class App.Controller extends Spine.Controller if item.attr('timezone') newTitle += ' ' + item.attr('timezone') - item.attr('title', newTitle) + if !item.hasClass('noTitle') + item.attr('title', newTitle) item.html(time) recentView: (object, o_id) => diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/meta.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/meta.coffee index 8c50fa54f..22c08d7e6 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/meta.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/meta.coffee @@ -1,4 +1,7 @@ class App.TicketZoomMeta extends App.ControllerObserver + @extend App.PopoverProvidable + @registerPopovers 'Escalation' + model: 'Ticket' observe: number: true @@ -10,3 +13,4 @@ class App.TicketZoomMeta extends App.ControllerObserver ticket: ticket isCustomer: ticket.currentView() is 'customer' ) + @renderPopovers() diff --git a/app/assets/javascripts/app/lib/app_post/popover_provider/escalation_popover_provider.coffee b/app/assets/javascripts/app/lib/app_post/popover_provider/escalation_popover_provider.coffee new file mode 100644 index 000000000..99ce74dfa --- /dev/null +++ b/app/assets/javascripts/app/lib/app_post/popover_provider/escalation_popover_provider.coffee @@ -0,0 +1,18 @@ +class Escalation extends App.SingleObjectPopoverProvider + @klass = App.Ticket + @selectorCssClassPrefix = 'escalation' + @templateName = 'escalation' + @includeData = false + + displayTitleUsing: (object) -> + App.i18n.translateInline('Escalation Times') + + buildContentFor: (elem) -> + id = @objectIdFor(elem) + object = @constructor.klass.fullLocal(id) + + @buildHtmlContent( + object: object + ) + +App.PopoverProvider.registerProvider('Escalation', Escalation) diff --git a/app/assets/javascripts/app/lib/mixins/view_helpers.coffee b/app/assets/javascripts/app/lib/mixins/view_helpers.coffee index fd4a0db12..b648815dd 100644 --- a/app/assets/javascripts/app/lib/mixins/view_helpers.coffee +++ b/app/assets/javascripts/app/lib/mixins/view_helpers.coffee @@ -146,12 +146,18 @@ App.ViewHelpers = App.Utils.humanFileSize(size) # define pretty/human time helper - humanTime: (time, escalation = false, cssClass = '') -> + humanTime: (time, escalation = false, cssClass = '', setTitle = true) -> timestamp = App.i18n.translateTimestamp(time) if escalation cssClass += ' escalation' humanTime = App.PrettyDate.humanTime(time, escalation) - "" + + title = " title=\"#{timestamp}\"" + if !setTitle + title = '' + cssClass += ' noTitle' + + "" # Why not just use `Icon: App.Utils.icon`? # Because App.Utils isn't loaded until after this file. diff --git a/app/assets/javascripts/app/views/popover/escalation.jst.eco b/app/assets/javascripts/app/views/popover/escalation.jst.eco new file mode 100644 index 000000000..503cc217b --- /dev/null +++ b/app/assets/javascripts/app/views/popover/escalation.jst.eco @@ -0,0 +1,21 @@ +
+
+<% if @object.first_response_escalation_at: %> +
+ +
<%- @humanTime(@object.first_response_escalation_at, true) %>
+
+<% end %> +<% if @object.update_escalation_at: %> +
+ +
<%- @humanTime(@object.update_escalation_at, true) %>
+
+<% end %> +<% if @object.close_escalation_at: %> +
+ +
<%- @humanTime(@object.close_escalation_at, true) %>
+
+<% end %> +
diff --git a/app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco index 7069421c2..5b1507a58 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco @@ -1,3 +1,8 @@ - <%- @C('ticket_hook') %><%= @ticket.number %> - <%- @T('created') %> <%- @humanTime(@ticket.created_at) %> <% if !@isCustomer && @ticket.escalation_at: %> - <%- @T('escalation') %> <%- @humanTime(@ticket.escalation_at, true) %><% end %> + <%- @C('ticket_hook') %><%= @ticket.number %> + - <%- @T('created') %> <%- @humanTime(@ticket.created_at) %> + +<% if !@isCustomer: %> + <% if @ticket.escalation_at: %> - <%- @T('escalation') %> <%- @humanTime(@ticket.escalation_at, true, '', false) %><% end %> +<% end %> diff --git a/i18n/zammad.pot b/i18n/zammad.pot index 0dacd221f..3c6f36976 100644 --- a/i18n/zammad.pot +++ b/i18n/zammad.pot @@ -3778,6 +3778,7 @@ msgstr "" msgid "Escalation At" msgstr "" +#: app/assets/javascripts/app/lib/app_post/popover_provider/escalation_popover_provider.coffee #: app/assets/javascripts/app/views/sla/index.jst.eco msgid "Escalation Times" msgstr "" @@ -4017,6 +4018,7 @@ msgid "First Response In Min" msgstr "" #: app/assets/javascripts/app/views/generic/sla_times.jst.eco +#: app/assets/javascripts/app/views/popover/escalation.jst.eco #: app/assets/javascripts/app/views/sla/index.jst.eco msgid "First Response Time" msgstr "" @@ -8303,6 +8305,7 @@ msgid "Slack integration" msgstr "" #: app/assets/javascripts/app/views/generic/sla_times.jst.eco +#: app/assets/javascripts/app/views/popover/escalation.jst.eco #: app/assets/javascripts/app/views/sla/index.jst.eco msgid "Solution Time" msgstr "" @@ -9629,6 +9632,7 @@ msgid "Update In Min" msgstr "" #: app/assets/javascripts/app/views/generic/sla_times.jst.eco +#: app/assets/javascripts/app/views/popover/escalation.jst.eco #: app/assets/javascripts/app/views/sla/index.jst.eco msgid "Update Time" msgstr "" diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index 1e7945be3..02d27a1b7 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -2503,4 +2503,26 @@ RSpec.describe 'Ticket zoom', type: :system do end end end + + describe 'Show which escalation type escalated in ticket zoom #3928', authenticated_as: :authenticate do + let(:sla) { create(:sla, first_response_time: 1, update_time: 1, solution_time: 1) } + let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) } + + def authenticate + sla + true + end + + before do + visit "#ticket/zoom/#{ticket.id}" + end + + it 'does show the extended escalation information' do + sleep 4 # wait for popup killer + page.find('.escalation-popover').hover + expect(page).to have_text('FIRST RESPONSE TIME') + expect(page).to have_text('UPDATE TIME') + expect(page).to have_text('SOLUTION TIME') + end + end end