From b7fd467d722b93ba0765a5e7f7f7b8d28f286941 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 28 Sep 2014 21:08:26 +0200 Subject: [PATCH] Split of ticket meta info and title in separate controllers. --- .../app/controllers/ticket_zoom.js.coffee | 43 +++++++++++++------ .../javascripts/app/views/ticket_zoom.jst.eco | 1 + .../app/views/ticket_zoom/meta.jst.eco | 3 ++ .../app/views/ticket_zoom/title.jst.eco | 6 +-- 4 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index abeba6caf..2ba1146dd 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -152,7 +152,16 @@ class App.TicketZoom extends App.Controller nav: @nav isCustomer: @isRole('Customer') ) - @TicketTitle() + + new TicketTitle( + ticket: @ticket + el: @el.find('.ticket-title') + ) + + new TicketMeta( + ticket: @ticket + el: @el.find('.ticket-meta') + ) editTicket = (el) => el.append('
') @@ -367,12 +376,6 @@ class App.TicketZoom extends App.Controller @autosaveStart() - TicketTitle: => - # show ticket title - new TicketTitle( - ticket: @ticket - el: @el.find('.ticket-title') - ) ArticleView: => # show article @@ -606,7 +609,6 @@ class TicketTitle extends App.Controller @html App.view('ticket_zoom/title')( ticket: ticket - isCustomer: @isRole('Customer') ) @$('.ticket-title-update').ce({ @@ -615,9 +617,6 @@ class TicketTitle extends App.Controller maxlength: 250 }) - # show frontend times - @frontendTimeUpdate() - update: (e) => title = $(e.target).ceg() || '' @@ -631,8 +630,26 @@ class TicketTitle extends App.Controller release: => App.Ticket.unsubscribe( @subscribeId ) - #if @subscribeIdEdit - App.Ticket.unsubscribe( @subscribeIdEdit ) + +class TicketMeta extends App.Controller + constructor: -> + super + + @ticket = App.Ticket.fullLocal( @ticket.id ) + @subscribeId = @ticket.subscribe(@render) + @render(@ticket) + + render: (ticket) => + @html App.view('ticket_zoom/meta')( + ticket: ticket + isCustomer: @isRole('Customer') + ) + + # show frontend times + @frontendTimeUpdate() + + release: => + App.Ticket.unsubscribe( @subscribeId ) class Edit extends App.Controller elements: diff --git a/app/assets/javascripts/app/views/ticket_zoom.jst.eco b/app/assets/javascripts/app/views/ticket_zoom.jst.eco index 739702189..c16808136 100644 --- a/app/assets/javascripts/app/views/ticket_zoom.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom.jst.eco @@ -6,6 +6,7 @@
<%- @ticket.customer.avatar(true) %>
+
<% if @C( 'LastOverview' ) && @nav: %> diff --git a/app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco new file mode 100644 index 000000000..47ac28ba9 --- /dev/null +++ b/app/assets/javascripts/app/views/ticket_zoom/meta.jst.eco @@ -0,0 +1,3 @@ + + <%- @C('ticket_hook') %> <%- @ticket.number %> - <%- @T('created') %> ? <% if !@isCustomer && @ticket.escalation_time: %> - <%- @T('escalation') %> ?<% end %> + \ No newline at end of file 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 20e045ac0..c7bf46eeb 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/title.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/title.jst.eco @@ -1,5 +1 @@ -

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

- - - <%- @C('ticket_hook') %> <%- @ticket.number %> - <%- @T('created') %> ? <% if !@isCustomer && @ticket.escalation_time: %> - <%- @T('escalation') %> ?<% end %> - \ No newline at end of file +

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

\ No newline at end of file