Split of ticket meta info and title in separate controllers.
This commit is contained in:
parent
ce8f1000ba
commit
b7fd467d72
4 changed files with 35 additions and 18 deletions
|
@ -152,7 +152,16 @@ class App.TicketZoom extends App.Controller
|
||||||
nav: @nav
|
nav: @nav
|
||||||
isCustomer: @isRole('Customer')
|
isCustomer: @isRole('Customer')
|
||||||
)
|
)
|
||||||
@TicketTitle()
|
|
||||||
|
new TicketTitle(
|
||||||
|
ticket: @ticket
|
||||||
|
el: @el.find('.ticket-title')
|
||||||
|
)
|
||||||
|
|
||||||
|
new TicketMeta(
|
||||||
|
ticket: @ticket
|
||||||
|
el: @el.find('.ticket-meta')
|
||||||
|
)
|
||||||
|
|
||||||
editTicket = (el) =>
|
editTicket = (el) =>
|
||||||
el.append('<form class="edit"></form>')
|
el.append('<form class="edit"></form>')
|
||||||
|
@ -367,12 +376,6 @@ class App.TicketZoom extends App.Controller
|
||||||
|
|
||||||
@autosaveStart()
|
@autosaveStart()
|
||||||
|
|
||||||
TicketTitle: =>
|
|
||||||
# show ticket title
|
|
||||||
new TicketTitle(
|
|
||||||
ticket: @ticket
|
|
||||||
el: @el.find('.ticket-title')
|
|
||||||
)
|
|
||||||
|
|
||||||
ArticleView: =>
|
ArticleView: =>
|
||||||
# show article
|
# show article
|
||||||
|
@ -606,7 +609,6 @@ class TicketTitle extends App.Controller
|
||||||
|
|
||||||
@html App.view('ticket_zoom/title')(
|
@html App.view('ticket_zoom/title')(
|
||||||
ticket: ticket
|
ticket: ticket
|
||||||
isCustomer: @isRole('Customer')
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@$('.ticket-title-update').ce({
|
@$('.ticket-title-update').ce({
|
||||||
|
@ -615,9 +617,6 @@ class TicketTitle extends App.Controller
|
||||||
maxlength: 250
|
maxlength: 250
|
||||||
})
|
})
|
||||||
|
|
||||||
# show frontend times
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
|
|
||||||
update: (e) =>
|
update: (e) =>
|
||||||
title = $(e.target).ceg() || ''
|
title = $(e.target).ceg() || ''
|
||||||
|
|
||||||
|
@ -631,8 +630,26 @@ class TicketTitle extends App.Controller
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
App.Ticket.unsubscribe( @subscribeId )
|
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
|
class Edit extends App.Controller
|
||||||
elements:
|
elements:
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<div class="flex vertical center">
|
<div class="flex vertical center">
|
||||||
<%- @ticket.customer.avatar(true) %>
|
<%- @ticket.customer.avatar(true) %>
|
||||||
<div class="ticket-title"></div>
|
<div class="ticket-title"></div>
|
||||||
|
<div class="ticket-meta"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="page-header-meta">
|
<div class="page-header-meta">
|
||||||
<% if @C( 'LastOverview' ) && @nav: %>
|
<% if @C( 'LastOverview' ) && @nav: %>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<small class="task-subline">
|
||||||
|
<%- @C('ticket_hook') %> <span class="ticket-number"><%- @ticket.number %></span> - <%- @T('created') %> <span class="humanTimeFromNow" data-time="<%- @ticket.created_at %>">?</span> <% if !@isCustomer && @ticket.escalation_time: %> - <%- @T('escalation') %> <span class="humanTimeFromNow escalation" data-time="<%- @ticket.escalation_time %>">?</span><% end %>
|
||||||
|
</small>
|
|
@ -1,5 +1 @@
|
||||||
<h1><span contenteditable="true" class="ticket-title-update" data-placeholder="<%= @T('Enter Title...') %>"><%= @P( @ticket.title ) %></span></h1>
|
<h1><span contenteditable="true" class="ticket-title-update" data-placeholder="<%= @T('Enter Title...') %>"><%= @P( @ticket.title ) %></span></h1>
|
||||||
|
|
||||||
<small class="task-subline">
|
|
||||||
<%- @C('ticket_hook') %> <span class="ticket-number"><%- @ticket.number %></span> - <%- @T('created') %> <span class="humanTimeFromNow" data-time="<%- @ticket.created_at %>">?</span> <% if !@isCustomer && @ticket.escalation_time: %> - <%- @T('escalation') %> <span class="humanTimeFromNow escalation" data-time="<%- @ticket.escalation_time %>">?</span><% end %>
|
|
||||||
</small>
|
|
Loading…
Reference in a new issue